Best Way to Safely Restart Linode?

I'm running a fairly standard LAMP stack on my Linode. I want to increase the size of my swap disk, and to do that, I need to shut down Linode.

The thing I'm not sure about is how best to do this safely, i.e. can I just hit the shutdown button in the Linode manager? Or should I go in and turn off each of my services first? (mysql, php, apache) Or something else altogether?

Thanks for reading!

Michael

8 Replies

Why do you want to increase your swap? Normally you don't want to use swap on a server.

Anyway just pushing the linode shutdown button will stop your services for you so it's safe to use.

Thanks obs, that's awesome! :)

I originally bought a 512mb Linode, but I'm now up at 1024mb and I've never increased the original swap size from 256mb.

The server hit some memory issues this week causing it to go down. In both cases though, there was around 200mb of RAM still free, but the swap was full and I/O was far higher than normal.

I don't think I'm reading the issue right there tbh, but after reading up a bit more on swaps, a rough rule of thumb for webservers seemed to be that the swap should be around half of your total RAM (So I wanted to update the swap size to match the updates my total RAM has had over the past year)

Would definitely love to hear if anyone thinks I'm approaching that wrong, or has any links worth reading! :)

Find out what's going wrong on your machine that eats up all the memory. If you're swapping 256Mb then your machine will go slow - adding extra swap will just delay when the machine runs out of VM anyway.

I think that's the best route to go down in the long run, definitely. I haven't a clue how to start though. I know to use things like top etc. to see if it's mysql, apache etc. hogging the memory, but how best to start drilling down further? (MySQL was the culprit for me, but what's the best way of finding out what's causing all the work for it?)

I also need to look again at what proportion of my RAM I should be giving to each process (Again, not sure where to start there, and hard to find decent "rules of thumb" online sometimes)

It depends what your server is running, 40% mysql, 40% apache should suffice, the default my-small.cnf that comes with the mysql source is normally good for a linode. Apache, it depends how you're running php assuming you're running prefork with mod_php and not running any seriously heavy scripts (some drupal and wordpress modules can go nuts), then 40-50 max clients should be alright on a 1024.

Check out mysqltuner.pl for mysql, install munin to view details on resource usage for all sorts of cool stuff.

Search the forums there's TONS of posts like this with good info.

Have a read of the LAMP stack script at linode.com/stackscripts and it'll give you some ideas on how to tune your server.

@obs:

Normally you don't want to use swap on a server.

I have swappiness set at 100:

http://kerneltrap.org/node/3000

to get as much swap usage as I can. http://zunzun.com loads a lot of scientific and mathematical libraries into multiple forked processes at startup, and much of that is unused as time goes by. I'd rather have that unused code sitting in swap than occupying RAM.

James

OK let me rephrase, you don't want to be swapping in and out frequently :P

@obs:

It depends what your server is running, 40% mysql, 40% apache should suffice, the default my-small.cnf that comes with the mysql source is normally good for a linode. Apache, it depends how you're running php assuming you're running prefork with mod_php and not running any seriously heavy scripts (some drupal and wordpress modules can go nuts), then 40-50 max clients should be alright on a 1024.

Check out mysqltuner.pl for mysql, install munin to view details on resource usage for all sorts of cool stuff.

Search the forums there's TONS of posts like this with good info.

Have a read of the LAMP stack script at linode.com/stackscripts and it'll give you some ideas on how to tune your server.

Thanks! That post was awesome, really helpful! Going to look into what all you suggested now. And thanks for the nod in the direction of mysqltuner/munin, they look great!

Will save your site address too for paid work if it ever gets that far! :)

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