Providing access to nginx state machine

Piotr Sikora piotr.sikora at frickle.com
Wed May 12 00:00:25 MSD 2010


Hi,

> Connect to network service (not HTTP). Send some request. Acquire
> result. And all this asynchronously.
> The result should not be returned to user, instead I want to do
> something with it.

But is this request associated with the incoming request? That is, do you 
want to communicate with your network service for each request and finish it 
before response is sent back to the client?

> So, in order not to block nginx, I must use its state machine, right?

There is no state machine per se. You need to add/remove your events to/from 
nginx's event model (which is OS-independent abstraction layer on top of 
epoll/kqueue/etc).

> As far as I can understand, ngx-drizzle is doing something like this.

Actually, it isn't. It is communicating with 3rd-party library (libdrizzle). 
You won't see any network communication in there, only library calls and 
events triggered on library's socket.

Like I said previously, you most likely want to use either subrequests or 
"independent reqequests".

Best regards,
Piotr Sikora < piotr.sikora at frickle.com >
 




More information about the nginx-devel mailing list