Improve the SSL accept performance

Kaiduan Xie kaiduanx@REDACTED
Tue Nov 30 17:34:42 CET 2010

Hi all,

I just found the SSL accept in erlang is slower than C version. The
load test opens 10K persistent SSL connection at the same time, it
takes longer for Erlang version to finish. In Erlang version, for each
TLS connection, a gen_fsm is started to waiting for packet. The code
snippet to accept SSL connection is listed as below,

    {ok, Socket} = ssl:transport_accept(State#state.lsocket),
                 {server, State#state.lsocket, State#state.parent},
    ok = ssl:ssl_accept(Socket),
    {ok, {PeerAddr, PeerPort}} = ssl:peername(Socket),
    ?DEBUG("Accepted peer:~p:~p", [PeerAddr, PeerPort]),
    State#state.parent ! {add_tls_connection, PeerAddr, PeerPort, self()},
    {next_state, wait_for_crlf_crlf, State#state{socket = Socket,
                   peer_address = PeerAddr, peer_port = PeerPort}}.

Can anyone point out if I am doing things wrong? Can we start multiple
erlsip_transport_tls_connection gen_fsm to wait for connection? The
documentation is not clear on this point.

Any comments are welcome. I am building an Erlang prototype to
persuade the management to go for Erlang instead of legacy C version.

BTW, OTP-12B-5 is used on Linux.



More information about the erlang-questions mailing list