Heart beat

Hi all,

Does anyone know how to implement heart beat when using Nginx for load
balancing between web servers?

Ideally I would like it to work, so that it checks the content for a web
page and if that is not correct then the server is dropped out from the
load balancer.

Regards,

Olli

Posted at Nginx Forum:

Does anyone know how to implement heart beat when using Nginx for load balancing between web servers?

AFAIK heartbeat is just to make sure a daemon is running (and acting
upon the reply), but i’m often wrong.

Ideally I would like it to work, so that it checks the content for a web page and if that is not correct then the server is dropped out from the load balancer.

So it’s kind of like making sure all servers are up to date on their
contents and cache? I don’t know about nginx proper, but you could use
cron, wget, some (perl?) scripting… especially if you can target
specific (worker) processes. Otherwise i’m not sure how could you tell
nginx (or other daemons) what “correct content” is.

Just a layman’s suggestion…

With heart beat I mean to check that all workers are fucntioning as
expected.

Yeah for sure wget call would do it, but communicate the result from
wget to Nginx in order to drop the misbehaving worker out?

Posted at Nginx Forum:

Yeah for sure wget call would do it, but communicate the result from wget to Nginx in order to drop the misbehaving worker out?

I don’t know about one single worker, but you can HUP nginx, it’ll
create new workers. See [1]. Of course if the bad worker is just
frozen or dead, i guess you’d have to kill it first, then HUP nginx
main process.

I think nginx will wait until workers are free before replacing them,
hence the need to maybe kill the lazy worker.

HTH

[1]

You should read this paper:
http://www.techmasala.com/2009/04/06/dynamically-scale-web-applications-in-amazon-ec2/

2009/9/8 Nuno Magalhães [email protected]: