[erlang-questions] Memory usage with gen_tcp

Edwin Fine <>
Thu Sep 18 18:01:28 CEST 2008


I don't know if this is a stupid idea, but if you are load testing is it
possible that there is always around 40KB of data in flight per process? If
you stop load testing and force a garbage collection in each process, does
the figure reduce? Just a WAG.

On Thu, Sep 18, 2008 at 11:19 AM, Paul Oliver <> wrote:

> Hi all,
>
> I have a simple echo server built on top of mochiweb_socket_server
> (http://mochiweb.googlecode.com/svn/trunk/src/mochiweb_socket_server.erl):
>
> -define(DEFAULTS, [{ip, "127.0.0.1"}, {loop, {?MODULE, loop}}, {name,
> ?MODULE}, {port, 8888}, {max, 100000}]).
>
> start() ->
>    start(?DEFAULTS).
>
> start(Options) ->
>    mochiweb_socket_server:start(Options).
>
> loop(Socket) ->
>    case gen_tcp:recv(Socket, 0) of
>        {ok, Data} ->
>            gen_tcp:send(Socket, Data),
>            loop(Socket);
>        {error, closed} ->
>            ok
>    end.
>
> I'm load testing and have found that the memory used in the echo
> server per connected client is approximately 40K.  I've tried setting
> sndbuf and recbuf to 1024 respectively (hardcoded in
> mochiweb_socket_server), but this doesn't seem to make a difference.
> Does anybody know where I should be looking to reduce this figure?
>
> Thanks,
> Paul.
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080918/3a8e3b60/attachment.html>


More information about the erlang-questions mailing list