On Thu, Apr 14, 2011 at 06:58, Robert G. Jakabosky <bo...@sharedrealm.com> wrote: > On Wednesday 13, Alexander Gladysh wrote: >> On Thu, Apr 14, 2011 at 06:07, Fabio Mascarenhas <mascaren...@acm.org> > wrote: >> > On Wed, Apr 13, 2011 at 5:11 PM, Alexander Gladysh <aglad...@gmail.com> >> > wrote:
>> > https://gist.github.com/918768 >> > >> > This uses Robert's threading library and 0MQ binding, so will also >> > work with LuaJIT. Farm blocking stuff to the helper threads that send >> > messages to the application when they have stuff for the app to do. >> > The application checks its inbox whenever it is idle. >> I will consider this carefully. >> One extra thread per fork upsets me deeply (maybe it should not). > That accept thread would only really add a bit of memory overhead. So unless > you are forking many thousands of fastcgi process, I don't see it as an issue. > The cpu overhead would be minimal since those threads would be sleeping most > of the time. Also the round-trip latency for each lfcgi.accept() should be > less then about 20-30 microseconds. That is why I said that maybe it should not. I need to think about it... >> Do not read this as critique, but I think that it is a sign that I >> should not use WSAPI anymore (my problem, not WSAPI problem). Sadly I >> have too much legacy code to afford a switch now, so I guess I have to >> find some compromise for a while... > You could use a WSAPI wrapper similar to Fabio's and instead of calling > lfcgi.accept() in a sub-thread, you can use select() on fd 0 (See > FCGI_LISTENSOCK_FILENO from fastcgi.h [1]) and a command socket. When fd 0 > becomes readable you call lfcgi.accept to handle the incoming request. If the > command socket is readable, then you read a message from the command socket. > I would only recommend that for your existing WSAPI applications that you > don't want to port to a better solution. This looks interesting, thank you. Maybe I'll use that as a temporary solution. Alexander. _______________________________________________ Kepler-Project mailing list Kepler-Project@lists.luaforge.net http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project http://www.keplerproject.org/