New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Comments
You could load your website files into a RAM disk so they're read directly from memory.
The Linux kernel is a technological marvel. It will intelligently cache as many files as possible into RAM automatically. Because of this, I'm thinking this is not an issue with reading from the disk. Maybe the DB or complex PHP syntax. You could try precompiling the PHP and checking if SQL needs some optimisations.
A RAM disk and a rsync script (for no loss of data in case of power loss, etc) would be your best bet.
Can you be more precise about what is slow with your current configuration?
Sorry guys, it's not slow but I just thought with all this unused RAM maybe I could do something with it.
Try also to config your MySQL to use more RAM here and there to improve performance
You can downgrade to a cheaper, smaller VPS.
I could but my EU VPS is only £2/mo and I have one that only cost $10/yr for 512+512 burst
try also php accelerator. it consume more ram but php code will load faster
Cache, cache, cache. With extra RAM, caching is the order of the day. Have your php code send cache headers and let nginx have a generous cache expiration time.
Lowering your vm.swappiness may help your system by making it swap only in emergencies.
Linux is very optimal by default on the amount of swapping. I would not attempt to personally optimise something that the greatest programmers have done for us. Let Linux optimise - because it can do so a lot better than us.
Like when people optimise Java code. They optimize to the point where the Java Virtual machine is unable to optimise. This results in much slower code - because of the excess optimisation. Java developers quickly learn to stop optimising and micro-managing.
For those people with 6GB VPSes, thinking about this is practically all they do.
I would enable XCache, it caches processed PHP bytecode in RAM, so it doesn't have to be parsed at every page load from the PHP source-code. But even then the XCache would only consume 50 MB at most, it your site is not overly large (doesn't have a crazy amount of .php files).
There's a number of other similar tools, notably APC seems also good.
RAM Disk + Re-configure MySQL, few cache systems may help.
Then can you please explain why the greatest programmers have decided to set a swappiness of 60 by default on Ubuntu when I have 20 GB of RAM? Do these great programmers not understand that RAM is faster than disk?
Pretty sure that's a default swappiness for any system. That's why it's configurable - BUT... if it's getting swapped... you probably don't use it very often anyway... and if you have that much ram and you aren't using near any of it - why do you have that much ram in the first place?
Your logic does not make sense. So swappiness is set to 60. Do you know what that means? You need to look into the algorithm yourself - 60 is a weight and not a percent.
http://unix.stackexchange.com/questions/32333/what-does-the-vm-swappiness-parameter-really-contol
Does xcache work well with Nginx? I thought it was made to work with lighttpd
why not try memcached ?
No idea, I just use Lighttpd everywhere. Xcache seems to load into PHP, not into the web server, so it doesn't seem to be server-specific. And in fact, the Wikipedia list marks both XCache and APC as working with both Apache and Nginx. Use whatever works best for you.
The default swappiness of 60 is geared towards the desktop environment. Server environment is very different.
I always set swappiness = 0 on VMs. This doesn't disable swapping, it just reduces it to a "gotta do it, no choice" situation.
From what I understand by default the Linux kernel will copy pages to swap even if it's unnecessary at the moment, in case it needs to free up a large chunk of memory later on. That way when you do need the ram, it's already been moved to swap and you don't have to wait for it to be written to disk so the ram can be freed.