Nginx + Thin cluster of 3. Which Thin took the request?

Hi, I just managed to setup a front end web server with Nginx and then a
cluster of 3 Thin servers behind it who serve instances of the same app.

At least the app responds properly through Nginx.
After making a request, how can I find out which app actually processed
the request? The only log I see growing is the development.log
I have thin.300x.log files but don’t increase in size when requests are
made…

Thanks

Anyone?
I’m trying to get some logs using the http_upstream_ prefix but no luck
yet…

Cheers.

On Thu, Feb 11, 2010 at 12:18 PM, comopasta Gr [email protected]
wrote:

Anyone?
I’m trying to get some logs using the http_upstream_ prefix but no luck
yet…

Can you add a response header from within your app? something like
X-I-Am-Pid with the pid of the serving process? or even just monitoring
with
top sorted by cpu usage (if 3 thins are active, it’s all 3, otherwise
it’s
not balancing!

Hello!

On Thu, Feb 11, 2010 at 12:18:47PM +0100, comopasta Gr wrote:

Anyone?
I’m trying to get some logs using the http_upstream_ prefix but no luck
yet…

Well, probably you have no headers named Upstream-* got from
client. If you instead need headers you got from upstream - use

$upstream_http_…

instead.

Maxim D.

Hi again,

Thanks for the hints. I was trying to use $upstream_http_… but that
didn’t print out anything.

This is all in development environment so no big loads or anything. Just
testing the setup.

I actually managed to verify that the cluster is operative. By checking
with Process.pid that I get responses from the three pids that belong to
each server of the cluster.

But I would guess that Nginx should know to which app server is
forwarding the request (?) I a more friendly way…

Cheers.

On Wed, Feb 17, 2010 at 11:37:03AM +0100, comopasta Gr wrote:

each server of the cluster.

But I would guess that Nginx should know to which app server is
forwarding the request (?) I a more friendly way…

Try to log $upstream_addr.


Igor S.
http://sysoev.ru/en/

Thanks Igor! I am pathetic at reading documentation :stuck_out_tongue:
http://wiki.nginx.org/NginxHttpUpstreamModule#.24upstream_addr

Yes $upstream_addr prints out the address of the server that handled the
request!

Thanks!