httpd rape suggestions

Discussion in 'OT Technology' started by Divine Vengeance, Jan 17, 2004.

  1. Divine Vengeance

    Divine Vengeance New Member

    Joined:
    May 21, 2003
    Messages:
    20,453
    Likes Received:
    0
    I've been screwing around with a PHP-based IRC bot for the past week or so, but I've discovered that whenever it's running it always causes my server load to rocket up to 1.2 - 1.7. For example, this morning the time the service was taking was 1987m :eek3:

    Any suggestions on how I can run the script without raping httpd?
     
  2. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    what does your code look like?
     
  3. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    I'm pretty sure my PHP AIM bot is pretty low key on the processor load (SLED, how was yours doing?)

    Its possible the way your IRC bot is written, its not using non-blocking sockets. Which means PHP has to keep scanning the socket for activity versus just waiting for activity (or at least thats my understanding of it). Maybe if you post some snippets where your bot listens for inbound messages might help us.

    I'd also presume your machine has enough ram and processing power to do this, right?

    Does your script do anything with a database or files? Is it retrieving anything off the web?
     
  4. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    my bot does fine as well, doesn't peg the processor, or even take up that much memory... works great
     
  5. col_panic

    col_panic calm like a bomb Moderator

    Joined:
    Sep 19, 2003
    Messages:
    188,160
    Likes Received:
    0
    Location:
    winter haven, fl
    shouldn't it just be listening on a port rather than "scanning" it? i know nothing of php, but i would expect any hardware to support this

    like you said, post the code
     
  6. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    Its up to the coder to determine how the interaction will go. PHP gives you plenty of room to hang yourself.

    Check php.net for socket_blocking() (I think thats it) otherwise check for socket & blocking & non-blocking and you should find some stuff on it. Or check out rsbauer.com and go to web dev projects. You'll find my PHP + AIM bot code in there.
     

Share This Page