should i just get more memory
April 9, 2010 9:02 AM   Subscribe

What is the most memory-friendly linux web development stack?

I have a shiny new linux VPS. I want to use it for blogging, testing out web coding ideas, playing with html5, other things. The problem: it only has 128MB of RAM.

Which web programming stack should I use? Let's assume that I need one, language doesn't matter, and a database of some sort is needed?
posted by TheOtherSide to Technology (7 answers total) 2 users marked this as a favorite
 
128MB is a lot more than you think when it's not going to be bogged down with desktop services or even X. I'd use lighttpd or nginx instead of apache, maybe sqlite3 instead of postgresql or mysql (though I wouldn't expect that one to matter much for your playing around needs) and then pick whatever language you feel like. I'm a fan of Ruby and Rails, but you'll find partisans for every language and platform.

Since you'll be doing remote development, I recommend sshfs to transparently and securely mount the server's filesystem so you can use your local editor and not put extra thought into syncing the files.
posted by Zed at 9:48 AM on April 9, 2010


Make sure you aren't using Cpanel. That ugly beast can steal most of the 128MB.

Lots of Django sites run cleanly in under 128MB, 64MB is pretty common for many sites.
posted by Invoke at 9:53 AM on April 9, 2010


I had about that much memory when I first got a Linode VPS. I tried using JSP with tomcat and it basically didn't work. But PHP/MySQL was fine, and so was Postgres SQL.

They've since upped the memory (at the same price) to 360Mb and moved to a Xen powered system and it works a lot better. Java and tomcat work fine.
posted by delmoi at 9:59 AM on April 9, 2010


nginx is the webserver you want. far and away. Beyond that, it's about what you want to do.

My mini-vps stack is nginx with the built in caching, php-fastcgi with xcache, ruby on phusion passenger, sqlite3 when it makes sense, minimal memory mysql.

I run a full wordpress-mu install with about 20 low traffic blogs, my own personal web development stuff in ruby, and a few static websites in under 100 MB of ram.

The real key to running in a low memory environment is making sure you've tweaked all the variables. Linode and Slicehost have alot of good articles about how to tweak mysql for low memory environments as well as a bunch of other databases/applications/frameworks.

Caching is also crucial if you don't want to be destroyed by even a moderate amount of popularity. Caching is crucial for my wordpress-mu install. I do every sort of caching possible: database, opcode, rendered html, nginx-fastcgi cache (which is filesystem based), w3-total-cache (which lets you do filesystem or memcached). I also put everything possible on amazon s3. All this means that if I get a traffic spike and have 1 thousand hits a minute to the front page of one of my hosted blogs, only one of those impressions are actually going to hit my application, and then, if the content hasn't changed it won't hit my database. Beyond keeping your little machine alive and chugging away, it's just good practice as well.

However, no matter what language you choose, I'm fairly certain it can be configured for a low memory environment.

If you are really super duper memory conscious, you can actually write directly in C: Madfish

Or something like Lua, which does remarkably well on my little wrt54g router, so I'm sure 128MB of ram would be more than enough.

The only thing I might advise avoiding in Java, but then again, I don't have very much experience with java.

If you are totally nuts, you can write your apps completely in javascript, and use couchdb as a backend: Standalone couchdb application.

Basically, choose your language, and worry about optimizing it later.

Hope I've been helpful. MeMail me if you have any questions!
posted by Freen at 10:06 AM on April 9, 2010 [2 favorites]


For a low traffic site you can use pretty much anything you want with that much memory. The only time it starts to be an issue is when you need lots of concurrent worker threads (or processes, depending on server design and config) to handle higher numbers of hits, where each thread needs X amount of memory. X is in the ballpark of 5 to 15 MB though so if for example your site runs fine with max_connections = 10 then it will easily work out in 128 MB.
posted by Rhomboid at 10:48 AM on April 9, 2010


I have to 2nd using Sqlite3 if you are short on memory.
posted by cowmix at 11:55 AM on April 9, 2010


You may also be interested in setting up a NoSQL solution for this type of system.
posted by jivadravya at 1:56 PM on April 9, 2010


« Older I just sent out my first e-mai...   |  You Are Not A Doctor - But you... Newer »
This thread is closed to new comments.