# HttpUpstreamModule: Need more detailed Information

**URL:** <https://www.ruby-forum.com/t/httpupstreammodule-need-more-detailed-information/222066>\
**Category:** NGINX\
**Created:** [August 10, 2012, 1:37pm UTC](https://www.ruby-forum.com/t/httpupstreammodule-need-more-detailed-information/222066 "2012-08-10T13:37:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 10, 2012, 1:37pm UTC](https://www.ruby-forum.com/t/httpupstreammodule-need-more-detailed-information/222066/1 "2012-08-10T13:37:40Z")

</div>

Hello all,

i’m new to nginx and first of all i have to say it’s a great piece of  
software.

I need some more detailed Information about nginx behaviour regarding  
HttpUpstreamModule and I hope you can give me some hints and links where  
i can learn more about it.  
I set up nginx/1.2.2 as reverse proxy in front of a bunch of apache  
server(\*) which are located in different housing locations.

Now I have some questions and I can’t find any docs or wiki pages with  
detailed answers.

- how does nginx detect if one ore more upstream servers has diappeared?

- how can I monitor the status of upstream server seen by nginx (I  
monitor the status of running apache prcesses on the upstream server  
separately)

It’s a is really simple setup atm and I have not activated any other  
module:

upstream frontend {  
server frontend1:80 weight=100 max\_fails=2 fail\_timeout=10s;  
server frontend2:80 weight=100 max\_fails=2 fail\_timeout=10s;  
server frontend3:80 weight=100 max\_fails=2 fail\_timeout=10s;  
server frontend4:80 weight=100 max\_fails=2 fail\_timeout=10s;  
server frontend5:80 weight=100 max\_fails=2 fail\_timeout=10s;  
}

location / {  
proxy\_next\_upstream http\_502 http\_503 error;  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
proxy\_pass [http://frontend/](http://frontend/);  
proxy\_redirect default;  
}

I googled around and found this thread  
[Querying backend/upstream server status](http://forum.nginx.org/read.php?29,108477) but got no answer.

Any help is appreciated

Regards, Axel

---

<div class="post-metadata">

**Author:** ![axel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6de8d8/32.png) [@axel](https://www.ruby-forum.com/u/axel)\
**Post date:** [August 10, 2012, 3:46pm UTC](https://www.ruby-forum.com/t/httpupstreammodule-need-more-detailed-information/222066/2 "2012-08-10T15:46:13Z")

</div>

Hello!

On Fri, Aug 10, 2012 at 01:36:46PM +0200, Axel wrote:

> Now I have some questions and I can’t find any docs or wiki pages  
> with detailed answers.
> 
> - how does nginx detect if one ore more upstream servers has diappeared?
> - what kind of mechanism does nginx use? icmp or something else?

It detects based on status of requests to upstream servers. If  
requests fail - the server is considered down and additional  
requests aren’t routed to it for some time.

> **[Module ngx\_http\_upstream\_module](http://nginx.org/en/docs/http/ngx_http_upstream_module.html#server)**
>
> The ngx\_http\_upstream\_module module is used to define groups of servers that can be referenced by the proxy\_pass, fastcgi\_pass, uwsgi\_pass, scgi\_pass, memcached\_pass, and grpc\_pass directives.

> - how often does nginx request the status of upstream servers?

For alive servers - as often as normal requests are routed to the  
servers. For servers already considered down - once per  
fail\_timeout (per worker, see below).

> - how can I monitor the status of upstream server seen by nginx (I  
> monitor the status of running apache prcesses on the upstream server  
> separately)

Currently, there is no way. Moreover, each nginx worker process  
has it’s own idea about status of upstream servers.

Maxim D.

---

<div class="post-metadata">

**Author:** ![axel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6de8d8/32.png) [@axel](https://www.ruby-forum.com/u/axel)\
**Post date:** [August 13, 2012, 4:44am UTC](https://www.ruby-forum.com/t/httpupstreammodule-need-more-detailed-information/222066/3 "2012-08-13T04:44:37Z")

</div>

2012/8/10 Axel [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Now I have some questions and I can’t find any docs or wiki pages with  
> detailed answers.
> 
> - how does nginx detect if one ore more upstream servers has diappeared?
> 
> - how can I monitor the status of upstream server seen by nginx (I monitor  
> the status of running apache prcesses on the upstream server separately)

You may try the Tengine ([http://tengine.taobao.org/](http://tengine.taobao.org/)), a forked nginx  
version. We added proactive health check for the upstream servers.

This module  
([ngx\_http\_upstream\_check\_module - The Tengine Web Server](http://tengine.taobao.org/document/http_upstream_check.html))  
can check the upstream servers periodically. If the upstream is marked  
down, the request will not be sent to this server. If it’s up, the  
request will be sent to it again.

If you don’t like this forked Nginx, you also can use the single  
ngx\_http\_upstream\_check module  
([GitHub - yaoweibin/nginx\_upstream\_check\_module: Health checks upstreams for nginx · GitHub](https://github.com/yaoweibin/nginx_upstream_check_module)). It can  
supply the same feature as Tengine.

Thanks. Good luck.

---

<div class="post-metadata">

**Author:** ![axel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6de8d8/32.png) [@axel](https://www.ruby-forum.com/u/axel)\
**Post date:** [August 13, 2012, 8:24am UTC](https://www.ruby-forum.com/t/httpupstreammodule-need-more-detailed-information/222066/4 "2012-08-13T08:24:56Z")

</div>

Hi,

thanks for your answers. I will have a look on nginx development and  
take a look as suggested in the other answer.

Regards,  
Axel

Am 10.08.2012 15:45, schrieb Maxim D.:

> > - how does nginx detect if one ore more upstream servers has diappeared?
> > - what kind of mechanism does nginx use? icmp or something else?
> 
> It detects based on status of requests to upstream servers. If  
> requests fail - the server is considered down and additional  
> requests aren’t routed to it for some time.
