Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I'm planning to buy a Raspberry Pi, a college of mine has a 256 MB left. But I don't know if 256 MB of memory can for fill the things I want to run.

I want to run an Apache web server (or an other web server that use less ram and CPU) with PHP and MySQL, a FTP server and a SOCKS 5 proxy. On the web server I'm going to run:

  • a Vbulletin forum with 8 users
  • A game that I'm developing at the moment.

When the game is ready I could move the forum or the game to an other raspberry when it is to heavy. I'm keeping the game as small and fast as passable. For example: I'm going to process all update jobs with C++. But when the game is big enough to gain money with it I want to buy a normal server if that gives a performance boost. But I want to experiment with the Pi for a while.

So my question is; should I buy a new 512 MB model B pi, or just buy the 256 MB version b of the college of mine?

share|improve this question
add comment

1 Answer

up vote 10 down vote accepted

There's no definite answer for that because it really depends on how much performance you need, how complicated your application would be, etc.

It's always better to have more memory, just to be safe. Remember that you wont ever get full 256MB of RAM to Linux, the best you can get is 240MB as rest will be allocated to GPU (and you really should use this split in your workload). 240MB is not that much but on the other hand there is a lot of VPS service providers which provide VPSes (which are virtualized private servers) with 256MB of RAM and people run quite big sites on this machines so it's definitely possible.

You can set a limit of memory available to PHP site and on many shared hosting services it is set to 8-16MB per site. And a lot of applications can run quite happy with that. MySQL has a lot of configuration options that can be used to limit it's memory usage and you can quite easily run it with 64MB (or even less) of memory. Apache webserver is not memory hungry too and there are even lighter alternatives. We can skip FTP and SOCKS server since they takes really small amount of memory (at least when used by only couple of users).

So database is the biggest issue here. Remember that the more memory database server has, the better performance it will get (it uses it mainly for caches to safe disk I/O). On really high traffic sites, database server has enough memory to keep (almost) whole database in the memory. You are probably not going to need that good performance. RaspberryPi does not have too quick storage (it's like 5-10 times slower than on full-blown computers even without RAID) so your performance will be really slow when it hits storage. Continuing already mentioned VPSes - they have much quicker storage solutions in most cases but they also share this storage with many other VPSes (often 16 or even 32) so it's very often not better than the one on RaspberryPi. And again, a lot of sites run happily on those servers.

So to sum up - you should be perfectly fine with 256MB of RAM but you are going to have to tweak some configuration options to lower the memory usage. It should be easy to find some tutorials about that on the Internet, especially when looking for articles about optimising server for VPS use etc. If you don't plan on using something that needs more memory in the future and can safe some money by buying 256 MB version of RaspberryPi, it can be worth it. And you may learn some interesting skills like designing your application so that it uses less memory or configuring your system to need less memory. That skills may pay of in the future.

share|improve this answer
    
Thank you for the good answer. It is indeed a very good way to learn how to develop good applications. Thank you very much. I'm going to get the 256 one. I found a lot of tutorials to do this: squidoo.com/optimizing-mysql-for-vps-dedicated-server wiki.vpslink.com/Low_memory_MySQL_/_Apache_configurations supportcenter.verio.com/KB/questions.php?questionid=267 serverfault.com/questions/29126/… my.opera.com/floweringmind/blog/… –  Laurence Nov 13 '12 at 8:02
1  
@Laurence: I know it's an obvious thing but just remember it's good to also know why you have to change some values and what they do if you really want to learn something useful. Some of the values are just copy&pasted from other sites without much thinking and may not be optimal for you. –  Krzysztof Adamski Nov 13 '12 at 8:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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