Forum: 

Wordpress appliance - Chewing through RAM

Elghinnarisa's picture

Hello there! First of all, you have to excuse my lack of knowledge. Linux is really not my area of expertise which is why I ask for help from people who know much better than I do.

So the story goes, I wanted to host a wordpress site. I found out there is a turnkey wordpress appliance for it, well simple enough I thought. So I downloaded it and imported it to my Virtualbox. Got it up and running without issues and have been using it for a few weeks without a single problem.

However, 3 days ago the site just went down. I check my virtualbox and it said it is out of both RAM and SWAP (checked through the use of the  'top' command). Weird I thought. I tried to restart it, but it refused to respond to any commands. I forcefully closed it in virtualbox (might been a bad idea.. but yeah.) and tried to start it again. No luck, it locked up and just stood there forever reading/swapping to my harddrive and didn't work at all.

At this point, I had no idea what the problem was. 

What I did was to exported the appliance in virtualbox to try and start it on another computer, and there it ran. But man it was slow like heck. But it ran.
Since it 'worked', i yet again imported the newly exported wordpress appliance to the server machine again. It ran, but again, slow.
After a while I noticed it is running out of RAM again for some reason. Without knowing what to do, i changed it to 1024MB of RAM instead of the normal 512MB (in virtualbox that is). After this it has been running for 3 days now, but it is using so much more RAM than before.

According to the top command, it is currently at 280MB free out of that 1024MB that I gave it. Which is a lot less than the 400-450MB of free RAM it had 24 hours ago.

I still have no idea what is causing it and honestly, i don't really know how to figure it out. I don't know why one day it just crapped out like that. Which is weird since neither me or my girlfriend touched it for days around that period.
It feels like it is slowly eating through the RAM now as well, considering for every hour it is up, i get a little bit less of free RAM. I had 350MB free this morning, and now about 14 hours later I have around 280MB of free RAM.

Hi E, Your Apache web server will allocate a process every time a page is requested and keep it in memory. The more web page accesses the more RAM gets allocated. It's normal. It sounds like your WP server is working now. If it stops working again give us an update.

Cheers,

Tim (Managing Director - OnePressTech)

Elghinnarisa's picture

Thank you for your reply!

Yes, I have read about that after I saw it for the first time. The thing I find strange is that the machine is set to 512MB RAM by default, but now after I ran it for a while I need to go up to 1024MB.

It has as of now, ran for 5 days. Still around 250-350MB of free RAM but it seems to have stopped there. So I might have asked this question in vain... Do you even say vain? Sounds good in my head.

Either way, I just automatically assumed something was 'wrong' considering the machine ran out of RAM with it's default settings. Though if it keeps working now, that is just fine by me. I just wanted to make sure nothing was wrong with the machine itself. Since it would be quite annoying if I had to restart from scratch. 

No Worries. Your LAMP / WordPress RAM use is primarily based on a chunk for the database and a chunk per Apache process. The Apache processes hang around after use to handle http timeouts and to then remain available for another http request. The size of the RAM chunk is related to the size and number of plugins you add to WordPress.

On a system restart your system will stabailise to its true RAM requirements until http activity starts to trigger the persistent Apache processes.

If you are stable now and your site is low use you won't have trouble for a while. Once the robots find you though this will change especially the Baidu robot. They can hammer your site and cause your apache to chew up all the RAM and start using your swap space.

Cheers,

Tim (Managing Director - OnePressTech)

Jeremy Davis's picture

I've fallen behind with my forum posts due to laser focus on v14.1 release (which is mostly done now...) Tim has said it better than me anyway (besides he knows much more about WordPress than me).

But I'd like to address your query regarding the default RAM settings from a TurnKey perspective. Basically the default settings are a bare minimum for testing purposes. We can't anticipate user's needs or desires so we basically went for as low a spec as possible. The default should work fine with the included plugins and a user or 2, but beyond initial install and testing you will almost definitely need to bump up the RAM. Depending on your specs you may also wish to bump up the swap too (although swap is MUCH slower than RAM).

Though this was more of a reflection of Apache use of RAM than WordPress.

Cheers,

Tim (Managing Director - OnePressTech)

Jeremy Davis's picture

But you know more about "real world" Apache usage than me too though! :)
Elghinnarisa's picture

Sorry for the late reply!

Thank you for anwsering my question. As it turns out, everything is as it should be then. 
I was just a bit worried since I by default assumed the standard settings would be "enough" so to say. But glad to know that there was not wrong with it now that I know the reason behind it.

Post new comment