Hi
I'm using MochiWeb for a long-polling comet server.
I'm running an app on one machine that spawns N gen_servers, each one login and send an http get request.
Mochiweb on another machine waits 30 secs and reply. The gen_server sends a new request...
I'm creating the clients and start sending requests immediately without setting a delay.
When I spawn 100 long-polling clients it works fine and they keep running.
When I'm increasing the number to 120 I see errors both on the client and the server machines.
On the mochiweb side I see {tcp_closed, Socket} messages.
On the client side I'm getting 404 responses:
{{"HTTP/1.1",400,"Bad Request"},
[{"date","Wed, 18 May 2011 21:33:21 GMT"},
{"server","MochiWeb/1.0 (Any of you quaids got a smint?)"},
{"content-length","0"}],
<<>>}
I'm using R140B on ubuntu 11.04. I didn't change any linux/erlang settings.
I'm starting mochiweb with the default settings:
mochiweb_http:start([{name, ?MODULE}, {loop, Loop}, {ip, IP}, {port, Port}]).
The waiting loop for long-polling:
wait(MochiReq) ->
% put the socket in active once mode so we can receive the tcp_closed message.
Socket = MochiReq:get(socket),
inet:setopts(Socket, [{active, once}]),
receive
{tcp_closed, Socket} ->
{error, socket_closed};
Res ->
Res
after
?WAIT ->
timeout
end.
Are there any system/mochiweb settings I need to use?
Could it be that I'm reaching some limits? How can I find out what?
Thanks