# Heart beat

**URL:** <https://www.ruby-forum.com/t/heart-beat/175143>\
**Category:** NGINX\
**Created:** [September 8, 2009, 11:18pm UTC](https://www.ruby-forum.com/t/heart-beat/175143 "2009-09-08T23:18:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ojaro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/b3f665/32.png) [@ojaro](https://www.ruby-forum.com/u/ojaro)\
**Post date:** [September 8, 2009, 11:18pm UTC](https://www.ruby-forum.com/t/heart-beat/175143/1 "2009-09-08T23:18:21Z")

</div>

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:

> **[Heart beat](https://forum.nginx.org/read.php?2,6020,6020#msg-6020)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![ojaro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/b3f665/32.png) [@ojaro](https://www.ruby-forum.com/u/ojaro)\
**Post date:** [September 8, 2009, 11:29pm UTC](https://www.ruby-forum.com/t/heart-beat/175143/2 "2009-09-08T23:29:28Z")

</div>

> 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…

---

<div class="post-metadata">

**Author:** ![ojaro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/b3f665/32.png) [@ojaro](https://www.ruby-forum.com/u/ojaro)\
**Post date:** [September 9, 2009, 12:33am UTC](https://www.ruby-forum.com/t/heart-beat/175143/3 "2009-09-09T00:33:17Z")

</div>

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:

> **[Re: Heart beat](https://forum.nginx.org/read.php?2,6020,6036#msg-6036)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![ojaro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/b3f665/32.png) [@ojaro](https://www.ruby-forum.com/u/ojaro)\
**Post date:** [September 9, 2009, 12:39am UTC](https://www.ruby-forum.com/t/heart-beat/175143/4 "2009-09-09T00:39:09Z")

</div>

> 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]

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

---

<div class="post-metadata">

**Author:** ![ojaro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/b3f665/32.png) [@ojaro](https://www.ruby-forum.com/u/ojaro)\
**Post date:** [September 18, 2009, 9:10pm UTC](https://www.ruby-forum.com/t/heart-beat/175143/5 "2009-09-18T21:10:27Z")

</div>

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

2009/9/8 Nuno MagalhÃ£es [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
