In this guide you can learn how you can increase performance and security of your website follow this simple tasks to get more out of your server.
First we always recommend to go with CWP pro as its comes with many premium features like php-fpm which can drastically increase your website's performance and security.
PHP :
In php-fpm we've varieties of cache extension added like :
- Opcache
- APCu
- Redis Object Cache
- Memcached Object cache
this extensions can boost your website even by 30%-70%
we'll learn more about it in below Points :
Opcache :
OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request. i.e. in simple language it can be explained that opcache will help to lower the cpu load by caching some of the already executed php code which drastically lower the cpu load and increase website performance. This is by default enabled with CWP PHP-FPM
APCu :
This is something like php opcache but with more aggressive caching which will help your website to cope with high traffic situations, since it is recommended to use with caution and with supported plugins/modules.
Redis Object cache :
Redis is a persistent object cache backend cache server, this will mainly boost the DB and other website related calls and queries by cache them in to RAM memory (RAM is the fastest memory till date even faster than NVMe and UFS), so take the advantage of redis cache.
to use redis you need to check your website CMS is supporting it or not some CMS have inbuilt support and some needs external plugin to get it enabled like for WORDPRESS you need to use some "Redis Object Cache" or "W3 Total Cache" plugin to get it enabled.
when this is equipped with php inbuilt OPCACHE you can see significant performance improvement.
Memcached Object Cache :
This is also in memory (RAM) object cache but only focused on alleviating database load and good for dynamic websites i.e. it only caches the DB related queries and we didn't recommend to use this with any other cache like redis or APCu. You can use it with php opcache.
to use memcache please check your Script documentation upon how you can do it, For wordpress you can follow this tutorial :
1. Install php memcache (not memcached) from CWP php modules
2. Copy object-cache.php to wp-content - download from here : https://raw.githubusercontent.com/Automattic/wp-memcached/master/object-cache.php
3. Add the `WP_CACHE_KEY_SALT` constant to the `wp-config.php`:
define( 'WP_CACHE_KEY_SALT', '...long random string...' );
This helps prevent cache pollution when multiple WordPress installs are using the same Memcached server. The value must be unique for each WordPress install.
Testing memcache from the command line
watch -td '(echo stats ; echo quit) | nc 127.0.0.1 11211 | grep get*'
You can clean the cache by restarting memcached
service memcached restart
Webserver :
Also you can use nginx + php-fpm as we have some commonly used script template available which will make your site even faster with nginx which is famous for its security and performance benefit. Although nginx can be only used when you're using with your personal website for hosting environment we always recommend Apache as the main webserver you can still use nginx + Apache for performance benefits.
When using nginx + php-fpm the upper cache frameworks will work too universally with apache and nginx
Varnish web cache : Varnish is useful when you've static website, varnish will drastically improve performance from web-server side by caching resources in RAM but it is not idol if you're using dynamic websites/blogs/eCommerce.
You can use Varnish cache with your WordPress blog in CWP as we've created template for WP, you just need to select varnish wordpress template from webserver domain config and you're ready to rock with varnish.