Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have VPS server with 1.25GB ram and 0.51GB cache trying to up an e-commerce website with 200k items, db now is about 2gb anything is now works terrible slow now because of lack memory mysql queries takes about 30 seconds to complete on the peak memory usage. so is there any methods how to calculate how much to i need to extend RAM of my VPS?

[root@ssrv/]# free -m
             total       used       free     shared    buffers     cached
Mem:          1247       1209         38          0          1         48
-/+ buffers/cache:       1159         88
Swap:          511        174        337
share|improve this question

closed as not a real question by symcbean, Tom O'Connor, John Gardeniers, Iain Oct 25 '12 at 12:56

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Not nearly enough information to even make a guess. I've run e-commerce systems supporting 2 million hits a day with a database 3 times this size on a smaller machine - but there are a huge number of contributing factors you've not mentioned –  symcbean Oct 25 '12 at 8:29
    
Add some, if it isn't enogh add more. Repeat as needed. –  Zoredache Oct 25 '12 at 9:38

2 Answers 2

up vote 3 down vote accepted

This statement;

mysql queries takes about 30 seconds to complete on the peak memory usage

Coupled with the stats provided suggest that you might in fact need to optimize you Apache and MySQL configs, perhaps re-evaluate your DB schema? It's not just about raw power.

How long is a piece of string? That's how much RAM you need! (Not infinity, for any mathematician reading this!).

So your DB is 2GBs; Worlds roughest figures here:

  • It would be nice to get most of that data into memory, so 2GB
  • Plus some extra for future growth (only you know how quickly your site is growing), so 2.5GBs
  • Also some extra beyond the data to store some cached results and query sets etc
  • Plus some for the OS and applications

I would just round that strait up to 3GBs.

Any good VPS provider will let you scale memory up AND down (if not, just move provider) on a 30 day basis so it wouldn't cost you the earth if you over shoot, just 1 month billing.

Another option to consider is tuning your VM. Change the swapiness and cache ratio etc. Look into those virtual memory manager options. They are well documented on line, as is Apache and MySQL tuning.

share|improve this answer
    
Thank you for this answer I has strait up to 4GBs and anything working just great now! –  Ken Tang Nov 6 '12 at 5:19

How much RAM you need to extend is very hard to tell with this information. If your VPS provider has the option to increase RAM in small steps, I suggest you increase the amount a step at a time until you find an amount that suits your needs.

Based on the numbers you have provided, I would suggest the next step is to go for 2 GB RAM and take it from there.

share|improve this answer
    
I'd go for 4GB, but there we go. –  Tom O'Connor Oct 25 '12 at 8:42
1  
Yes we just upgraded to 4GB and it is really huge difference anything working is great now. –  Ken Tang Nov 6 '12 at 5:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.