How many users can my server handle?

CranialBlaze

Expert Member
Joined
Jan 24, 2008
Messages
4,207
Reaction score
1,101
I run a site for a client, social network. The server we have I am confident can handle a good few thousand users, my concern is bandwidth.

By my estimates the server has about 30mb worth of BW for it, the sites is just under 1.5mb for first time visitors, compression and caching takes that down to 250k there after. Now according to the clients this site is getting broadcast on some TV show ti 217 million international homes, now realistically probably only a small percentage of that will actually see the show and a small percentage of that visit the site.

What I would like to know is how to calculate how many users can realistically connect to that site in a single instance can connect on a 30mb link.
 
30 megabit = 30 * 1024 = 30720 kbps
250 KB/s * 8 = 2000 kb for page 1
30720 / 2000 = 15.36

Assuming all your visitors have 2000kbps connections, you can handle 15.36 'old' visitors per second that just view the first page. But if more visitors hit the available bandwidth will just be shared amongst the visitors and they'll barely notice if your website does not load in under a second anymore.

1.5MB * 1024 * 8 = 12288kb for page 1
30720 / 12288 = 2.5

Your server will be able to handle 2.5 "New" visitors per second. Assuming that they have 12288kbps connections. But if more new visitors hit the available bandwidth will just be shared amongst the visitors and they'll barely notice if your website does not load in under a second.

As you can see, there are a lot of assumptions. No one easy answer. Most of the time your server will be able to handle more active clients because not everyone have clean 2000-12288kbps connections, not everyone is opening the page at exactly the same second, not everyone will browse your site as fast as another, not everyone is located in the same country as the server and will be subject to some delay, not everyone will notice if your page does not instantly open up.

But I have to say, 30mbps is just not the norm these days. Most servers run on at least a 100mbps port. Just keep an eye on your bandwidth graph. That would be the easiest imo.
 
30 megabit = 30 * 1024 = 30720 kbps
250 KB/s * 8 = 2000 kb for page 1
30720 / 2000 = 15.36

Assuming all your visitors have 2000kbps connections, you can handle 15.36 'old' visitors per second that just view the first page. But if more visitors hit the available bandwidth will just be shared amongst the visitors and they'll barely notice if your website does not load in under a second anymore.

1.5MB * 1024 * 8 = 12288kb for page 1
30720 / 12288 = 2.5

Your server will be able to handle 2.5 "New" visitors per second. Assuming that they have 12288kbps connections. But if more new visitors hit the available bandwidth will just be shared amongst the visitors and they'll barely notice if your website does not load in under a second.

As you can see, there are a lot of assumptions. No one easy answer. Most of the time your server will be able to handle more active clients because not everyone have clean 2000-12288kbps connections, not everyone is opening the page at exactly the same second, not everyone will browse your site as fast as another, not everyone is located in the same country as the server and will be subject to some delay, not everyone will notice if your page does not instantly open up.

But I have to say, 30mbps is just not the norm these days. Most servers run on at least a 100mbps port. Just keep an eye on your bandwidth graph. That would be the easiest imo.

That was just a guess based on a DL through SSH. Could very easily be wrong. They are however expecting in the 10's of thousands to come to the site very soon after that broadcast.
The server itself is not suitable, we are trying to convince them to move to an international server as we numerous problems, its not setup for a CMS let alone a social network. The provider simply does not have the skills or experience to actually set it up correctly and I found a specialist company, but the clients afraid of burning bridges and offending he's contact with this local company. Not like it would be a realistic long term solution anyway, a socialnetwork, business directory, store and video gallery will not survive on SA bandwidth if you expect to target a niche market of 1.2 billion people.

Found a specialist hosting company with 3 data centers on 2 continents with the skills, expertise and experience to ensure the site works smoothly and the infrastructure in place for the site to grow to any limit, but no we cant burn down a bridge that we never cross again.

Just imagine facebook was hosting on 1 server in JHB, never would of made it past the first 10k.
 
There are a couple of things to think of:

1. Your client's estimate of how many million visitors they're expecting is almost always overly optimistic. I hear these claims every day, and can count the number of times they amounted to anything remotely resembling the expected traffic, on one hand.

2. Your pipe is too thin. 30Mb/s? You're being screwed. Unless you're talking about a VPS solution that has artificial limits imposed, or you're on ancient hardware (like Pix 501 firewall which is a 60Mb/s device but doesn't even cope with that in production), there's no excuse for having less than 100Mb/s Find another hosting company.

3. Your biggest performance gains is almost always in the way your application works, and how efficiently it uses various forms/levels of caching, and ultimately, how often your server hits its discs. For instance, if you're running a PHP app, you absolutely have to have an opcode cache - APC, xcache, eAccelerator - doesn't matter. You absolutely have to put temporary data - session data, for example - in memcached. You absolutely have to set long expiry times on your static content - images, css, js, etc). You absolutely have to enable compression on text content (html output, js, css, etc). On any machine built in the last 10 years, the CPU penalty for in-line compression is far outweighed by the efficiency improvements.

4. You need to offload static content (you're talking video - forget about it on a single box) to an external provider - Amazon S3 or Rackspace Cloud Files - and enable CDN so that your static content doesn't involve your server at all. This usually requires coding your application in such a way that it farms out static content via these providers' APIs rather than storing it locally. A bit of work but it also makes it much easier to deploy extra web servers when you need to.

5. Stay away from NFS. Sticking your content on an NFS share to achieve scalability is not a very good solution, and will come back to bite you. It always does.
 
There are a couple of things to think of:

1. Your client's estimate of how many million visitors they're expecting is almost always overly optimistic. I hear these claims every day, and can count the number of times they amounted to anything remotely resembling the expected traffic, on one hand.

2. Your pipe is too thin. 30Mb/s? You're being screwed. Unless you're talking about a VPS solution that has artificial limits imposed, or you're on ancient hardware (like Pix 501 firewall which is a 60Mb/s device but doesn't even cope with that in production), there's no excuse for having less than 100Mb/s Find another hosting company.

3. Your biggest performance gains is almost always in the way your application works, and how efficiently it uses various forms/levels of caching, and ultimately, how often your server hits its discs. For instance, if you're running a PHP app, you absolutely have to have an opcode cache - APC, xcache, eAccelerator - doesn't matter. You absolutely have to put temporary data - session data, for example - in memcached. You absolutely have to set long expiry times on your static content - images, css, js, etc). You absolutely have to enable compression on text content (html output, js, css, etc). On any machine built in the last 10 years, the CPU penalty for in-line compression is far outweighed by the efficiency improvements.

4. You need to offload static content (you're talking video - forget about it on a single box) to an external provider - Amazon S3 or Rackspace Cloud Files - and enable CDN so that your static content doesn't involve your server at all. This usually requires coding your application in such a way that it farms out static content via these providers' APIs rather than storing it locally. A bit of work but it also makes it much easier to deploy extra web servers when you need to.

5. Stay away from NFS. Sticking your content on an NFS share to achieve scalability is not a very good solution, and will come back to bite you. It always does.

1. Ya that I know, they expected 10's of thousands of users by now, they still at the thousand level, the 1st one. LOL

2. I do not know for a fact what it is, tested with a large file download via ssh to get an idea, after many months they have finally given in and signed up with the new hosting today, we not have access to multiple t1 lines. Oh and its a dedicated server, 2x500gb in raid, 8gb ram and 2 quad cores. Beyond that I do not know.

3. Been trying to research the cacheingfor months and its surprisingly hard to get a proper answer, that or I been googling horribly wrong. Contents cache handler is file and sessions are handled in the DTB. Still trying to get the expires headers working, tried pluggins and htaccess overrides with no joy, checking it in yslow.

4. So far all the video content is outsourced, youtube, vimeo, etc. Once this things working properly they will be upload original HD content and I have already insisted on amazon Cloudfront.

5. No idea what NFS is, unless you mean the game series. lol


Included the bellow in the hcaccess file, supposed to override expires headers and I have confirmed the required modules are enabled. Yes yslow still complains about the expired headers

<IfModule mod_headers.c>
Header unset ETag
Header unset Last-Modified
</IfModule>

# turn on the module for this directory
ExpiresActive on
# set default
ExpiresDefault "access plus 24 hours"
ExpiresByType image/jpg "access plus 1 months"
ExpiresByType image/gif "access plus 1 months"
ExpiresByType image/jpeg "access plus 1 months"
ExpiresByType image/png "access plus 1 months"
ExpiresByType text/css "access plus 1 months"
ExpiresByType text/javascript "access plus 1 months"
ExpiresByType application/javascript "access plus 1 months"
ExpiresByType application/x-shockwave-flash "access plus 1 months"
 
3. Been trying to research the cacheingfor months and its surprisingly hard to get a proper answer, that or I been googling horribly wrong. Contents cache handler is file and sessions are handled in the DTB. Still trying to get the expires headers working, tried pluggins and htaccess overrides with no joy, checking it in yslow.

That's because "how to do caching" depends heavily on what you are doing to start with. And the bigger your system gets, the more important it becomes that your network, your hardware, your management, your backup strategy, etc, are all design considerations, and your application be coded around that.

5. No idea what NFS is, unless you mean the game series. lol

http://linux.die.net/man/5/nfs

It was meant to support multi-user environments where there would be a file server, and all unix workstations would mount their home directories locally. It works brilliantly for that, but wasn't (IMHO) really designed for high contention, single user usage. It works all right 99% of the time but that 1% sees all sorts of issues and it's usually under load that they crop up.


Regarding expires, this is what I use:

Code:
<IfModule mod_expires.c>
   ExpiresActive On
   ExpiresDefault A300
   ExpiresByType image/x-icon A86400
   ExpiresByType application/x-javascript A86400
   ExpiresByType text/css A86400
   ExpiresByType image/gif A86400
   ExpiresByType image/png A86400
   ExpiresByType image/jpeg A86400
   ExpiresByType text/plain A86400
   ExpiresByType application/x-shockwave-flash A86400
   ExpiresByType video/x-flv A86400
   ExpiresByType application/pdf A86400
   ExpiresByType text/html A300
</IfModule>

I would be careful of setting expires too long - it causes problem when you want to update things (same idea as DNS TTLs).

For gzip compression:

Code:
<IfModule mod_deflate.c>
   AddOutputFilterByType DEFLATE text/plain
   AddOutputFilterByType DEFLATE text/xml
   AddOutputFilterByType DEFLATE application/xhtml+xml
   AddOutputFilterByType DEFLATE text/css
   AddOutputFilterByType DEFLATE application/xml
   AddOutputFilterByType DEFLATE image/svg+xml
   AddOutputFilterByType DEFLATE application/rss+xml
   AddOutputFilterByType DEFLATE application/atom_xml
   AddOutputFilterByType DEFLATE application/javascript
   AddOutputFilterByType DEFLATE application/x-javascript
   AddOutputFilterByType DEFLATE application/x-httpd-php
   AddOutputFilterByType DEFLATE application/x-httpd-fastphp
   AddOutputFilterByType DEFLATE application/x-httpd-eruby
   AddOutputFilterByType DEFLATE text/html

   # properly handle requests coming from behind proxies
   <IfModule mod_headers.c>
      Header append Vary User-Agent
   </IfModule>

   # Properly handle old browsers that do not support compression
   <IfModule mod_deflate.c>
      BrowserMatch ^Mozilla/4 gzip-only-text/html
      BrowserMatch ^Mozilla/4\.0[678] no-gzip
      BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
   </IfModule>
</IfModule>

Take note, PHP already has calls for compressing, so make sure you don't try to do the same thing twice. Mediawiki, for example, has this enabled by default in PHP. If you want to do it at a server level, turn it of the mediawiki conf.

The above is, of course, for Apache - it may look different for other webservers.

One last tip, if you have a busy site, get rid of .htaccess files. Put the directives in the VirtualHost section rather. You want it in memory when the server starts, rather than hitting disc for each request.
 
Just though I would get back to you guys after the move, turns out my expires block was correct all along, the server was either ignoring it or had one or more modules incorrectly configured.

Completed the move for the site today and suddenly noticed that the expires headers are working, configured them a bit more logically and now the primed cached size thanks to client side caching has dropped a 1.5mb to 250k server side cache and even further to 24k with client side cache.

Anyone looking for a good host I am officially endorsing TMD Hosting, service is as top notch after sale as it was before, their support guys are extremely quick to reply and so far they seem to know what they were doing. Asked for a php upgrade from 5.2.7 to 5.3.1 and completely missed the outdated apache and instead of just upgrading like previous companies I have dealt with they first came back to ask if they should upgrade the apache as well.

Tomorrow when back at work I can test and see if the session cookies are working, still need to wait for complete propagation, had to switch over to googles dns as mweb's a tad delayed.
 
Asked for a php upgrade from 5.2.7 to 5.3.1 and completely missed the outdated apache and instead of just upgrading like previous companies I have dealt with they first came back to ask if they should upgrade the apache as well.

Just curious: what distro are you hosting on? At a quick glance, their website doesn't specify. PHP 5.3.1 is not up to date and has a few unpatched security issues. Few distros make it trivial to upgrade Apache, and unless the version on it was ancient, there's seldom any reason to upgrade it.
 
Just curious: what distro are you hosting on? At a quick glance, their website doesn't specify. PHP 5.3.1 is not up to date and has a few unpatched security issues. Few distros make it trivial to upgrade Apache, and unless the version on it was ancient, there's seldom any reason to upgrade it.

No idea, never looked, and ancient it was, 1.3. Needed the upgrade for some of he cms's components, although been waiting so long to be able to upgrade that I cannot remember why I needed it.

Was a VPS setup, I assume apache 1.3 is part of thier bootstrap install, pretty php5.3 is a lil iffy with apache 1.x.

Main component had some reduntant php4 code which does bot work in 5.3 so we had to dowgrade the old server which broke a few minor components, but owing to a terribly comfigured server by an unsuitable host we were unable to upgrade the component which would then allow us to safely upgrade the php. Now I have to remember the important reason for the upgrade.
 
Now I'm even more curious to know! Geez, Apache 2 was released in 2001! What decade is it?

Probably could fine out, its now runing 2.2 i think.

Funny thung is the company started in 2005, so thier bootstraps running apache thats older than them.
 
Funny thung is the company started in 2005, so thier bootstraps running apache thats older than them.

Naah, not necessarily. Apache 1.3 has had maintenance releases for years after that. But seriously, we're kinda running out of IPv4 addresses. Shipping anything less than 2.2.16 (which supports SNI) these days is just irresponsible.
 
Top
Sign up to the MyBroadband newsletter
X