views:

145

answers:

3

I am going to develop a social + professional networking website using Php (Zend or Yii framework). We are targeting over 5000 requests per minute. I have experience in developing advanced websites, using MVC frameworks.

But, this is the first time, I am going to develop something keeping scalability in mind. So, I will really appreciate, if someone can tell me about the technologies, I should be looking for.

I have read about memcache and APC. Which one should I look for? Also, should I use a single Mysql server or a master/slave combination (if its later, then why and how?)

Thanks !

+2  A: 

Memcached is a distributed caching system, whereas APC is non-distributed and mainly an opcode cache.

If (and only if) your website has to live on different webservers (loadbalancing), you have to use memcache for distributed caching. If not, just stick to APC and its cache.


About MySQL database, I would advise a gridhosting which can autoscale according to requirements.

shamittomar
+2  A: 

You'll probably want to architect your site to use, at minimum, a master/slave replication system. You don't necessarily need to set up replicating mysql boxes to begin with, but you want design your application so that database reads use a different connection than writes (even if in the beginning both connections connect to the same db server).

You'll also want to think very carefully about what your caching strategy is going to be. I'd be looking at memcache, though with Zend_Cache you could use a file-based cache early on, and swap in memcache if/when you need it. In addition to record caching, you also want to think about (partial) page-level caching, and what kind of strategies you want to plan/implement there.

You'll also want to plan carefully how you'll handle the storage and retrieval of user-generated media. You'll want to be able to easily move that stuff off the main server onto a dedicated box to serve static content, or some kind of CDN (content distribution network).

Also, think about how you're going to handle session management, and make sure you don't do anything that will prevent you from using a non-file-based session storage ((dedicated) database, or memcache) in the future.

If you think carefully, and abstract data storage/retrieval, you'll be heading in a good direction.

timdev
+1  A: 

Depending on the requirements of your site it's more likely the database will be your bottle neck. MVC frameworks tend to sacrifice performance for easy of coding, especially in the case of ORM. Don't rely on the ORM, instead benchmark different ways of querying the database and see which suits. You want to minimise the number of database queries, fetch a chunk of data at once instead of doing multiple small queries.

If you find that your php code is a bottle neck(profile it before optimizing) you might find facebook's hiphop useful.

Jessta
`it's more likely the database will be your bottle neck` - QFT. I did some profiling of a site I worked on a while ago, and 95-99% of the execution time was always database queries. php comes with a profiler called <a href="http://www.xdebug.org/docs/profiler">Xdebug</a>, which is very helpful for this sort of thing.
Brendan Long