[erlang-questions] Performance inets httpd versus comboy

Frans Schneider schneider@REDACTED
Fri Jul 25 12:51:46 CEST 2014


Hi list,

Running Cowboy versus inets httpd gives a huge performance difference. 
Cowboy handles 700+ requests per second and httpds only 26. Cowboy takes 
88 % CPU but httpd only 5%. Why is it that httpd does not run at full speed?

System specs:
Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz
Memory 8GB
Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u1 x86_64 GNU/Linux
Erlang/OTP 17 [erts-6.1] [source] [64-bit] [smp:2:2] [async-threads:10] 
[kernel-poll:false]

Cowboy is started like this:

     application:start(crypto),
     application:start(ranch),
     application:start(cowlib),
     application:start(cowboy),

     Dispatch = cowboy_router:compile([
         %% {URIHost, list({URIPath, Handler, Opts})}
         {'_', [{'_', empty_handler, []}]}
     ]),
     %% Name, NbAcceptors, TransOpts, ProtoOpts
     cowboy:start_http(my_http_listener, 100,
         [{port, 8080}],
         [{env, [{dispatch, Dispatch}]}]
     ),

And httpd is started like this

     application:start(inets),
     inets:start(httpd,
                 [{modules,
                   [
                    mod_empty
                   ]},
                  {port,8080},
                  {max_clients, 1000},
                  {server_root,"log"},
                  {server_name,"hello_world"},
                  {document_root,"www"}
                 ]),

Both empty_handler and mod_empty return status 200 plus a proper XML-RPC 
reply.

The client is a Python script:

server = xmlrpclib.ServerProxy('http://localhost:8080')
while True:
     server.ping(1234)

Thanks,

Frans




More information about the erlang-questions mailing list