I am involved in the worldwide launch of a social networking site. For how many server capacity we must plan ? what are the average ratios per thousand registered users ? what are the assumptions used ? Note : the site is based on MVC PHP/MySQL with the Yii Framework.

EDIT : I am looking for real life examples/industry standards of social networking sites with tens/hunderds of thousands of registered users. Assuming the code is "well" written, MySQL is denormalized and SQL queries are kept to a minimal.

  • 8
    I think it belongs on socialnetworkingfault.
    – mario
    Sep 6, 2010 at 10:28
  • 1
    Besides the fact that SO is not the place to ask this question, you supply way too little information. Give some more information on your architecture, functionalities, planned promotion etc.
    – Dennis Haarbrink
    Sep 6, 2010 at 10:30
  • The reason i think this must be closed because it's totally unanswerable. He even didn't say anything about their current plannings/resources except they're using PHP/MySQL. This can be anything.
    – fabrik
    Sep 6, 2010 at 10:30
  • Question isn't about coding issues, but about requirements for network infrastructure. Vote for move to serverfault
    – Mark Baker
    Sep 6, 2010 at 11:10
  • 3
    +1 vote for closing. I would not even know where to start - NO sensible information provided.
    – TomTom
    Sep 6, 2010 at 11:28

3 Answers 3


Write the code so that content doesn't rely on files on the disk except for the website itself and the databases.
Write it so that as much as possible is static and can be determined by the URL.
Write it so that the database it reads to and writes from it not hardcoded (returned by a function) and is not necessarily the same database.
Write it so that it uses MySQL's autoincrement keys rather than code generated ones.
Think about all of this before you write it.

If you do all the above, run it on one server. Then, if it gets heavy, you can move the database onto another server. Still heavy? Replicate the database onto another server. Then add a loadbalancer for your webservers. See how you can scale afterwards if you wrote the code well?

Roughly, the amount of servers you need will depend on how good a coder you are and how much of the site can be cached. If it really is big, you'll probably end up with: User->Internet->Firewall (with failover)->Varnish server->Load Balancer (maybe Squid) with failover->Servers with duplicate content talking to replicated databases.

  • If you can cache most of the site in Varnish, you're unlikely to need more than 3 or 4 servers at the bottom unless you're seriously huge or seriously terrible at writing queries.
    – James L
    Sep 6, 2010 at 11:32

Generic answer:

  • Worldwide launch sounds like hyperbole. One server will suffice.
  • Do some server stress testing (ab/jmeter) to see how many request/sec your site handles.
  • Requests/sec * 24 * 60 * 60 sec / 250 (?) = Number of Users
  • xdebug and kcachegrind
  • denormalize database
  • Thanks mario, but how did you come up with 250 ?
    – jaz
    Sep 6, 2010 at 13:11

Depends how much resilience you need... what level of downtime is acceptable? At a minimum, I'd recommend at least two web servers and two database servers using MySQL replication to provide failover... though they could be the same two physical machines. If you're using memcache, another server for that.

Assess your infrastructure for any single point of failure and assess the risks or eliminate it as a SPOF.

Then (as mario has said) stress test it to see what response times you get at different levels of requests/sec. Test with both read-only and with read/write requests.

Monitor both webservers and database servers.

  • How many simultaneous users do you think this setup can handle ? (I know it can be rough, but are we talking hundreds ? thousands ? more ?
    – jaz
    Sep 6, 2010 at 13:13
  • I can't tell you that... it's for you to find out by actually testing. I don't know how powerful your servers are, what memory you might have for PHP, the bandwidth of your network pipe, how efficiently your application is written, what data volumes you expect, etc. Only you have the information needed to even run tests, let alone estimate the usage, and identify whether the performance is acceptable or not
    – Mark Baker
    Sep 7, 2010 at 12:54

Not the answer you're looking for? Browse other questions tagged .