What is "recommended architecture" for a website based on PHP/Myql/Apache on high traffic website? Planning to have multiple load balanced servers (atleast 3-4 apache), should need couple of DB servers as well. How does the session share happen in case of multiple front end servers? Do Databases replicate in real time? Has anyone implemented any such solution? I could not find anything online yet. Please share if you have done something like this (or come across any such article online). Much Appreciated.
sessions and cookies are based on the web address. so unless you are having people go to your sites by ip address there won't be any problem with using multiple servers for the front end as long as you make the cookie access able from the whole site. As for the database, i'm not sure what you mean by replicate. If you want to use multiple db servers you would have to create the process to do so. I'm not sure what type of site you are wanting to create that you think you will need so much power behind it. A single dedicated server and a lot of bandwidth is good enough for the most robust blogs and forums and even most video sharing sites (no including youtube)
What I have learnt about high traffic sites is only use sessions and cookies when you really have to. For example an article site would not need to use sessions and cookies for 99% of page views. Only when some one needs to long in to edit an article should you use sessions and cookies. If this is done right, the 1% of the time that people do need to log in can be handled by 1 server. The rest can be handled by a distributed caching system. Do not share sessions between load balanced servers, you are asking for trouble. Instead make sure that the same server handles a users request each time. Do this based on the requesting IP. If you have 3 servers then redirect users according to the following: Server 1 IPs: 1.1.1.1 to 100.100.100.100 Server 2 IPs: 100.100.100.100 to 200.200.200.200 Server 3 IPs: 200.*.*.* to 255.*.*.* E.T.C The best solution is still caching though. If you can not cache an entire page, cache half of it (the output of a function or 2 for example). This will reduce cpu and db load.
See these 2 pages. Some useful tips for server side speed and load reduction, plus faster page load time. http://developer.yahoo.com/performance/rules.html http://csdl2.computer.org/persagen/...0/2152toc.xml&DOI=10.1109/ICPADS.2004.1316141 regards