Server load tests on Linux

Zvi zvi.avraham@REDACTED
Sun Dec 12 19:31:04 CET 2010


Just try something like this (spawn a process per HTTP request):

http_get(Path, IP, Port) ->
    case gen_tcp:connect(IP, Port, [binary]) of
        {ok, Sock} ->
            HttpReq = iolist_to_binary(io_lib:format("GET ~s\r\n"
                                                        "Host: ~s\r\n"
                                                        "\r\n",
                                                        [Path, IP])),
            ok = gen_tcp:send(Sock, HttpReq),
            do_recv(Sock),
            case (catch gen_tcp:close(Sock)) of
                {'EXIT',_} -> error;
                _ -> ok
            end,

        {error, Reason} ->
            io:format("Error ~p connecting outbound socket: ~s:~b~n",
[Reason,IP,Port])
    end.

do_recv(Sock)->
    case gen_tcp:recv(Sock, 0) of
        {ok, Data} ->
            io:format("Recvd ~s~n", [Data]);
        {error, closed} ->
            closed;
        _Other ->
            io:format("Other ~p~n", [_Other])
    end.

Zvi

On Dec 9, 7:34 pm, Alessandro Sivieri <alessandro.sivi...@REDACTED>
wrote:
> Hi all,
>
> I'm trying to perform some load tests on a Web server, so I have created a
> little script performing parallel connections to the server and getting the
> responses, all this using httpc, but when this number gets large this
> message starts to pop out:
>
> =ERROR REPORT==== 9-Dec-2010::18:30:14 ===
> HTTPC-MANAGER<httpc_manager> handler (<0.297.0>) successfully started for
> unknown request #Ref<0.0.0.651> => canceling
>
> Is there a limit in the number httpc is able to treat? Or maybe I have to
> change something in my OS (Ubuntu 10.10)?
>
> --
> Sivieri Alessandro
> alessandro.sivi...@REDACTED://www.chimera-bellerofonte.eu/http://www.poul.org/


More information about the erlang-questions mailing list