Its a common meditation – think of us that hardware upgrade is the best way to speed up a server. Its like more memory, or cpu cant deliver vetter performance.
Hardware upgrades are only a temporary fix. if services / application are not optimized.
Online applications are hosted/running on a web server front-end & db servers in the back-end. Over time these services tend to cause cpu, memory and I/O bottlenecks. that lead the decrease performance or even crashes server.
Steps to speed up server
- Lean & mean website
- Unused theme, plugin & add-ons
- Combine css, java script files
- Image optimization
- compression enable
- Web server optimization
- Timeout -how long apache will wait for a visitortosend a request. Best to keep this value as low as possible to prevernt resource. In busy server, it sets up to 120 Sec
- KeepAlive – is set to ON, Apache uses a single connection to transfer all files to load a page. This saves time in establishing a new connection to each file.
- MaxKeepALiveRequests – this means that how many files can be transfered via a KeepAlive connection. This setting can be set to “0” that is “Unlimited”.
- KeepAliveTimeout – In a heavily loaded server it should keep at 10 sec
- MaxClients – In busy server, it should keep at 512
- MinSpareServers & MaxSpareServers – In a heavily loaded server. MaxSpareServers value of 10 & MaxSpareServers value of 15 to be a good limit/
- HostnameLookups – Apache try to to find out the hostname of every ip thst connects to it, This is wastage of resources. To prevent this it set to “O”.
- HTTP/2 – Majority of wbistes use HTTP v1.1. This is old version released in 1997 that forces browsers to download files for a page sequentially one after another. HTTP/2 was released in 2015, provides many speed boosting features such as multi-file transfer per connection. compressed headers. etc. As with everything nice, adopting HTTP/2 comes with a couple of caveats:
- Converts the site to HTTPS
- Monitoring of vulnerabilities- It is still news. while the protocol itselfs is stong, there could be exists vulnerability in server code. So it is important to keep a close eye on security news & patched it regularly.
- Caching – Uses of PHP OpCode caches and HTML caches. APC Opcode cache & varnish HTML cache bump the performance of over 70%
- Fast PHP Engine – Moderns are php-fpm, hhvm & php 7 that are really speed up scripts.
- Database Optimization – DBs grows in size over a period to time, and the queries execution increases as site traffic increases. so that db tuning in continues result in performance issues
- max_connections – In dedicated server it can be 250 but in heavily loaded shared server it can be as low as 10.
- innodb_buffer_pool_size – Set this value between 50-70% of available of RAM for MySQL
- query_cache_size – this is enabled for a single website server. it is set to 1-MB or less depending of how slow the queries are at present.