There's a lot of information available on establishing Light stacks on one box, or possibly moving MySQL onto it's own box, but growing beyond that does not appear to be really well recorded.
My current web atmosphere is getting capacity issues, and thus I am searching for best-practices regarding configuration tuning, identifying bottlenecks, security, etc.
I presently host around 400 sites, having a fair requirement for redundany and security, and thus I have grown past the single-box solution - but am not at the amount of a complete Web service provider or devoted web-webhost.
Can anybody point me in direction of good quality expertise on establishing an excellent apache web-farm having a view to security and future expansion?
My web atmosphere includes 2 redundant MySQL servers, 2 redundant web-content servers, 2 load balancing front-finish apache servers that mount this content via nfs and share apache config and periods sites together, along with a single "developer's" server that also mounts the net-content via nfs, and consists of all of the developer accounts.
I am pretty pleased with a lot of this setup, however it appears to become choking around the load prematurely.
Works out the "choking around the load" relates to
mod_log_sql, that we use to transmit my apache logs to some mysql database. By re-setting up the webservers to create their sql claims to some disk file, after which developing a separate process to submit individuals towards the database it enables the webservers to release their threads much faster, and handle a significantly greater load.
You have to have the ability to identify bottlenecks and test enhancements.
To recognize bottlenecks, you should utilize your system's confirming tools. Some good examples:
- MySQL includes a slow query log.
- Linux provides stats like load average, iostat, vmstat, netstat, etc.
- Apache has got the access log and also the server-status page.
- Programming languages have profilers, like Pear Benchmark.
Begin using these tools to identifyy the slowest/greatest culprits while focusing in it. Try a noticable difference and measure to ascertain if it really enhances performance.
This becomes an endless loop for 2 reasons: almost always there is something inside a complex system that may be faster so that as the body develops, different functions will begin slowing down lower.
In line with the description of the system, my first hunch could be disk io and network io around the NFS servers, then I'd take a look at MySQL query occasions. I'd also look into the performance from the shared periods.
The schoolbook method of doing it might be to recognize the bottlenecks with real empirical data.
Whenever you discover where the issue is you may encounter the issue that it is insufficient to scale the infrastructure, due to how a code works, and also you finish track of the necessity to either just create more cases of you current setup or result in the code different.
I'd also recommend like a initial step when it comes to scalability, off-load your articles to some CDN like Edgecast. Make use of your current two content servers to supplement web servers.