My Vps server is too Fragile

August 19, 2014 1.6k views

I am using digitalocean $5 plan.

1 cpu , 512mb ram , mysql + apache , nginx + centos 6.5 + cpanel installed. 2 wordpress site on that.

But if I reload page of one of my sites, cpu usage increasing to 50% , 60% .If I check mysite from woorank (SEO analyzer), my server is crashing, cpu and ram usage increased to 100%. These sites not so big. I can say new. What can I do about it? In shared hosting, I am getting much more performance.

Htop away : http://

Htop when I refresh one of my wordpress sites anypage:

I and sing wp-super cache and cloudflare.Not so many plugin installed just necessary ones.

Here is my.cnf (Converted all tables to MyIsam)

         port            = 3306
         socket          = /var/lib/mysql/mysql.sock
         max_connections = 50
         key_buffer_size = 16M
         max_allowed_packet = 1M
         table_open_cache = 1000
         sort_buffer_size = 64K
         read_buffer_size = 256K
         read_rnd_buffer_size = 256K
         net_buffer_length = 2K
         thread_cache_size = 128
         query_cache_type = 1
         query_cache_size = 16M
         query_cache_limit = 1M
         log-slow-queries= /var/lib/mysql/slow.log
         log-error = /var/lib/mysql/error.log
         expire_logs_days   = 10
         max_binlog_size         = 100M

         # For low memory, InnoDB should not be used so keep skip-innodb uncommented unless required

         # Uncomment the following if you are using InnoDB tables
         #innodb_data_home_dir = /var/lib/mysql/
         #innodb_data_file_path = ibdata1:10M:autoextend
         #innodb_log_group_home_dir = /var/lib/mysql/
         #innodb_log_arch_dir = /var/lib/mysql/
         # You can set .._buffer_pool_size up to 50 - 80 %
         # of RAM but beware of setting memory usage too high
         #innodb_buffer_pool_size = 16M
         #innodb_additional_mem_pool_size = 2M
         # Set .._log_file_size to 25 % of buffer pool size
         #innodb_log_file_size = 5M
         #innodb_log_buffer_size = 8M
         #innodb_flush_log_at_trx_commit = 1
         #innodb_lock_wait_timeout = 50

         max_allowed_packet = 16M

         # Remove the next comment character if you are not familiar with SQL

         key_buffer = 8M
         sort_buffer_size = 8M

         key_buffer = 8M
         sort_buffer_size = 8M


Here is my apache config :

Start Servers : 1
    Min. Spare Servers: 5
    Max. Spare Servers: 10
    Server limit : 256
    Max clients : 15
    Max request per child :10000
    Keep-alive : ON
    Keep-alive timeout: 15
    Max keep alive request: 100
    Timeout: 300
2 Answers

Are you using Nginx as a reverse proxy?


While this is an older post, I wanted to chime in for future reference and, if the OP is around, to lend a hand.

A Droplet with 512MB is not suitable for cPanel, especially when combined with Apache, PHP and MySQL. IIRC, cPanel alone would require 256MB-512MB of RAM to simply function beyond the initial installation, which would leave next to nothing for the combination of Apache, PHP and MySQL (and this only accounts for those services, if we add Exim, SpamAssassin and Dovecot on top, you're sure to see OOM errors, crashes or halts often).

To be fully function with 512MB, you'd honestly need to go without a control panel and manage your websites from the CLI while fine-tuning and tweaking the configuration for each piece of software via a process of trial and error. This would mean hosting e-mail elsewhere ( Zoho, Google Apps etc) as running a mail server and all that is required on top of a full-stack is going to be too much.

Running a database driven website (WordPress) is possible on a 512MB Droplet, though cPanel is definitely not going to help you do it -- it's the burden in the stack on your Droplet (primarily due to multiple services being ran by default). You could, of course, login to WHM and disable services, though when it gets to this point, you begin to lose need for a control panel as it no longer helps you to manage as intended.


That said, the cause for the spike in CPU is because your RAM is exhausted. Once you've physically used your allocated RAM, the next option is to query SWAP (disk) if you have a SWAP partition setup. If you do, the increased disk activity is going to shoot the CPU load up until either your services crash or the server (in general) becomes unresponsive.

The CPU will also spike if your configured options for any service is setup to request more RAM than is physically available.

CSF/LFD can also utilize quite a bit of RAM, as shown in your HTOP output. Having a Firewall is, of course, wise, though again, it's adding to an already full-stack that's having trouble keeping up.

Have another answer? Share your knowledge.