views:

303

answers:

7

This question pertains to Ruby on Rails and PHP. When looking for a VPS host for a web application (haven't decided which of the 2 languages to write it in yet), what should I take into consideration more? Memory or CPU? I know that you need a fair balance of both, but which wall will I run into first?

I'm sure it depends on the type of work the application is doing, and in my case its the normal CRUD. My guess would be memory, but I'd just like to make sure.

A: 

I ran into memory problems long before CPU issues, but I was running the SQL server on the same VPS as the web front-end. There were some serious memory issues issues until I paid for an upgrade.

Jon Tackabury
+6  A: 

I think the DBMS and the nature/number of the queries you will be making will be the most important consideration here, rather than anything pertaining to the language used. (Assuming the database is going on the same server)

Unless you've got a very small dataset, memory is likely to be limiting before CPU.

Also, you've not really specified what the combinations on offer are - so its hard to give an answer.

benlumley
A: 

As long as you can keep it cached, you will only need to calculate/fetch it once, but it really depends how dynamic is your web application.

Maiku Mori
A: 

You will run into the memory wall way way before the cpu wall on a normal crud application.

Ólafur Waage
A: 

More memory with letting MySQL consume it for cache will give you great perfomance improvements. Mix it with good DB design, avoid building large expensive arrays of objects, and you should hit any CPU issues... Well, unless you're doing CPU heavy aggregations or some complex logic.

xelurg
A: 

I think the first wall you will run into is related to database connections. More likely than not, the first thing to slow you down will not be memory shortages, or CPU resources, but time wasted opening, closing database connections, as well as waiting for available database connections. Try to make sure you utilize connection pools in your application, if you can.

Mainegreen
A: 

Actually, in my experience the first bottleneck I ran into when running a webserver on a VPS was bandwidth. Either saturating the actual bandwidth, or running out of allowed open sockets/connections on the VPS. The former you can't do much about unless your host allows you to buy more bandwidth, but the latter at least can usually be tweaked by the hosting company. After bandwidth, memory was the next limit I hit, mostly from running SpamAssassin at the same time as MySQL, Apache, etc. I resolved that by upgrading to the next level plan with more memory available.

If you haven't already selected a hosting company, I can recommend Tektonic. The prices can't be beat and if you get the middle or higher level plans they have a decent amount of RAM and CPU. Bandwidth is not metered, you're capped by actual capacity instead so if you find yourself short on bandwidth you'll probably have to pay for additional capacity, as with any host.

Jay