[erlang-questions] Improve the SSL accept performance

Attila Rajmund Nohl <>
Tue Nov 30 18:15:42 CET 2010


Hello!

I suggest testing with OTP R14B, the SSL implementation in Erlang has
been rewritten since R12B.

2010/11/30, Kaiduan Xie <>:
> 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),
>     gen_fsm:start(erlsip_transport_tls_connection,
>                  {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.
>
> Thanks,
>
> /Kaiduan
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>


More information about the erlang-questions mailing list