Welcome! Log In Create A New Profile

Advanced

Re: question about workers and proxying to dead upstream.

May 05, 2009 01:18AM
On Mon, May 04, 2009 at 11:49:45PM +0200, Adrian Bak wrote:

> Hey guys...
>
> We have a setup where we serve static files from our nginx servers and
> if the file doesn?t exist we proxy to a backend server (that generates
> a static file, and we have another app to delete the static files when
> they get to old).
>
> The config file looks something like this (on my machine i am testing
> with an apache running on port 8888):
>
> worker_processes 1;
> events {
> worker_connections 5; # 5 for testing. would be much higher in production
> }
>
> ...
>
> upstream dynamic {
> server localhost:8888;
> }
>
> location / {
> ssi on;
> try_files $uri $uri/index.html @nothere;
> break;
> }
>
> location @nothere {
> break;
>
> proxy_redirect on;
>
> # setting extra header
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>
> # setting timeout values for the proxying
> proxy_connect_timeout 90;
> proxy_send_timeout 90;
> proxy_read_timeout 90;
>
> # setting proxy buffer sizes
> proxy_buffer_size 4k;
> proxy_buffers 4 32k;
> proxy_busy_buffers_size 64k;
> proxy_temp_file_write_size 64k;
>
> proxy_pass http://dynamic;
> }
>
> Anyways my question is: what happens if there are 5 (number of
> worker_connection*number_worker_processes) connections to a non
> existing file (it has to proxy) and the backend server times out (i
> have a sleep in my php for testing purpose)?
> Can nginx still serve static files (file that exist)?
> Will it allow 5 connections to the upstream?
>
> I can?t find the answer on the wiki anywhere and my own test?s with ab
> and curl show that it won?t allow for 5 connections to upstream
> servers if it?s hanging on one of them (it will show a ?The page you
> are looking for is temporarily unavailable.
> Please try again later.?) - is this correct?

Yes. Note also, that one connection is required for client side,
and one connection is required for proxy/fastcgi side. Therefore
for each proxied request you need 2 connections.


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

question about workers and proxying to dead upstream.

Adrian Bak May 04, 2009 05:49PM

Re: question about workers and proxying to dead upstream.

Igor Sysoev May 05, 2009 01:18AM

Re: question about workers and proxying to dead upstream.

Adrian Bak May 05, 2009 02:42PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 261
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready