Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
Hey everyone, I may not be a complete newbie, but I'm fairly close, so bear with me... I have a 256mb Slicehost account. Previously I was using Ubuntu and LAMP, ...
  1. #1
    Just Joined!
    Join Date
    May 2008
    Posts
    3

    How can I get the most out of a 256MB server?

    Hey everyone,

    I may not be a complete newbie, but I'm fairly close, so bear with me...

    I have a 256mb Slicehost account. Previously I was using Ubuntu and LAMP, but I noticed how incredibly high the RAM usage was (there were, like, 20 megabytes free under no load).

    I switched the web server to lighttpd and that has made a difference, but what else can I do to make things a little leaner and meaner?

    Should I switch to Gentoo? (All of my experience is with Debian and Ubuntu, but from what I've heard, Gentoo is fast so I'd be willing to learn it.)

    I need to host some PHP stuff (wordpress, drupal, some symfony apps) and some Python stuff (Django) which I can do just fine right now (Django and PHP through FastCGI). Because of what I have, I think I'm fairly database independent.

    Any advice on speeding up / cutting down memory usage would be greatly appreciated. I will switch distros if it will help.

    Thanks.

  2. #2
    Linux User dxqcanada's Avatar
    Join Date
    Sep 2006
    Location
    Canada
    Posts
    259
    The advantage of Gentoo is that your apps are compiled based on your specific architecture and compile options.
    That does speed up the apps ... somewhat.

    Gentoo also makes you think about the kernel and talks about customizing it.
    You can reduce unwanted drivers/modules by customizing your kernel.

    Memory usage on your system is mostly caused by running services.
    You should look at those and eliminate any that have no use for you.

    Gentoo is very customizable ... but I will warn you that compile times may be long for certain apps ... some people have complained about this point.

    The Gentoo Docs and Wiki are extremely helpful.



    Men occasionally stumble over the truth,
    but most of them pick themselves up
    and hurry off as if nothing had happened.

    Winston Churchill


    ... then the Unix-Gods created "man" ...

  3. #3
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by superuser2 View Post
    I switched the web server to lighttpd and that has made a difference, but what else can I do to make things a little leaner and meaner?
    I am not sure what do you mean. If you run the server on the same machine you are running an X session then you are out of luck :P I know no web server that's lighter than lighttpd.

    Should I switch to Gentoo? (All of my experience is with Debian and Ubuntu, but from what I've heard, Gentoo is fast so I'd be willing to learn it.)
    I can only advise to use Gentoo to everyone, and I love it. But if your main reason to change to Gentoo is "speed", then I don't think that that's a valid reason.

    Any advice on speeding up / cutting down memory usage would be greatly appreciated. I will switch distros if it will help.
    Check the output for htop, and see what's sucking up your ram. I doubt that lighttpd is the problem. I would suspect on django (python needs to load a vm, you know...). I'd suggest porting all the django stuff to php if you want to run on the light side.

    Quote Originally Posted by dxqcanada View Post
    The advantage of Gentoo is that your apps are compiled based on your specific architecture and compile options.
    That does speed up the apps ... somewhat.
    Not that much. The difference on most apps is really not appreciable. Maybe when encoding video and rendering 3d with blender you will notice some improvement due to sse and all that stuff.

    Gentoo also makes you think about the kernel and talks about customizing it.
    You can reduce unwanted drivers/modules by customizing your kernel.
    Wich will give you no speed boost at all. It will save you some megabytes in your hard disk, though.

    EDITED: note that, while you will be saving some disk space by ripping things in the kernel, you will also be losing around 300-400 mb of disk space for each installed kernel, because on Gentoo you need to have the souces for the kernel under /usr/src.

    Gentoo is very customizable ... but I will warn you that compile times may be long for certain apps ... some people have complained about this point.
    Compiling things takes time. People that care about that should be using a binary distro, and shound't be complaining about how long it takes to compile a given thing. It's just like to complain how far Russia is from the U.S.A.: it's just that way, and that will NEVER change.

    The Gentoo Docs and Wiki are extremely helpful.
    Probably, the best around.

    Cheers.

  4. #4
    Just Joined!
    Join Date
    May 2008
    Posts
    3
    Looking at the results of "top"... why are there a bunch of php-cgi processes and a bunch of python processes? How many does it need/why does it need to run so many?

    Ok, so I guess I won't switch to Gentoo unless I have a desire to learn more...

  5. #5
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by superuser2 View Post
    Looking at the results of "top"... why are there a bunch of php-cgi processes and a bunch of python processes? How many does it need/why does it need to run so many?
    Ask to django

    About the cgi, I suppose it depends on your web page. But python is a beast. I don't really understand why would anyone want to use a python based product on a web server. We already have to cope with databases wich a large enough. Let out using a vm product on a server... I suppose that it's a question of tastes... just like masochism

    PHP can do anything.

    EDITED: Also, note that lighttpd and apache have lots of compile options. The threading model was changeable on apache, I don't remember about lighttpd, but you might want to check that. Anyway, I doubt that the cgi threads are wasting your ram. Compared to a python vm, anything else is moot.

  6. #6
    Trusted Penguin elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    2,298
    Usually with Apache - and I assume this the same with django - there
    are several processes started automatically to cater for
    light load. When these are nearly used, more are started.

    With Apache, you set how many in the config file. I have
    never used django so wouldn't know where to start...

    ... well maybe Google
    If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)


    My new blog. It's probably not as good as I think it is.

  7. #7
    Just Joined! ls354's Avatar
    Join Date
    May 2006
    Location
    Cloud 9
    Posts
    97

    Articles

    superuser2 great that you are hosting with Slicehost too, I run Ubuntu on my VPS and

    Postfix
    VSFTPD
    LAMP (Wordpress) for an average of 1000 visitors a day
    and more I can't remember

    I recommend you go over the Slicehost articles they are a good reference. My set up uses 134MB of RAM. I am also positive Apache and MySQL were responsible for most of the RAM use.
    Last edited by ls354; 05-17-2008 at 09:05 PM. Reason: txt

  8. #8
    Linux Newbie SagaciousKJB's Avatar
    Join Date
    Aug 2007
    Location
    Yakima, WA
    Posts
    162
    Well, are you sure you're not interpreting the amount of memory usage incorrectly? I know when I first started using Linux, I'd look at the output of "free" and think my system as going to crash often, but it would always work well. Later I found out that's just the way Linux handles memory.

    In any case, I run several servers on my box with 256 MB...

    Apache2, with PHPMod and SSLMod
    MySQL
    Postfix
    BIND
    OpenSSH

    Just to name a few.



    It seems like it sure is using a ton, and in fact there's even a good amount of swap used, but it's running nice and fast.

    Of course, it's literally under no load there, but it can handle up to about 5.5 load times before it starts to bog down. Anyway, this isn't to brag, but to suggest you might be just fine with 256 for a server. Though maybe I've just been lucky; I'm sure the actual load probably varies, mine is just a small home server/router.

  9. #9
    Trusted Penguin elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    2,298
    Agreed, just because memory is in use doesn't mean there is a problem, in fact
    it is likely to be the other way around. Linux will use most of the "free" memory
    for a variety of buffers and caches. On our Linux server known as Beastie, I
    have allocated 1.5 gb of the 3gb ram purely to mysql caches.

    It also occurs to me that you may have been better off running PHP with
    Apache as a mod rather than fast-cgi. I don't know if your new server can do
    that though.
    If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)


    My new blog. It's probably not as good as I think it is.

  10. #10
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Quote Originally Posted by i92guboj View Post
    Which will give you no speed boost at all. It will save you some megabytes in your hard disk, though.
    If you're reducing the size of the kernel, that'll free RAM, and if it's RAM you're short on, reducing paging will surely speed things up.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...