# How to ensure good performance for the first X number of visitors

**URL:** <https://www.ruby-forum.com/t/how-to-ensure-good-performance-for-the-first-x-number-of-visitors/236863>\
**Category:** NGINX\
**Created:** [October 8, 2013, 10:36am UTC](https://www.ruby-forum.com/t/how-to-ensure-good-performance-for-the-first-x-number-of-visitors/236863 "2013-10-08T10:36:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [October 8, 2013, 10:36am UTC](https://www.ruby-forum.com/t/how-to-ensure-good-performance-for-the-first-x-number-of-visitors/236863/1 "2013-10-08T10:36:13Z")

</div>

Hi all,

I’m looking for some guidance with Nginx. We have inherited a web-server  
that experiences heavy load. The server is running: Ubuntu Server 12.4,  
24  
Cores, 50~GB RAM.

The CPU usage during peak time is 100%. Memory is about 50%.

The client has asked that we configure Nginx to give the best user  
experience for the first X number of visitors while the others are  
503’d.  
So a visitor to the website can experience good usage from start to  
purchase (it’s a commerce site). While others who visit (over a  
threshold)  
would get 503 errors. This would ensure that, if you can get in, your  
experience would be nice. If you can’t, 503 and try again later.

I see there are some modules that can do this with a recompile but we’d  
rather not go down that path at this stage. Given that http is  
session-less, i suppose cookies have been used to achieve this. Or based  
on  
IP address.

Any thoughts?

–  
-Andrew Galdes  
Managing Director

RHCSA, LPI, CCENT

AGIX Linux

Ph: 08 7324 4429  
Mb: 0422 927 598

Site: [http://www.agix.com.au](http://www.agix.com.au)  
Twitter: [http://twitter.com/agixlinux](http://twitter.com/agixlinux)  
LinkedIn: [http://au.linkedin.com/in/andrewgaldes](http://au.linkedin.com/in/andrewgaldes)

---

<div class="post-metadata">

**Author:** ![Andrew\_Galdes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ecd19e/32.png) [@Andrew\_Galdes](https://www.ruby-forum.com/u/Andrew_Galdes)\
**Post date:** [October 8, 2013, 10:44am UTC](https://www.ruby-forum.com/t/how-to-ensure-good-performance-for-the-first-x-number-of-visitors/236863/2 "2013-10-08T10:44:25Z")

</div>

On 08/10/13 21:35, Andrew Galdes wrote:

> 503’d. So a visitor to the website can experience good usage from  
> Any thoughts?  
> Ph: 08 7324 4429  
> removed\_email\_address@domain.invalid  
> [nginx Info Page](http://mailman.nginx.org/mailman/listinfo/nginx)  
> Hi Andrew,

I seem to be doing exactly this for a living at the moment ( especially  
Magento installs ), and not that many timezones away. If you want to  
drop me a line offlist, please do!

Steve

---

<div class="post-metadata">

**Author:** ![Andrew\_Galdes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ecd19e/32.png) [@Andrew\_Galdes](https://www.ruby-forum.com/u/Andrew_Galdes)\
**Post date:** [October 8, 2013, 2:40pm UTC](https://www.ruby-forum.com/t/how-to-ensure-good-performance-for-the-first-x-number-of-visitors/236863/3 "2013-10-08T14:40:31Z")

</div>

Hello,

I would take a look at this module:  
[http://nginx.org/en/docs/http/ngx\_http\_limit\_conn\_module.html](http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html)

## Official modules are available through the pre-compiled official binaries, you won’t need to do that by hand.

_B. R._
