SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Apache - GET files / High CPU Usage

  1. #1
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Apache - GET files / High CPU Usage

    I recently purchased a VPS with 2GHz CPU, 4GB RAM, I use CMS and try to optimize the code in perfect mode, My problem is a lot of cpu usage of Apache GET, sometimes GET an image or JS or CSS consume more that 3% of cpu, How can I reduce that? what's wrong with this?
    When I have more that 100 visitor at the same time my cpu usage get to highest 90%
    here is my Apache Status while the cpu usage and load is high:
    Your kind advices is highly appreciated:


    Server Version: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.9 mod_perl/2.0.4 Perl/v5.8.8
    Server Built: Mar 10 2011 11:22:30

    Current Time: Sunday, 13-Mar-2011 18:47:55 IRST
    Restart Time: Sunday, 13-Mar-2011 18:37:42 IRST
    Parent Server Generation: 1
    Server uptime: 10 minutes 13 seconds
    Total accesses: 2472 - Total Traffic: 12.6 MB
    CPU Usage: u59.17 s8.81 cu0 cs0 - 11.1% CPU load
    4.03 requests/sec - 21.1 kB/second - 5.2 kB/request
    53 requests currently being processed, 10 idle workers

    GWWCW__WWKWWWKWKGGWKWWRWKW_RRGWWWWW_RWWWW_RKK_KC_W_WWW__KKWKWKC.
    ................................................................
    ......................

    Scoreboard Key:
    "_" Waiting for Connection, "S" Starting up, "R" Reading Request,
    "W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
    "C" Closing connection, "L" Logging, "G" Gracefully finishing,
    "I" Idle cleanup of worker, "." Open slot with no current process

    Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request
    0-0 20080 0/22/54 G 3.98 324 0 0.0 0.07 0.24 178.252.142.1 zoomit.ir GET /images/stories/news/IT_news/japan-earthquick.jpg HTTP/1.1
    1-1 19577 1/1/116 W 1.93 78 0 0.0 0.00 0.53 86.57.52.198 zoomit.ir GET /index.php?start=33 HTTP/1.1
    2-1 28508 0/0/110 W 3.71 5 0 0.0 0.00 0.75 90.56.202.118 zoomit.ir OPTIONS /index.php?tmpl=component&option=com_jacomment&view=com
    3-1 28374 2/2/99 C 0.00 1 0 0.6 0.00 0.54 78.109.196.10 zoomit.ir GET /components/com_k2/images/social/delicious_16.png HTTP/1.1
    4-1 19769 0/2/118 W 2.62 47 0 0.0 0.00 0.77 205.185.113.185 zoomit.ir GET /user HTTP/1.1
    5-1 7647 0/29/78 _ 3.01 0 0 0.0 0.05 0.36 65.49.14.58 zoomit.ir GET /components/com_jomcomment/templates/default/images/topshad
    6-1 27855 0/6/143 _ 0.00 0 1 0.0 0.03 0.49 188.158.139.254 zoomit.ir GET /templates/rt_tachyon_j15/images/header/dark/header-bottom.
    7-1 5686 1/11/77 W 2.10 78 0 0.0 0.07 0.36 86.57.52.198 zoomit.ir GET /it-news/internet-network/item/478-microsoft-counts-down-to
    8-1 3154 0/14/85 W 3.49 171 0 0.0 0.04 0.32 85.185.82.97 zoomit.ir GET /images/stories/news/Black-V20.jpg HTTP/1.1
    9-1 19833 2/4/44 K 3.28 1 0 2.9 0.00 0.19 85.185.82.97 zoomit.ir GET /media/k2/items/cache/c1a11e28afb03c9d81c096faa0a5ce8e_S.jp
    10-1 19983 2/2/86 W 3.10 1 0 0.0 0.00 0.46 205.185.113.185 zoomit.ir GET /buying-guide HTTP/1.1
    11-1 3211 0/11/70 W 0.49 109 0 0.0 0.15 0.60 86.57.52.198 zoomit.ir GET /index.php?start=44 HTTP/1.1
    12-1 15650 0/1/66 W 0.00 144 0 0.0 0.00 0.33 91.99.145.83 zoomit.ir GET /images/stories/news/IT_news/japan-earthquick.jpg HTTP/1.1
    13-1 19985 3/11/68 K 0.18 2 0 23.2 0.07 0.41 188.158.139.254 zoomit.ir GET /templates/rt_tachyon_j15/images/header/dark/menu-active.pn
    14-1 9432 0/0/74 W 0.00 181 0 0.0 0.00 0.44 2.179.82.111 zoomit.ir GET /media/k2/items/cache/4fcf9d660236ddb62c8456017158615a_Gene
    15-1 20043 3/3/56 K 2.89 1 206 23.5 0.02 0.24 86.57.52.198 zoomit.ir GET /media/k2/items/cache/0fcccca5b510e5bb86a94045046d252d_S.jp
    16-0 10015 5/9/24 G 0.31 449 0 46.9 0.06 0.13 46.100.169.100 zoomit.ir GET /media/system/js/mootools.js HTTP/1.1
    17-0 30673 0/3/18 G 1.10 259 0 0.0 0.01 0.15 85.198.19.210 zoomit.ir GET /media/k2/items/cache/218fa54275e0e31c37b4e5091d9112ba_L.jp
    18-1 20052 2/2/29 W 0.00 107 0 77.4 0.08 0.23 86.57.52.198 zoomit.ir GET /index.php?start=99 HTTP/1.1
    19-1 28528 1/1/62 K 0.00 0 4512 0.5 0.00 0.41 65.49.14.58 zoomit.ir GET /templates/rt_tachyon_j15/images/accents/orange/body-rokinp
    20-1 20324 2/5/39 W 1.75 0 0 7.2 0.01 0.12 205.185.113.185 zoomit.ir GET /user/register-login-logout HTTP/1.1
    21-1 9455 0/12/36 W 3.15 95 0 0.0 0.04 0.18 2.179.82.111 zoomit.ir GET /articles/video-audio/television/item/31-%D8%AD%D9%82%D8%A7
    22-1 2041 0/20/98 R 0.33 158 82 0.0 0.11 0.33 ? ? ..reading..
    23-1 24559 0/0/62 W 0.47 69 0 0.0 0.00 0.38 66.249.72.228 zoomit.ir GET /articles/hardware-news/hardware-others/item/index.php?opti
    24-1 27864 2/4/114 K 0.00 2 42 0.6 0.00 0.52 65.49.14.58 zoomit.ir GET /templates/rt_tachyon_j15/images/body/module-gradient2.png
    25-1 20337 0/6/86 W 1.78 11 0 0.0 0.04 0.27 79.127.30.234 zoomit.ir GET /it-news/item/486-incredible-japan-earthquick-skycraft HTTP
    26-1 5572 0/32/78 _ 0.69 0 1 0.0 0.17 0.35 188.158.139.254 zoomit.ir GET /templates/rt_tachyon_j15/images/accents/blue/pill-r.png HT
    27-1 9457 0/2/10 R 1.43 159 0 0.0 0.00 0.05 ? ? ..reading..
    28-1 5600 0/1/36 R 0.00 158 54170 0.0 0.03 0.32 ? ? ..reading..
    29-0 14274 0/6/34 G 0.28 322 0 0.0 0.03 0.24 85.198.19.210 zoomit.ir GET /images/stories/news/tv/lg2011table-1l.jpg HTTP/1.1
    30-1 9458 1/13/38 W 3.02 44 0 21.2 0.06 0.19 95.38.50.71 zoomit.ir GET /media/system/js/mootools.js HTTP/1.1
    31-1 20339 1/1/54 W 2.88 1 0 16.4 0.02 0.32 86.57.52.198 zoomit.ir GET /index.php?start=66 HTTP/1.1
    32-1 5612 1/2/4 W 0.00 183 0 0.0 0.02 0.02 91.99.189.84 zoomit.ir GET /media/system/js/mootools.js HTTP/1.1
    33-1 28529 0/0/7 W 0.00 1 0 0.0 0.00 0.05 209.85.224.91 zoomit.ir GET /home?format=feed HTTP/1.1
    34-1 15696 3/10/15 W 1.73 102 0 1.8 0.04 0.06 86.57.52.198 zoomit.ir GET /index.php?start=88 HTTP/1.1
    35-1 20340 0/7/24 _ 0.23 0 1 0.0 0.07 0.11 188.158.139.254 zoomit.ir GET /media/k2/items/cache/051a22dde3b372e5c058fbc303756df4_L.jp
    36-1 5650 0/8/9 R 0.09 160 232 0.0 0.07 0.09 ? ? ..reading..
    37-1 20419 0/5/10 W 0.15 10 0 0.0 0.02 0.03 205.185.113.185 zoomit.ir GET /user/groups HTTP/1.1
    38-1 15699 14/30/36 W 3.78 3 0 156.2 0.18 0.20 86.57.52.198 zoomit.ir GET /index.php?option=com_jomcomment&no_html=1&task=img&jc_sid=
    39-1 28533 0/0/32 W 4.04 1 0 0.0 0.00 0.05 94.183.58.254 zoomit.ir GET /index2.php?option=com_jomcomment&task=userinfo&no_html=1 H
    40-1 20425 0/3/26 W 0.00 33 0 0.0 0.04 0.22 109.162.139.198 zoomit.ir GET /it-news/item/486-incredible-japan-earthquick-skycraft HTTP
    41-1 15701 0/27/30 _ 1.67 0 0 0.0 0.14 0.15 188.158.139.254 zoomit.ir GET /templates/rt_tachyon_j15/images/logo/dark/logo.png HTTP/1.
    42-1 5742 0/16/16 R 1.43 153 2636 0.0 0.06 0.06 ? ? ..reading..
    43-1 28534 1/1/8 K 0.00 0 437 0.5 0.00 0.04 78.109.196.10 zoomit.ir GET /components/com_k2/images/social/facebook_16.png HTTP/1.1
    44-1 15702 2/11/11 K 0.18 1 0 3.1 0.09 0.09 85.185.82.97 zoomit.ir GET /media/k2/items/cache/f0ba2bfd8f936a77d3b146acfe9443c7_S.jp
    45-1 28535 0/0/4 _ 0.32 5 6543 0.0 0.00 0.02 127.0.0.1 vps-1039725-2926.manage.myhosti OPTIONS * HTTP/1.0
    46-1 27867 2/4/6 K 0.00 0 0 4.9 0.01 0.01 85.185.82.97 zoomit.ir GET /media/k2/items/cache/218fa54275e0e31c37b4e5091d9112ba_S.jp
    47-1 25632 2/5/5 C 1.53 0 0 5.8 0.01 0.01 65.49.14.58 zoomit.ir GET /components/com_jomcomment/smilies/buttons.gif HTTP/1.0
    48-1 25633 0/10/10 _ 0.00 3 9145 0.0 0.02 0.02 127.0.0.1 vps-1039725-2926.manage.myhosti OPTIONS * HTTP/1.0
    49-1 28536 0/0/7 W 0.00 0 0 0.0 0.00 0.04 127.0.0.1 vps-1039725-2926.manage.myhosti GET /whm-server-status HTTP/1.1
    50-1 26225 0/7/7 _ 0.00 0 1 0.0 0.08 0.08 188.158.139.254 zoomit.ir GET /templates/rt_tachyon_j15/images/body/body-bg.png HTTP/1.1
    51-1 26231 1/3/3 W 1.49 1 0 0.0 0.00 0.00 205.185.113.185 zoomit.ir GET / HTTP/1.1
    52-1 26232 1/3/3 W 1.57 2 0 0.0 0.01 0.01 205.185.113.185 zoomit.ir GET /user/friend-list HTTP/1.1
    53-1 26243 0/3/3 W 0.00 35 0 0.0 0.01 0.01 84.241.27.77 zoomit.ir GET /it-news/item/486-incredible-japan-earthquick-skycraft HTTP
    54-1 26245 0/3/3 _ 1.50 0 6731 0.0 0.00 0.00 90.56.202.118 zoomit.ir GET /templates/rt_tachyon_j15/favicon.ico HTTP/1.1
    55-1 26246 0/2/2 _ 0.15 2 15170 0.0 0.01 0.01 85.133.192.17 zoomit.ir GET /images/stories/news/weblinks/wechoosethemoon_sm.jpg HTTP/1
    56-1 26255 1/4/4 K 0.15 0 10419 0.3 0.01 0.01 65.49.14.58 zoomit.ir GET /index.php?option=com_jomcomment&no_html=1&task=img&jc_sid=
    57-1 26279 2/6/6 K 0.00 1 1 0.6 0.01 0.01 65.49.14.58 zoomit.ir GET /templates/rt_tachyon_j15/images/body/light-div.png HTTP/1.
    58-1 26318 0/0/0 W 0.00 48 0 0.0 0.00 0.00 95.38.50.71 zoomit.ir GET /components/com_k2/css/k2.css HTTP/1.1
    59-1 26319 4/9/9 K 0.00 0 561 11.7 0.02 0.02 86.57.52.198 zoomit.ir GET /media/k2/items/cache/69b5f85da08d181d48515c6d41e3e0a5_S.jp
    60-1 27879 0/0/0 W 0.00 29 0 0.0 0.00 0.00 80.191.91.25 zoomit.ir GET / HTTP/1.1
    61-1 27880 3/4/4 K 0.00 1 346 8.5 0.01 0.01 86.57.52.198 zoomit.ir GET /media/k2/items/cache/3b44b5000d3ada04c028c395cd05cbfb_S.jp
    62-1 27881 2/5/5 C 0.00 0 42 1.8 0.00 0.00 65.49.14.58 zoomit.ir GET /templates/rt_tachyon_j15/images/accents/orange/rtl/newspag
    63-1 - 0/0/1 . 0.00 16 7513 0.0 0.00 0.00 127.0.0.1
    Srv Child Server number - generation
    PID OS process ID
    Acc Number of accesses this connection / this child / this slot
    M Mode of operation
    CPU CPU usage, number of seconds
    SS Seconds since beginning of most recent request
    Req Milliseconds required to process most recent request
    Conn Kilobytes transferred this connection
    Child Megabytes transferred this child
    Slot Total megabytes transferred this slot
    SSL/TLS Session Cache Status:
    cache type: DBM, maximum size: unlimited
    current sessions: 0, current size: 0 bytes
    average session size: 0 bytes

  2. #2
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    When this happens what does your server say about the CPU load overall? Specifically what does it say about I/O Wait state? top, iostat, vmstat are 3 tools you can use to get this info.

    Thanks,
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting :: From £250/m
    Personal Web Hosting :: Budget Web Hosting :: From £50/y
    Call 0800 542 9764 today and ask about our Cloud Hosting Platform

  3. #3
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Karl View Post
    Hi,

    When this happens what does your server say about the CPU load overall? Specifically what does it say about I/O Wait state? top, iostat, vmstat are 3 tools you can use to get this info.

    Thanks,


    Thank you for your reply

    You can find Apache, PS and VMStats enclosed to my post. you would probably find a reason of cpu usage of get file.

    I can not understand why apache should consume a lot of usage to GET a small jpg file.
    Attached Files

  4. #4
    SitePoint Guru prequel's Avatar
    Join Date
    Nov 1999
    Location
    Brisbane, Australia
    Posts
    680
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Probably best thing to do is get rid of apache for serving static files by putting something like nginx as a reverse proxy to apache. Or move static files off to cdn service.

  5. #5
    ¬.¬ shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    8,990
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    ...I'm sorry but there is no problem here. Have you even touched 100% of the CPU yet?
    Until the CPU is taxed beyond control, I mean deadlocked. DO NOT FUSS OVER IT.

    Servers are designed to run and be used, pushed to there very limits.
    Servers are not little collectible toys that need to be guarded in shrinkwrap.

    If you are so concerned. Turn off some of Apache extensions. The ones you are not using.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


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
  •