Designing a Scalable Website Using Php

I am going to create a social + professional network site using Php (Zend or Yii framework). We target over 5,000 requests per minute. I have experience developing advanced websites using MVC frameworks.

But, this is the first time I'm going to develop something that will mean scalability. Therefore, I will be very grateful if someone can tell me about the technologies I should look for.

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

Thanks!

+4
source share
3 answers

You might want to architect your site to use at least the master / slave replication system. You do not have to configure mysql mailbox replication to start, but you want to create a project for your application so that the database reads a different connection than the records (even if at the beginning both connections were connected to the same db server).

You also need to think very carefully about what your caching strategy will be. I would look at memcache, although with Zend_Cache you could use the cache file at an early stage and change it in memcache if / when you need it. In addition to caching records, you also want to think about partial page-level caching and what strategies you plan / implement there.

You will also want to carefully plan how you will handle storing and retrieving custom media. You will want to easily transfer this material from the main server to a dedicated mailbox in order to serve static content or some kind of CDN (content distribution network).

Also, think about how you are going to handle session management, and make sure that you are not doing anything that will prevent you from using non-file session memory ((dedicated) database or memcache) in the future.

If you think carefully and abstractly save / retrieve data, you will move in a good direction.

+3
source

Memcached is a distributed caching system, while APC is not distributed and is basically a cache of operation code.

If (and only if) your site needs to live on different web servers (loadbalancing), you need to use memcache for distributed caching. If not, just stick with APC and its cache.


In a MySQL database, I would recommend gridhosting, which can be auto-scaled as required.

+2
source

Depending on the requirements of your site, most likely the database will be your bottleneck. MVC frameworks typically sacrifice performance for easy coding, especially in the case of ORM. Do not rely on ORM; instead, check out the various ways to query the database and see which ones work. You want to minimize the number of queries to the database, immediately retrieve a piece of data, and not perform several small queries.

If you find that your php code is the neck of a bottle (profile before optimization), you can find a useful hiphop.

+1
source

All Articles