Closed Thread
Results 1 to 10 of 10

Thread: mod_loadavg

  1. #1
    stop staring krakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to behold krakjoe's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    3,616

    mod_loadavg

    Hi fellas, a hosting service I have a hand in has been having real problems with server load lately, not always because of php but a mixture of rails, php and mono is using up far too much resources and it was causing things like mail, ssh and ftp to quit or behave strangely not to mention the trouble it caused apache.

    So the other night I spent all of about 5 minutes writing mod_loadavg, which as you might expect is an apache module to detect load average and act on what it finds. The module will return a pre-defined ( by you if you want ) HTTP response code when the server is too busy ( Service Unavailable makes sense and is default ).

    It's configurable, but only to a degree, you can setup how load is detected ( to a degree, has to use /proc/loadavg ) and what the limits of your machine are and what HTTP response to send back, however, these variables aren't set in httpd.conf, the reason is that you'll probably never need to change the values once you have them right, to save on disk i/o and to reduce the margin for errors ( for me ) you set them when you build the module.

    This module was written for apache 2, as far as I'm aware it will not work with apache 1.3 ( if you try you're on your own ).

    I know it's going to be most useful to the guys here, I wrote something similar before as a php extension, but mono, rails etc are used more and more heavily, so going to the source ( apache ) makes much more sense now ...

    Consult README before you do anything ...

    http://spacesocket.com/loadavg-0.1.tar.gz
    (\__/) Joe Watkins
    (='.'=) Software Architect
    (")_(") http://pthreads.org
    Copy and paste bunny into your sig, help him gain world domination.

  2. #2
    b& Zombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond repute
    Join Date
    Mar 2007
    Location
    Florida
    Posts
    1,985
    Wow Joe you really do help the people here at FWS

    Im gonna try it later

  3. #3

  4. #4
    stop staring krakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to behold krakjoe's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    3,616
    Build errors might have occured for ya, download same link again if they did ...

    @mods, can we please raise the limit on archives and add .tar.gz/.tar.bz2/.tar to allowed extensions ??
    Last edited by krakjoe; December 2nd, 2008 at 08:19.
    (\__/) Joe Watkins
    (='.'=) Software Architect
    (")_(") http://pthreads.org
    Copy and paste bunny into your sig, help him gain world domination.

  5. #5
    Bullah Dan has much to be proud ofDan has much to be proud ofDan has much to be proud ofDan has much to be proud ofDan has much to be proud ofDan has much to be proud ofDan has much to be proud ofDan has much to be proud ofDan has much to be proud of Dan's Avatar
    Join Date
    Mar 2005
    Location
    Bendigo, VIC, Australia
    Posts
    6,957
    Joe, this is an excellent release mate. This will really help host providers particularly a lot. Well done mate.

    Regarding the allowed extensions, if you PM Peo or Jan, I am sure they will oblige. Us Mods don't have access to do that.
    Dan O'Riordan
    Author of 'The Everyday Idiot's Guide to Web Hosting'.

  6. #6
    Senior Member katiekitty is a jewel in the roughkatiekitty is a jewel in the rough katiekitty's Avatar
    Join Date
    Oct 2008
    Location
    I Live Inside A Mounting Rack
    Posts
    151
    thx for the script

  7. #7
    stop staring krakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to behold krakjoe's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    3,616
    Thanks fellas, I thought people here would find it useful.

    It's really doing well on the server it was written for, the server has more than 400 accounts on it. It's stopping people from serving resource hungry scripts, it's killing people using or trying to use file upload services, chat scripts and all the other things that ( free ) hosting providers hate. It takes a bit of playing with, but once your set it does make all the difference.

    I'm pretty pleased with it myself. It's amazing what 5 minutes of thought can do for a hosting service.
    (\__/) Joe Watkins
    (='.'=) Software Architect
    (")_(") http://pthreads.org
    Copy and paste bunny into your sig, help him gain world domination.

  8. #8
    Super Moderator hamster is a name known to allhamster is a name known to allhamster is a name known to allhamster is a name known to allhamster is a name known to allhamster is a name known to allhamster is a name known to all hamster's Avatar
    Join Date
    Jul 2007
    Location
    Singapore
    Posts
    2,634
    This will totally revolutionize lots of free hosting providers Gives us a chance to sit back and relax for a bit

  9. #9
    stop staring krakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to behold krakjoe's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    3,616
    It doesn't solve all problems, but it does solve a major one ...

    Is anyone still using apache 1.3 ?? If so does that someone want to give me root access so I can make mod_loadavg work for them ??

    I don't see any reason to use apache 1.3 anymore, doesn't WHM build 2/2.2 by default ??
    (\__/) Joe Watkins
    (='.'=) Software Architect
    (")_(") http://pthreads.org
    Copy and paste bunny into your sig, help him gain world domination.

  10. #10
    stop staring krakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to behold krakjoe's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    3,616
    So a minute ago while I was looking for scoundrals on the server. One of the sites was running "that bit torrent client", the load averages were over 30 and guess what, the server didn't crash, I didn't interfere I just watched ... apache stopped serving requests and the one minute load average immediately went to under 1, I had to wait for about 5 minutes and the server just started behaving as it should again ... I deleted the account using "that bit torrent client", but even if I hadnt, service would have been interrupted for no time at all ...
    (\__/) Joe Watkins
    (='.'=) Software Architect
    (")_(") http://pthreads.org
    Copy and paste bunny into your sig, help him gain world domination.

Closed Thread

Tags for this Thread

Bookmarks

Posting Permissions

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