3

I setup a wordpress on Digital Ocean for the smallest droplet for a few months.

Recently, my blog gone viral (1000+ facebook shares) and the server take 50+ seconds to respond.(Google Analytics show there's around 40 people on my blog at the same time for almost whole day today.)

I ask Digital Ocean support team and they told me my 512 mb RAM is too small.

But I use 'free -m' and see

             total       used       free     shared    buffers     cached
Mem:           490        465         24         64         94        136
-/+ buffers/cache:        234        256
Swap:          999          0        999

So I think I have 256 mb memory available?

I told them and they say 'While it might show 100MB of memory free thats likely only after it has killed some services to save memory.'

But I use 'top' and see

%Cpu(s):  0.3 us,  0.0 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st

I found CPU stay 92~100% id, so I think my CPU is not busy.

So how can I found the bottleneck?

I want to know what's the bottleneck before I pay more for upgrading.

  • The OS should reduce the unused cache/buffer size when needed. But the 50 second load time may also indicate a bottleneck outside your server? What kind of content are you serving with your blog? Do the readers also add any data? Maybe you can reduce the size of some pictures? – DutchUncle Feb 7 '15 at 14:12
  • Are you using caching in Wordpress? Have you ran MySQLTuner to see if your database is running optimal? – Bert Feb 7 '15 at 17:47
4

When looking into performance issues it's important to remember the 'big 4':
-CPU
-Memory
-Disk
-Network

I'm a big fan of using atop for CPU and Memory utilization, iotop for Disk usage, and iftop for network traffic. Keep in mind, these metrics are only useful in real time when the server is under load and experiencing this issue.

Any of the big 4 above can cause substantial delay in processing when a page is requested. You mentioned this site is a blog, but did not mention whether the content is dynamically generated, which would add another layer to this equation - the Database. Long query response times can cause a trickle down effect that results in a long page load.

3

Only way you can test it for sure is to run a benchmark like "ab" and test the number or visitors your site can sustain - and troubleshoot what's going on on the server in the meantime. Run something like:

$ ab -n 10000 -c 50 http://yoursite.com/

from your pc or other server.

This will hit your server with 10'000 requests, but not more then 50 concurrent. Before starting the test, run htop on your webserver and watch the activity as new processes spawn up and as the memory and CPU loads change.

Since you didn't explain your web server setup (do you use apache/mod_php or nginx/php-fpm or some other combo) - we can't even remotely guess memory consumption per user.

My impression is that as the number of users grows, your server start swapping and using that additional 1GB of virtual memory thats actually on hard disk. Excessive swapping means users are waiting to be served by processes whose memory is on disk, which can explain those slowness you are observing. But without additional information we can't help much.

  • Good point: was the swap partition in use at any point? – DutchUncle Feb 7 '15 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.