-1

I have a vps running Ubuntu 12.04 with nginx,php,mysql & APC. I notice the ram increases each time I add a new site to the vps. Is this normal? cause I added 50 sites and it ended up using 1.5GB RAM

Ruriko
  • 105
  • 1
  • 4
  • 10
    Why? What were you expecting? If you want your sites to run on magic instead of RAM, you need to configure them that way, which requires you to be at least a class 7 web wizard. – HopelessN00b Mar 12 '14 at 01:12
  • See Also: http://serverfault.com/questions/449296/why-is-linux-reporting-free-memory-strangely – voretaq7 Mar 13 '14 at 19:23
  • @HopelessN00b I feel inclined to remind you that the D&D controversaries have shown an implication that magic is evil. I thus suggest that intead of a wizard you hire a holy class 9 web cleric. AND bath the server in holy water ;) – TomTom Mar 13 '14 at 19:50

2 Answers2

1

The server uses as much RAM as it possibly can to provide as much performance as possible. You can't save RAM for later, so your choices are to use it or waste it. Using it is better.

David Schwartz
  • 31,215
  • 2
  • 53
  • 82
1

There's overhead to anything extra you run on your machine. Each site adds some configuration to nginx which is stored in RAM, extra mysql tables (I assume, since you mention it) add configuration, indexes, etc in RAM. Extra sites might mean spawning more php processes, which come with memory overhead. Finally, more PHP means more stuff in the APC cache, which will sit in RAM.

You may also be seeing disk caching, which Linux will do with unused RAM to speed things up. The canonical reference for this is Linux ate my ram!, which describes that behavior.

Bill Weiss
  • 10,782
  • 3
  • 37
  • 65