[erlang-questions] Memory consumption in ssl application (OTP-18.3.1)
vicbaz@REDACTED
vicbaz@REDACTED
Mon Apr 25 14:35:28 CEST 2016
Hello,
When I run
https://github.com/ninenines/cowboy/tree/1.0.4/examples/ssl_hello_world
under load (using https://github.com/JoeDog/siege) I found a big
difference in memory consumption between OTP-17.5 and OTP-18.3. I know
the ssl application has many changes in new versions. Is this memory
usage normal now or can be reduced using some ssl application settings?
I use OTP-17.5.6.9 and OTP-18.3.1.
================================================================================
Erlang/OTP 17 [erts-6.4.1.6] [source] [64-bit] [smp:2:2]
[async-threads:10] [hipe] [kernel-poll:false]
1> application:which_applications().
[{ssl_hello_world,"Cowboy Hello World example with SSL.",
"1"},
{cowboy,"Small, fast, modular HTTP server.","1.0.4"},
{ranch,"Socket acceptor pool for TCP protocols.","1.2.1"},
{cowlib,"Support library for manipulating Web protocols.",
"1.0.2"},
{ssl,"Erlang/OTP SSL application","6.0.1.2"},
{public_key,"Public key infrastructure","0.23"},
{crypto,"CRYPTO","3.5"},
{asn1,"The Erlang ASN1 compiler version 3.0.4","3.0.4"},
{stdlib,"ERTS CXC 138 10","2.4"},
{kernel,"ERTS CXC 138 10","3.2.0.1"}]
2> erlang:memory().
[{total,43913840},
{processes,8036312},
{processes_used,8030744},
{system,35877528},
{atom,470537},
{atom_used,455904},
{binary,1498800},
{code,11074476},
{ets,14516424}]
3> recon_alloc:memory(used).
45519464
4> recon_alloc:memory(usage).
0.7212344918526264
5> recon:proc_window(memory, 10, 500).
[{<0.25910.2>,68120,
[{current_function,{gen_fsm,loop,7}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.25908.2>,68120,
[{current_function,{gen_fsm,loop,7}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.284.0>,15808,
[ssl_manager,
{current_function,{gen_server,loop,6}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.285.0>,12712,
[tls_connection_sup,
{current_function,{gen_server,loop,6}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.25909.2>,5888,
[{current_function,{gen,do_call,4}},
{initial_call,{cowboy_protocol,init,4}}]},
{<0.324.0>,4888,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.302.0>,4808,
[{current_function,{ranch_conns_sup,loop,4}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.330.0>,3016,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.25911.2>,2848,
[{current_function,{gen,do_call,4}},
{initial_call,{cowboy_protocol,init,4}}]},
{<0.340.0>,1872,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]}]
6> recon:proc_window(reductions, 10, 500).
[{<0.2634.3>,11161,
[{current_function,{gen_fsm,loop,7}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.2633.3>,9747,
[{current_function,{crypto,int_to_bin_pos,2}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.284.0>,4097,
[ssl_manager,
{current_function,{gen_server,loop,6}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.285.0>,3314,
[tls_connection_sup,
{current_function,{gen_server,loop,6}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.302.0>,1003,
[{current_function,{ranch_conns_sup,loop,4}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.378.0>,426,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.372.0>,425,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.379.0>,425,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.377.0>,425,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.343.0>,425,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]}]
RES in htop ~50-60M
================================================================================
Erlang/OTP 18 [erts-7.3.1] [source] [64-bit] [smp:2:2]
[async-threads:10] [hipe] [kernel-poll:false]
1> application:which_applications().
[{ssl_hello_world,"Cowboy Hello World example with SSL.",
"1"},
{cowboy,"Small, fast, modular HTTP server.","1.0.4"},
{ranch,"Socket acceptor pool for TCP protocols.","1.2.1"},
{cowlib,"Support library for manipulating Web protocols.",
"1.0.2"},
{ssl,"Erlang/OTP SSL application","7.3"},
{public_key,"Public key infrastructure","1.1.1"},
{crypto,"CRYPTO","3.6.3"},
{asn1,"The Erlang ASN1 compiler version 4.0.2","4.0.2"},
{recon,"Diagnostic tools for production use","2.3.1"},
{stdlib,"ERTS CXC 138 10","2.8"},
{kernel,"ERTS CXC 138 10","4.2"}]
2> erlang:memory().
[{total,949153560},
{processes,902969888},
{processes_used,902558312},
{system,46183672},
{atom,437761},
{atom_used,432875},
{binary,48320},
{code,11407283},
{ets,883640}]
3> recon_alloc:memory(used).
863194560
4> recon_alloc:memory(usage).
0.8005009562139471
5> recon:proc_window(memory, 10, 500).
[{<0.290.0>,94360,
[ssl_manager,
{current_function,{ssl_manager,handle_cast,2}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.13589.3>,24640,
[{current_function,{ssl_manager,validate_session,3}},
{initial_call,{ssl_manager,init_session_validator,1}}]},
{<0.291.0>,12832,
[tls_connection_sup,
{current_function,{gen_server,loop,6}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.13590.3>,10960,
[{current_function,{gen,do_call,4}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.318.0>,7904,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.308.0>,3056,
[{current_function,{ranch_conns_sup,loop,4}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.385.0>,1872,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.254.0>,0,
[code_server,
{current_function,{code_server,loop,1}},
{initial_call,{erlang,apply,2}}]},
{<0.325.0>,0,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.357.0>,0,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]}]
6> recon:proc_window(reductions, 10, 500).
[{<0.290.0>,232358,
[ssl_manager,
{current_function,{gen_server,loop,6}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.291.0>,3058,
[tls_connection_sup,
{current_function,{gen_server,loop,6}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.308.0>,1129,
[{current_function,{ranch_conns_sup,loop,4}},
{initial_call,{proc_lib,init_p,5}}]},
{<0.339.0>,435,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.340.0>,430,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.355.0>,430,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.353.0>,430,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.334.0>,430,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.366.0>,430,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]},
{<0.360.0>,430,
[{current_function,{prim_inet,accept0,2}},
{initial_call,{ranch_acceptor,loop,3}}]}]
RES in htop ~900-1000M
More information about the erlang-questions
mailing list