How to optimize server for wordpress website, server optimization? When google how to optimize server for wordpress, wordpress will explain that it is server optimization. However, if you are using shared hosting there will be no effect. So if you feel your wordpress site still slow after installing optimize images plugin, cache plugin and uses cloudflare, you ought to view this post about wordpress server optimization. Shall we start?
Basically, you need do something on your web server. Things you need to consider are nginx, php-fpm, php accelerator, redis and mariadb. What so great about them? They can speed up your php and database call time, caches your page and database for perfomance. Making your server read and write faster. You can accomplished this will CentOS 7. If you ask how about control panel? Hmm… it does not matter you are using CPanel, Plesk, Directadmin or VestaCP.
With above 5 server optimization tips for WordPress performance tuning. I will provide more details why in this post. How to install them, i will try to cover it next post soon.
Why not Apache? Another option is using Nginx as reverse proxy on top of apache as curent Plesk 17 Onyx does.
NGINX is about 2.5 times faster than Apache based on the results of a benchmark test running up to 1,000 concurrent connections. Another benchmark running with 512 concurrent connections, showed that NGINX is about two times faster and consumed a bit less memory (4%).
Clearly, NGINX serves static content much faster than Apache. If you need to serve a lot of static content at high concurrency levels, NGINX can be a real help.
“Apache is like Microsoft Word. It has a million options but you only need six. NGINX does those six things, and it does five of them 50 times faster than Apache.” — Chris Lea
Fastcgi vs suphp vs php-fpm. FastCGI is a “better CGI” – CGI is known to be slow, Fast CGI is a different approach with much faster results; this has also nothing to do with PHP.
SuPHP was mostly used to address some problems of mod_php related to permissions; with mod_php PHP scripts are run under the Apache user/group; mod_suphp can run the scripts in different user.
PHP-FPM is PHP’s FastCGI implementation. PHP-FPM runs as a standalone FastCGI server and Apache connects to the server using Apache’s module, usually mod_fcgid or mod_fastcgi. Php-fpm is all about removing initialization costs. php-fpm pre-starts several php processes, ready to process requests, and have them sleep until requests come in – which means it can respond much faster than traditional cgi, because php is already running when requests come, as opposed to traditional CGI, where a new php process is started for each request, also php-fpm doesn’t shut down the php process after processing requests, but keep reusing the same processes. – with 0 overhead of starting and stopping processes, php-fpm responds much faster. starting & stopping processes takes time.
3) PHP Accelerator
By looking at the name itself, you had already guess it what it will do. PHP itself had included opcache by default from php 5.6 and above. So, i would prefer using php version 7.x onwards plus enable opcache. Widespread adoption of PHP 7.x will result in increased performance across the board. The result would be faster and higher performing PHP applications powered by all major frameworks.
This is a list of PHP accelerators:
a. Alternative PHP Cache (APC)
c. ionCube PHP Accelerator
d. Turck MMCache
f. Nusphere PhpExpress
g. Zend Opcache (ex. Zend Optimizer+)
h. Zend Platform
i. Windows Cache Extension for PHP
4) Redis Caching
Redis is an in-memory data structure store primarily used as a database and cache. You can get a huge speed benefit from configuring Redis to cache your pages or to cache your database rows. redis vs memcached?
Redis has five primary data structures to choose from, opening up a world of possibilities to the application developer through intelligent caching and manipulation of cached data. Because of its data structures ( Stores data in a variety of formats: list, array, sets and sorted sets ) Redis as a cache gives you a lot of power and greater efficiency overall. Caches employ a mechanism called data eviction to make room for new data by deleting old data from memory. Memcached’s data eviction mechanism employs a Least Recently Used algorithm and somewhat arbitrarily evicts data that’s similar in size to the new data.
Redis allows for fine-grained control over eviction, letting you choose from six different eviction policies. Redis supports both lazy and active eviction, where data is evicted only when more space is needed or proactively. Memcached, on the other hand, provides lazy eviction only.
Mariadb vs Mysql. MariaDB claims it has a much improved query optimizer and many other performance related improvements. Certain benchmarks show that MariaDB is radically faster than MySQL. Benchmarks don’t however always directly translate to real life situations. For example when we at Seravo migrated from MySQL to MariaDB, we saw moderate 3-5 % performance improvements in our real-life scenarios. Still, when it all adds up, 5% is relevant in particular for web server backends, where every millisecond counts. Faster is always better, even if it is just a bit faster.
Studies show that, the average human attention span has dropped from 12 seconds to 7 seconds.
What does this mean for you as a website owner?
You have very little time to show users your content and convince them to stay on your website.
A slow website means users will potentially leave your website before it even loads.
On top of that, Google and other search engines have already started penalizing slower websites by pushing them down in the search results which means lower traffic for slow websites.
To sum it all up, if you want more traffic, subscribers, and revenue from your website, then you must make your WordPress website FAST!