19

Does anyone have a ballpark figure of how much VPS ram (without burstable) I would need to have apache with wordpress and subversion as well as the MySQL instance?

Apache would host a couple of sites and SSL. MySQL would have just the Wordpress database. These sites are low traffic, less than 1k hits a day.

Chopper3
  • 100,240
  • 9
  • 106
  • 238
Kyle Brandt
  • 82,107
  • 71
  • 302
  • 444

7 Answers7

18

Take in mind that each apache worker will consume about 20-25MB, so if your 1k hits would be equally spaced in time in 8 hours per day you can think about having to serve only 0.03 requests per second.

Assuming you have all you traffic concentrated in only 1 hour in the day (it isn't of course), you should have to serve about 0.28 requests per second.

An other issue is how much memory got you DB, it is simple to know however, and it is quite a fixed cost.

In the worst case you will have to transfer the entire DB (oh my god!, refactor you SQL in this case! :) ) .. so double the previous number..

The short answer is (IMHO) 128MB will suffice, abundantly. You server will be idle and memory will be free for a long time, given the traffic you are imagine.

I have 20 domains into a VPS with 256 MB since 3 years, the are ok ... and the total hits are about 1500-2000 ...

OK, memory is cheap nowadays, but guys ... are you aware of how much is one gigabyte ?

PS: I'm talking about a linux system of course, not about OS consuming 4GB for the gui only :)

drAlberT
  • 10,871
  • 7
  • 38
  • 52
13

For the low-traffic usage you are describing, you should be fine with a small plan (256MB - 384MB). When Apache and MySQL are installed their default configs assume they are working with more RAM available to them which can cause problems. Use the following as a good starting point and adjust as necessary:

In your Apache 2 configuration file (typically found at /etc/apache2/apache2.conf or /etc/apache2/httpd.conf):

StartServers 1
MinSpareServers 3
MaxSpareServers 6
ServerLimit 24
MaxClients 24
MaxRequestsPerChild 3000

In your MySQL configuration file (typically found in /etc/mysql/my.cnf):

key_buffer = 16K
max_allowed_packet = 1M
thread_stack = 64K
table_cache = 4
sort_buffer = 64K
net_buffer_length = 2K

Also, if you don't use InnoDB tables, you should disable InnoDB support by adding the following line:

skip-innodb
tasaro
  • 380
  • 1
  • 4
  • I have several of these lines mentioned in `apache2.conf`. change them all? they are labeled: `prefork MPM`, `worker MPM`, `event MPM` – vsync Aug 11 '13 at 14:22
2

I was having problems with mine at 512MB of RAM until I switched to FastCGI. That made the performance improve a lot. I had a 30MB free (not counting cache, of course) until then, and I ended up with over 100MB free.

Your mileage may vary, of course, depending on the traffic of your site. And once the traffic starts to turn up, you can switch to nginx.

To buy myself some comfort, I upped to 1GB.

BTW, I'm hosted at prgmr.com, and I haven't seen anyone touch their prices yet.

Matt Simmons
  • 20,218
  • 10
  • 67
  • 114
1

I'm running a similar setup on a VPS with 256 MB RAM, but running lighttpd instead of Apache. I tried Apache first, but it was too much for the 256 MB VPS. If you want to use Apache, Id say you can get by with 512 MB RAM.

Depending on who you use for your VPS hosting, you can start with a smaller VPS then increase the size if needed without having to re-configure the server.

Jason Alford
  • 116
  • 1
0

I've been struggling with this for awhile.

AlbertT's setting worked brilliantly. The mysql settings made a CLEAR difference and now site browses great. http://laterboltz.com

In your MySQL configuration file (typically found in /etc/mysql/my.cnf):

key_buffer = 16K max_allowed_packet = 1M thread_stack = 64K table_cache = 4 sort_buffer = 64K net_buffer_length = 2K

Also, if you don't use InnoDB tables, you should disable InnoDB support by adding the following line:

skip-innodb

0

You should be fine with 1GB but go for 2GB if you can, it's a major performance step for most modern OSs.

Chopper3
  • 100,240
  • 9
  • 106
  • 238
0

I use nginx+php-fastcgi instead of Apache, but with a very similar application load. I use svn+ssh for my subversion access, so there isn't an svnserve process running except when I'm accessing the repository. This is all running on Ubuntu 8 LTS.

Right now, I'm running at 174mB used of 256mB, and the website is quite responsive (average response time of 500ms for Wordpress views)

             total       used       free     shared    buffers     cached
Mem:           256        252          3          0         22         56
-/+ buffers/cache:        174         81
Swap:          511         12        499

I'd recommend looking at a lightweight frontend webserver like nginx or lighttpd instead of Apache + mod_php. Even Apache + mod_fastcgi proxying to php-fastcgi would take less memory.

If you do go down the Apache route, my gut says 512mB would probably do the trick. 1 or 2gB of memory seems like considerable overkill, especially given how most VPS providers scale up their costs when you get to larger configurations.

James F
  • 6,549
  • 1
  • 25
  • 23