Linux – the right Servers architecture for a large facebook application

linuxMySQLPHPweb-server

We are a group of 3 students, we created a facebook application with more than 753,320 active users right now, application hosted on LAMP 1&1 server :

- AMD Opteron 1352 4 x 2,1 GHz
- 4 GB RAM.
- 2 x 750 Go (RAID 1 Hardware).
- Connection : 100 Mbps.

This application work very well, without any problem.

We are preparing a new application, and we expect millions of active users after few months.

Application information :

  • Created with PHP / MySQL.
  • Each user can run a minimum of 25 queries per usage.
  • Serve many static files (images, flash files, css, js).
  • This application contain 8 sections, for example games, gifts etc…

We want to know the right architecture for this application server.

  • How many servers we need to host it ?
  • If we host php files on this server :

    • Intel® Core™ i7-920 Processor 4×2.66 GHz
    • 12GB RAM

MySQL remote Server, and Static files on each Server with the same configuration.

Can the application handle millions of requests daily ?

  • What is your suggestion for this kind of applications ?, can anyone tell me details of the suggested architecture ?

Thanks in advance.

Best Answer

Regarding MySQL,

  1. mysqltuner is a must for any prod box.
  2. Slow Query Log will get you a long way down the road to a more performant app.
  3. Turning on the General log (BRIEFLY) can be a good thing, then go run EXPLAIN on all your queries to make sure you have proper indexing (no coverage, good cardinality, etc.)
  4. Are you keeping session in the database? Don't do it if you can avoid it, but if not, consider a MEMORY table.
  5. While on the subject of table types, consider the actual usage of each table. Transactional tables with high read/write needs might be better in the InnoDB storage engine. Tables that are predominately write or read might best be served as MyISAM. Are you logging to the database too? Consider the ARCHIVE engine for those tables.