PHP eating up server resources!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • google@jfruh.com

    #1

    PHP eating up server resources!

    Hello all-

    Apologies to everyone for what's probably a very inchoate and
    uninformed question, but I've been thrust into the position about
    having to learn more about PHP very quickly. (I'm also posting to
    alt.comp.lang.p hp, since I'm not sure what the difference is between
    the two groups.)

    Basically, I run a Web site that includes two PHP-based subsites -- one
    WordPress site and one PHPBB site. I get traffic that strikes me as
    heavy but not out of control -- it's been steadily building, currently
    at about 12,000 pageviews and 6,000 unique visitors on the average
    weekday, with 90 percent of the pageviews on the WordPress site. All
    of this is hosted on a shard server with a hosting company. I know
    just enough about PHP programming to hack around in the premade
    templates and customize my apps, and next to nothing about how PHP
    works on the server end.

    Yesterday, my Web host informed me that my domain was eating up a lot
    of server resources, and that PHP was the root cause. If I understand
    him right, PHP processing loads are causing Apache to fork lots of
    additional processes. He was unable to tell me whether this was a
    sudden spike or whether things had been steadily building and had
    crossed some threshhold. I upgraded both WordPress and PHPBB to their
    most recent versions in case there was some bug or vulnerability, but
    this did not solve the problem.

    I found the following article online that, if I understand it right
    (and again, I very well may not), says that PHP can often overload
    default Apache installs:



    So my question is, does this sound like the sort of thing that might be
    a result of just Apache and PHP getting a lot of traffic? Or could it
    be a bug or something in one of my apps? I'm posing this question in
    WordPress and PHPBB forums, but thought I'd see if any PHP maven would
    take pity on me and tell me if the problem is at that end.

    Enormous thanks in advance for any help anyone can offer. For what
    it's worth I'm running PHP 4.4.2; Apache 1.3.34 (Unix); and Linux
    (kernel version 2.6.9-34.ELsmp) on an x86 server of some sort.

    Oh, and my web host sent me the following "listing of the top
    apache/php processes" (though they all look like HTML GET processes to
    me):

    Srv PID Acc M CPU SS Req Conn Child Slot Host VHost Request
    0-5 6930 0/23/15201 G 0.24 1 0 0.0 0.12 186.87
    169.237.42.155 (unavailable) GET /h2videos/aow2.mp4 HTTP/1.1
    1-6 7515 0/11/15278 _ 0.36 2 197 0.0 0.49 181.53
    67.170.155.199 www.joshreads.com GET /images/0604/i060418getfuzzy .png
    HTTP/1.1
    2-6 7523 0/11/15327 W 0.58 1 0 0.0 0.19 180.29
    66.98.198.49 www.joshreads.com GET /wp-rss2.php HTTP/1.0
    3-6 7535 0/14/15351 _ 0.26 2 828 0.0 0.14 197.07
    65.161.109.99 www.numatek.com GET
    /pphlogger/pphlogger.php?i d=winchest&refe rer=http%3A//www.w
    4-6 7547 0/15/15212 W 0.59 2 0 0.0 0.08 164.51
    72.30.133.109 www.talkxbox.com GET
    /forum/showthread.php? mode=hybrid&t=1 730 HTTP/1.0
    5-6 7508 0/20/14816 W 0.43 1 0 0.0 0.08 169.51
    67.64.115.226 www.joshreads.com GET / HTTP/1.1
    6-6 7513 0/9/15285 _ 0.86 3 4490 0.0 0.10 190.84
    66.98.198.49 www.joshreads.com HEAD http://joshreads.com/wp-rss2.php
    HTTP/1.0
    7-6 7557 0/13/15239 W 0.95 10 0 0.0 0.06 177.00
    85.255.45.42 www.squackle.com GET /images/CornBL.jpg HTTP/1.1
    8-6 7565 0/19/15332 _ 1.69 12 38 0.0 0.23 200.75
    131.107.0.74 www.joshreads.com GET /images/0604/i060425apt3g.jp g
    HTTP/1.1
    9-6 7571 0/11/15100 _ 0.61 3 5191 0.0 0.16 180.45
    131.107.0.74 www.joshreads.com GET / HTTP/1.1
    10-6 7517 0/13/15219 _ 0.40 2 7085 0.0 0.30 206.82
    216.180.36.115 www.kisantech.com GET /brochures/path-inst-manual.pdf
    HTTP/1.1
    11-6 7518 0/8/15126 _ 0.17 17 192 0.0 0.07 191.08
    131.107.0.74 www.joshreads.com GET /images/0604/i060425fbofw.pn g
    HTTP/1.1
    12-6 7578 0/18/15023 _ 0.21 24 0 0.0 0.09 212.55
    69.128.101.82 www.joshreads.com GET
    /wp-content/themes/beeblebrox-tweak/print.css HTTP/1.1
    13-6 7583 0/10/15115 _ 0.41 11 907 0.0 0.50 184.53
    72.30.110.88 www.talkxbox.com GET
    /forum/showpost.php?p= 40381&postcount =15 HTTP/1.0
    14-6 7588 0/10/15177 _ 0.33 6 0 0.0 0.09 196.61
    67.176.145.50 www.gregjesse.com GET /misc/ds_blk.jpg HTTP/1.1
    15-6 7595 0/9/15203 W 0.27 6 0 0.0 0.06 209.70
    156.98.182.137 www.joshreads.com GET / HTTP/1.1
    16-4 29955 0/2345/15112 G 58.49 2 0 0.0 24.36 204.50
    87.16.226.236 (unavailable) GET /dl/sc2ost/02/09_-_Healing_Winds. mp3
    HTTP/1.1
    17-6 7510 0/33/15349 W 0.61 2 0 0.0 0.18 166.79
    148.241.64.15 www.technologynewsdaily.com GET /node/596 HTTP/1.0
    18-6 7511 0/20/15472 _ 0.76 7 120 0.0 0.11 184.87
    69.128.101.82 www.joshreads.com GET
    /wp-content/themes/beeblebrox-tweak/local.css HTTP/1.1
    19-6 7599 0/8/15191 _ 0.59 15 0 0.0 0.05 195.20
    69.128.101.82 www.joshreads.com GET
    /wp-content/themes/beeblebrox-tweak/style.css HTTP/1.1
    20-6 7610 0/7/15255 W 0.05 3 0 0.0 0.09 182.90
    193.110.187.231 www.psxe.co.uk GET /index.php HTTP/1.1
    21-6 7512 1/18/15277 W 0.75 2 5029 0.0 1.08 172.44
    69.128.101.82 www.joshreads.com GET / HTTP/1.1
    22-6 7615 1/8/15133 W 0.17 6 509 25.6 0.26 221.50
    131.107.0.74 www.joshreads.com GET /images/0604/i060420drabble. gif
    HTTP/1.1
    23-6 7616 1/4/15112 W 0.14 9 0 36.8 0.10 190.17
    131.107.0.74 www.joshreads.com GET /images/0604/i060419middleto ns.jp

  • Manuel Lemos

    #2
    Re: PHP eating up server resources!

    Hello,

    on 04/28/2006 04:32 PM google@jfruh.co m said the following:[color=blue]
    > Yesterday, my Web host informed me that my domain was eating up a lot
    > of server resources, and that PHP was the root cause. If I understand
    > him right, PHP processing loads are causing Apache to fork lots of
    > additional processes. He was unable to tell me whether this was a
    > sudden spike or whether things had been steadily building and had
    > crossed some threshhold. I upgraded both WordPress and PHPBB to their
    > most recent versions in case there was some bug or vulnerability, but
    > this did not solve the problem.[/color]

    Usually this is caused by the excessive number of static content being
    served at the same time by the Apache server that also serves PHP pages.

    PHP itself is not the problem, but if you use persistent database
    connections and serve many static content files that do not need
    database connections, you force an exceeding number of database
    connections to open needlessly. Those connections consume a lot of
    memory. When the RAM is exhausted, your situation agravates until the
    server crashes, if you do not have anything to limit connections.

    The solutions for this are, move all static content to a multithreaded
    HTTP server, like thttpd, and limit the Apache server simultaneous
    clients to a reasonable value that does not exhaust your RAM. This will
    protect your from eventual spikes.

    Here you find more details about this:



    --

    Regards,
    Manuel Lemos

    Metastorage - Data object relational mapping layer generator


    PHP Classes - Free ready to use OOP components written in PHP
    http://www.phpclasses.org/

    Comment

    Working...