20% / 45% CPU load every time I refresh my homepage, is it normal?

October 4, 2016 143 views
Nginx Server Optimization Configuration Management Ubuntu

Hey guys,
My CPU load is very high, resulting in me unable to login via ssh or accessing my website (long loading or time out).
Im running nginx 1.4 and php5-fpm on ubuntu 14, on a 1 core / 1gb droplet.
I'm running 4 Wordpress websites (one of them gets 200 hits per day/others not more then 50 combined) on 1 droplet.
The php5-fpm pool for my main site is causing the extreme CPU load.
The CPU load is definitely not normal right?
Anyone know how I can find the root of the problem? thanks

4 Answers

You need to scale your setup. 4 Wordpress sites it quite a lot for a droplet that size. Try caching your sites to reduce Wordpress rendering the same content. I've linked some good solutions below.

Additionally, upgrade to PHP7 for increased performance and enable OPCache in PHP. You may also want to upgrade to Nginx v1.6 stable. You should also remove any unused plugins (not just disabling, delete them). And to top it off, make sure your database is clean and optimized for you system. If you have a LAMP/LEMP stack, move the database to its own server as 4 Wordpress sites + a database on a single 1GB droplet is a bit too much. I've linked some DigitalOcean tutorials to get you started on some of these.

by Alex Kavon
Nginx is a fast and lightweight alternative to the sometimes overbearing Apache 2. However, Nginx just like any kind of server or software must be tuned to help attain optimal performance. Here's how to optimize Nginx configuration.

use cache look add install html minfty and use cache bro

http {

        add_header rt-Fastcgi-Cache $upstream_cache_status;
        fastcgi_param HTTP_IF_NONE_MATCH $http_if_none_match;
        fastcgi_param HTTP_IF_MODIFIED_SINCE $http_if_modified_since;

        # Basic Settings

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;

        default_type application/octet-stream;
        # Logging Settings

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        # Gzip Settings

        gzip on;
        gzip_disable "msie6";

        server_tokens off;
        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_min_length 256;
        gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/ld+json application/ application/x-font-opentype application/x-font-truetype application/x-font-tt$
        gzip_disable "MSIE [1-6]\.";
        #set client body size to 2M #
        client_max_body_size 20M;
        # nginx-naxsi config
        # Uncomment it if you installed nginx-naxsi
        include /etc/nginx/naxsi_core.rules;

add this in default config

location ~*  \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|pdf|html|htm)$ {
                expires max;


This may solve it.

I installed memcached

i install these packages:

sudo apt-get install memcached php5-memcached

then do

sudo service nginx restart

memcached is already preconfigured

then install a Wordpress plugin:
Or use one from the keyword in plugin list "memcached" in the search

memcached stores the cache in ram. So lower cpu usage for you.

Have another answer? Share your knowledge.