memory issues
Im running 3 or 4 sites. 3 of them get no traffic. 1 of them gets about 15k hits a day
im using ubuntu 8.04 LTS with apache using my own software for my high traffic site.
9 Replies
1. How many sites you're running
2. How many hits they each get
3. Which OS (e.g., Ubuntu, CentOS) you intend to use
3. What web server (e.g., Apache, nginx, lighttpd) you intend to use
4. What web software (e.g., Wordpress, Drupal) you are using
The good news is you can sign up and try it out with no long-term commitment - if you cancel after two weeks, that's all you pay for.
Then in the unlikely event that you run out of RAM (in which case you should be getting enough traffic to monetize your sites and at least cover the cost of an upgrade if you are so inclined), you can fire off a support ticket and the staff will upgrade your linode for you in a heartbeat
The same box later was tasked with serving up ~200MB files to dozens or hundreds of people at the same time. Apache keeled over and brought the box down (used up all RAM leaving none for disk cache), but Lighttpd handled it without breaking a sweat (used very little RAM leaving plenty for disk cache).
I do suggest trying out Lighttpd instead of Apache, it will save on RAM usage. Also, make sure you select the right MySQL config file for your available memory (it ships with a bunch of pre-configured ones for various memory sizes). Also make sure your Linode has enough swap space (1:1 with RAM minimum, 512MB is probably a good safe value).
As said, you can always upgrade your Linode if the need should arise, but you can do a lot with 360MB if you set things up properly.
What do you use your Linode for?
I can't recall the exact number, but I'm pretty sure I saw someone posting they were running Lighttpd, MySQL, Wordpress with Super Cache and serving up several 100K page views per day in addition to using the box for a few other things, all on a Linode 360.
Other approaches include setting very busy parts of your site as static content. Eg front page. The front page could then be updated by a back-end script set to auto-update using a cron job to keep content fresh.
You can also reduce CPU time by employing a PHP accelerator and bytecode cache. They are very effective when your site is PHP-heavy. Other approaches (which are not always convenient) are to use a faster programming language. Execution time approximately C
Keep number of files per folder low, (<2000) or remember to set your file system to use directory hashes.
Use a fast journalling option. Consider using writeback on your file system.
Disable atime in your mount options (unless you specifically need it).
@Guspaz:
Also make sure your Linode has enough swap space (1:1 with RAM minimum, 512MB is probably a good safe value).
Not a good idea. 256MB is plenty, and even then, you probably don't want to see swap usage go anywhere near half of that.
15K hits a day is definitely doable, in fact a Linode 360 should be able to handle 10 times that. Just remember to pick the right MySQL config file, and cut down Apache's MaxClients figure to something VPS-friendly, for example 10.
@hybinet:
@Guspaz:Also make sure your Linode has enough swap space (1:1 with RAM minimum, 512MB is probably a good safe value).
Not a good idea. 256MB is plenty, and even then, you probably don't want to see swap usage go anywhere near half of that.
15K hits a day is definitely doable, in fact a Linode 360 should be able to handle 10 times that. Just remember to pick the right MySQL config file, and cut down Apache's MaxClients figure to something VPS-friendly, for example 10.
Linux will swap infrequently used stuff out of RAM (configurable by the "swappiness" variable). That frees up RAM for active stuff and cache, improving performance by giving it to things that can actually use it.
The more RAM you have (and are using), the more inactive stuff that can be swapped out without performance penalties. If you don't keep your swap at some reasonable ratio (and 1:1 is probably a good idea at least up until 512-1024 or so), you're giving up that benefit.
Swap isn't just to be used when you run out of physical RAM, it also has to do with making more efficient use of physical RAM.
@Guspaz:
Linux will swap infrequently used stuff out of RAM (configurable by the "swappiness" variable). That frees up RAM for active stuff and cache, improving performance by giving it to things that can actually use it.
The more RAM you have (and are using), the more inactive stuff that can be swapped out without performance penalties. If you don't keep your swap at some reasonable ratio (and 1:1 is probably a good idea at least up until 512-1024 or so), you're giving up that benefit.
This is more true on a dedicated system than a VPS since on a VPS the hit to actually move stuff between swap and memory is much higher due to the contention for the disk resource. A 1:1 (or 2:1 for smaller systems) swap rule can make more sense in a dedicated environment.
While it's true that if you actually have a workload such that you truly have a very small percentage of total allocation as a working set, you can have a lot swapped out, in my experience that's an uncommon workload, especially for a server, where most tasks are there to do something, as opposed to a desktop where you may have large GUI applications minimized or something.
In a VPS environment in general, even a small amount of swapping will be causing significant degredation, and I doubt that most Linodes would behave well at all if they had a swap level anywhere near their memory size (although obviously it does depend on workload). I definitely don't think there's any reason to allocate swap space up at 1:1, at least in this environment.
– David
@Guspaz:
If you don't keep your swap at some reasonable ratio (and 1:1 is probably a good idea at least up until 512-1024 or so), you're giving up that benefit.
The other posters are correct. Beyond 128 MB of swap or so, you will be thrashing so hard when you write to it you're going to think your Linode has crashed. This is the exact reason that Slicehost does not permit you to alter your swap size (last I heard, anyway).
There is zero benefit to using more than 128 to 256 MB of swap on the Linode platform, and that's why we've made that remark in the Linode Manager. Trust me.
The 1:1 logic is okay for physical platforms. You can't think of Linode as a physical platform, because it isn't.