Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2008
    Location
    Niagara, Ontario
    Posts
    9

    Protecting memory for certain programs?

    I was curious to know if there's a way to protect memory for certain programs. I have a VPS that is fairly light on memory, and there's been a few occasions when a program/bug will go wild and eat up all the memory locking me out of ssh/webmin.

    Is there any way I can protect certain memory for certain processes/programs. Ideally I'd like some way for ssh to stay up in all situations.

  2. #2
    Join Date
    Sep 2009
    Location
    /home
    Posts
    248
    I don't think you'd be able to, unless the software itself has a cap on the ram that can be used.

    How much ram and swap do you have? Probably worth upgrading if you keep running out of ram.

    Another solution might be to run a lighter version of the software, that may help with your ram situation.

    Usually you would still be able to SSH in unless your VPS is swapping very heavily, in which case you should log into your web panel for the VPS (if you have one) and issue a destroy command, then start and you would be able to SSH back in.

  3. #3
    i had the same problem too:

    i am using webkeepers pro-plan webkeepers, but due to the short ram they provide, my server were always down when during high peak.

    i am not sure how to modifly my httpd.conf file in order to make my vps runs more smoothly.

    here is partial setting:

    Timeout 300
    KeepAlive On
    MaxKeepAliveRequests 500
    KeepAliveTimeout 15
    <IfModule prefork.c>
    StartServers 2
    MinSpareServers 1
    MaxSpareServers 8
    ServerLimit 50
    MaxClients 120
    MaxRequestsPerChild 0
    </IfModule>
    <IfModule worker.c>
    StartServers 1
    MaxClients 10
    MinSpareThreads 1
    MaxSpareThreads 5
    ThreadsPerChild 1
    MaxRequestsPerChild 0
    </IfModule>

    i had increase the MinSpareServers amd max, but after that it ate up all of my 256mb ram, and web service not work.

    i really don't know how to make things right.

    please help.

  4. #4
    Join Date
    Sep 2003
    Posts
    33
    Unless you need to use Apache for some reason, I would suggest using Lighttpd or Nginx instead, especially when low on memory.

  5. #5
    What is lighttpd and nginx? I am newbbiess in this VPS stuff~ thanks for helping.

  6. #6
    Join Date
    Apr 2008
    Location
    Tulsa, OK, USA
    Posts
    372
    Quote Originally Posted by magnify View Post
    I was curious to know if there's a way to protect memory for certain programs. I have a VPS that is fairly light on memory, and there's been a few occasions when a program/bug will go wild and eat up all the memory locking me out of ssh/webmin.

    Is there any way I can protect certain memory for certain processes/programs. Ideally I'd like some way for ssh to stay up in all situations.
    If you run on a Xen-based VPS (and therefore, you can set sysctls), then you can do the following as root:

    Code:
    # sysctl vm.oom_kill_allocating_task=1
    Add this to your /etc/sysctl.conf file, and it will take affect everytime the VPS is booted up.

    This may also work with virtuozzo/openvz, but I do not know.

    Setting this sysctl has the effect of making sure that the task that allocates the memory that triggers the out-of-memory condition will be killed instead of a random idle task, such as sshd.
    Last edited by kaniini; 10-15-2009 at 04:30 PM. Reason: clarify what the sysctl does

  7. #7
    Join Date
    Aug 2004
    Location
    Shanghai
    Posts
    1,449
    OF COURSE, this is possible. This is precisely what does our sbox cgi protection program (look into the Debian archive, it's in it).

    But you got to be a bit more precise on WHAT you want to limit here. If it's a cgi-bin, you can use sbox. If it's php or apache, then configure them. If it's a custom program, then you might need to do some special stuffs with it. Without much details of what you want to limit, it's pretty much impossible to tell you how...

    For your information, the C function to use is setrlimit(). This is what sbox uses to limit memory footprints of CGI-BINs... This could be used for virtually anything.

    I hope that helps.

    Thomas
    GPLHost:>_ open source hosting worldwide (I'm founder, CEO & official Debian Developer)
    Servers & our leading control panel and our Xen VPS hosting, which are already included in Debian and Ubuntu
    Available in: Kuala Lumpur, Singapore, Sydney, Seattle, Atlanta, Paris, London, Barcelona, Zurich, Israel

Similar Threads

  1. Replies: 7
    Last Post: 06-17-2009, 09:32 AM
  2. Cpanel VPS - Plenty of free memory, but 'committed' memory exceeds VPS RAM. Why?
    By tnedator in forum Hosting Security and Technology
    Replies: 3
    Last Post: 06-12-2009, 02:56 PM
  3. Quad Core 2GB Memory or Dual Core 4GB Memory? Complex Queries!
    By Gareth-AWD in forum Dedicated Server
    Replies: 5
    Last Post: 11-16-2007, 12:02 PM
  4. Protecting Myself
    By That Guy in forum Running a Web Hosting Business
    Replies: 4
    Last Post: 02-20-2007, 06:13 PM
  5. Out Of Memory problems. My server is down. Memory logs attached.
    By guarriman in forum Hosting Security and Technology
    Replies: 13
    Last Post: 10-18-2005, 10:01 PM

Posting Permissions

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