Hello,

I am trying to implement a server using a "pre-fork" design. It
currently works great with a custom protocol, but I'd like to integrate
HTTP support - using evhttp.

The current design is the following: A control process creates and
bind()s a socket, and then forks N times. This creates N processes that
will listen() on this socket. Each process passes this socket to
libevent, and one of them eventually accept()s a new connection, and
handles the client. The socket is non-blocking, which means that of all
the processes that try to accept(), only one will succeed, the others
getting -1.

I integrated evhttp into this design: I first had a problem with the
call to evhttp_bind_socket(). This in turn calls bind(), which can not
happen in the workers. This is why I moved it to the first process,
before the calls to fork(). But then I can see only one "child" process
handling all the clients (I'm using "ab -c100" to generate them).

How can I have all the forked children handle the queries? I tried
running event_init() again in the child, but then I don't get any http
callback.


Thanks in advance and congrats for such a nice library.

Nicolas
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users

Reply via email to