-1

I have a PaaS hosting solution that sets up a wordpress cloud (DigitalOcean) server with wordpress, all managed by the hosting provider. I still have ssh access/ftp etc... I know that mysql runs on the same server as well. Our site usually gets no real traffic (1k hits a day average) but some days we get spikes of 40-50k hits.

Currently this is my free -m stats:

             total       used       free     shared    buffers     cached
Mem:          2012       1911        101          0         57       1495
-/+ buffers/cache:        358       1654
Swap:          953          0        953

The site is running Apache + nginx + varnish + w3total cache.

My question is, is there enough ram to handle the traffic or would the server run out of memory soon?

Regards

1 Answers1

1

Your question is based on a common misunderstanding that running out of RAM is a bad thing. Running out of RAM is a perfectly normal thing that doesn't indicate any problem. RAM cannot be saved for later, so there is no advantage whatsoever to not using it. Modern operating systems try to use as much RAM as they possibly can, and nothing terrible happens if you run out.

Modern operating systems keep as little RAM free as possible, generally just a small reserve to handle allocations from interrupt contexts. Otherwise, they directly transition RAM from one use to another.

David Schwartz
  • 31,215
  • 2
  • 53
  • 82
  • You're right, free memory is wasted memory. But the concern I have with mine is that I hope the stats above are mainly for caching right? I'm guessing 1495 MB is cached, wheres 358 MB is REAL usage I presume? (that is excl. the reserved kernel mem) – user3413046 Jul 24 '15 at 09:27
  • @user3413046 Don't do this. Understand how memory actually works and understand your system in terms of what it's really doing rather than making up unreal terms to force an unrealistic mental model that doesn't apply. The real usage is, and should be, as much as possible. Almost all RAM usage is effectively as a cache. – David Schwartz Jul 24 '15 at 09:29
  • I see, well how do I decide when to vertically scale the server. I understand worrying about memory is counter-productive and decreases performance if memory is always kept free. But how do I make the decision to scale in future ? CPU usage? Swap usage? – user3413046 Jul 24 '15 at 09:31
  • @user3413046 That's not a simple question. Paging is one way to tell. Poor performance is another. Experience with similar systems and understanding their behavior is another way. It takes years of experience to understand how to make those kinds of judgments. Do not believe anyone who tells you there are shortcuts or simple rules of thumb that always work. – David Schwartz Jul 24 '15 at 09:32