How to tell when to upgrade a Linode?

I have several servers, all web servers. Some host a lot of sites, some only one or two.

The RAM and swap etc. varies between them all, some of them the RAM and swap is full. Or high Ram, low swap I have tried researching online how best to determine when more RAM is needed, but I find it quite confusing to be honest. Many sites say RAM is good to be full, look at the swap, or other things. Someone other sites say swap is OK to be full, its just cached memory.

I often run top and look at monitoring systems like Longview and CopperEgg, but I just don't really understand what to look for to determine when its time to upgrade the Linode.

Is there any simple way to determine if a Linode needs upgrading from say 1Gb Linode to 2Gb? I know things can be tweaked first to reduce RAM etc. something else I need to look into, but there'll come a time when no more tweaking can do it and its time to upgrade, but when is that!?

Thanks

8 Replies

Well, it may be handy to know what web-server and database systems you run on there first :)

The thing I learned when one of the sites hosted on my Linode got the so-called "slash-dot effect", as in a fast and massive influx of visitors due to a higher media channel advertising the website, is to plan ahead much more, I was using apache at the time, and it basically proceeded to eat up all memory and crash the entire linode straight off.

Since then I got myself a dedicated server from the people at Hetzner, massive 32GB/RAM beast compared to the 2GB I had over here, to be honest the pricing is very good with them as well, but must keep in mind that its dedicated, so you dont get all the fancy features you have with Linode :)

Is any of the machines using swap?````
free -m

If yes then you should look at what is using up the memory and tweak based on that or consider upgrading.

If your disk space is running out````
df -h

then you should should upgrade.

Check io activity usage iotop (need another install)

If your machine is constantly pegged at 100% investigate why / what using top
Is there a problem with the process? Maybe it's time to upgrade if it's normal usage.

These are things I would consider reasons to upgrade but always first check if it's normal usage or abuse/abnormal usage in which case either tweak, fix security issues before throwing hardware at it.

My 2 cents.

amityweb,

Using all your RAM and swap space is a clear indication that you need to do something. That could be upsizing to a 2GB Linode, or fine-tuning the configuration of the 1GB VPS.

If the site(s) on the 1GB are not suffering from poor performance you could stay on the 1GB and try to fine tune the current config. If you are having performance issues then you can upsize to a 2GB and then try to fine tune the config (either to eventually move back down to a 1GB or so you can add more sites to the now more efficient 2GB).

You also need to put a value on your time. If you are going to end up spending several hours trying to squeeze a little more out of a 1GB Linode it may be more cost effective to upsize and spend those hours on billable work. I'm not saying that learning how to optimize your Linodes wouldn't be valuable, knowing more about the systems you manage is always important. But timing can make a difference, especially if you have projects that are lined up that need to be tended to now.

MSJ

> Well, it may be handy to know what web-server and database systems you run on there first
CentOS 6, Apache, MySQL, PHP - standard web hosting stuff

> Is any of the machines using swap?
Yes, 256Mb which is setup as standard with Linode and other posts state this should not be changed

> Using all your RAM and swap space is a clear indication that you need to do something
This is the sort of answer I am looking for, if RAM and swap is high, then I need to do something. I was not sure if this is OK or not, because some other sites state its OK for swap to be high with cache, and the computer always fills up RAM anyway. So I do not know if this is OK or not. If its OK, then what else is indicative an upgrade is needed, or if its not OK then I can tweak or upgrade. I just dont know if I am supposed to have lower than nearly full RAM and swap from what I read.

The key question is whether or not you are moving stuff in/out of swap on a regular basis. If your memory is full but contains lots of cache/buffers and swap only contains stuff that is very rarely used, you should be OK. Once you start to regularly move stuff in and out of swap, you need to do something.

@amityweb:

> Using all your RAM and swap space is a clear indication that you need to do something
This is the sort of answer I am looking for, if RAM and swap is high, then I need to do something.
Using most or all of your RAM isn't necessarily bad, especially if your RAM is being used for caching and buffers (Linux is smart about this stuff). The fact that you're using all of your swap too means it's time to get more RAM or manage the RAM you have better.

Sometimes fine tuning your config helps. It could be:

  • a Wordpress site that is using a default config and grabbing too much RAM.

  • a recommended config for PHP or MySQL memory allocation that is too large for a smaller site.

  • too many apache processes.

  • could be one of many other things.

Narrowing down what it could be could take some time, but if you're using the same type of configuration on any of your Linodes then figuring out what is eating your RAM is important.

MSJ

First step - limit the amount of processes your web server / application spawns according to the amount of memory, and number of cores your server has. Don't let it go into an excessive amount of swap on a regular basis. Don't spawn so many processes which require CPU but can't be serviced quickly enough, if your userload is excessive then you might need to turn things down a bit.

Start with a limit you consider reasonable, then you can tweak it up if there's plenty of CPU/memory available, or tweak it down if the userload is too high or the server is using too much swap.

After that, analyse how many requests are being queued because your server can't process them with the limited number of workers you've got. If there's a delay in your HTTP request being served - you've got too many requests coming in, if you're at the limit of your CPU/memory then it's time to upgrade - otherwise adjust the number of processes.

I always tend to have nginx as a frontend server which handles requests for static files directly, and proxy any requests to the application server. In this scenario you'd limit the amount of Apache/PHP processes to a sane number (start with 8, it's the number of cores a Linode has and probably good enough for 1GB RAM), nginx will continue to serve static files quickly whilst slower PHP requests will be queued to Apache.

Thanks a lot, about this > If there's a delay in your HTTP request being served - you've got too many requests coming in and > requests are being queued because your server can't process them with the limited number of workers you've got I dont suppose this is a reason there ay be a high Time to First byte on a server? I have one server that seems to have a high TTFB and I dont know why (I am trying to learn!).

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct