The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Very Slow site 99% CPU consumed via PHP

Discussion in 'Workarounds and Optimization' started by evilopinions, Jan 31, 2012.

  1. evilopinions

    evilopinions Member

    Joined:
    Jan 31, 2012
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I have been doing some reading and there are a couple of excellent help threads , however my issue is probably different then most others so just trying to get some help here.

    Using Easyapache compiled

    Eaccelerator .9.6
    Zend optimizer
    Ion cube loader

    Here is my /http://htmlstudios.com/text.php

    Eaccelerator caching is false and also optimize is set to false in phpinfo

    However in my php.ini file everything is set to true.

    Also when I do php -v on the server

    I get

    PHP 5.2.17 (cli) (built: Feb 1 2012 10:02:44)
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

    My single product pages on wordpress are way too slow and cpu consumption is as high as 99%.

    Here is the top command

    25779 htmlstud 21 0 210m 100m 7812 R 99.5 9.8 0:05.29 php
    1 root 18 0 10308 728 608 S 0.0 0.1 0:03.63 init
    14242 root 15 -4 12576 672 356 S 0.0 0.1 0:00.00 udevd
    15458 root 18 0 38860 620 488 S 0.0 0.1 0:00.00 brcm_iscsiuio
    15822 root 18 0 93368 6180 2944 S 0.0 0.6 0:00.04 httpd
    15844 root 18 0 92164 3716 2976 S 0.0 0.4 0:00.03 sshd
    15909 root 15 0 48680 8224 2376 S 0.0 0.8 0:00.07 leechprotect

    I think php is not able to use an accelerator and thus using 99.9 % cpu.

    Any help would be great.
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    What is your PHP handler?

    Code:
    /usr/local/cpanel/bin/rebuild_phpconf --current
    If it shows up as either suPHP or CGI, that explains why EAccelerator isn't working because neither can use OPCode Caching modules. You will either need to switch to DSO or FCGI for EAccelerator to work. Yes, you can compile in EAccelerator and it will show up as existing, but you cannot actually use it under suPHP or CGI.
     
  3. evilopinions

    evilopinions Member

    Joined:
    Jan 31, 2012
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Ok. I was using SUPHP.

    Recompiled.Turned over to cgi/Fcgi and it seems Xcache has now been installed and available for use in w3 total cache.

    According to one of the other threads I have also changed from prefork to MPM worker.
    I have seen a little improvement in performance. However the consumption for PHP still reaches 70-80% on a page load for a single user.
     
  4. alphawolf50

    alphawolf50 Well-Known Member

    Joined:
    Apr 28, 2011
    Messages:
    186
    Likes Received:
    2
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    What are your server specs? (# cpu cores, memory, RAID level, etc)

    You should remove the phpinfo file from your server -- you're handing out way too much information to anyone who might want to attack your system.

    PHP shouldn't normally use 70-80% for regular scripts. That's a sign of poorly written code or excessive use of Wordpress plugins. If the domain is htmlstudios, one thing I can say for sure is that it needs the help of a professional web developer. The home page loads 28 scripts and 15 style sheets, loads content from something like 8 different domains, and the total content is over 1MB when uncompressed. Those factors would make the site slow even if PHP weren't having issues. Try to get rid of as many Wordpress plugins and extra content as possible.
     
  5. evilopinions

    evilopinions Member

    Joined:
    Jan 31, 2012
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi Alphawolf50.

    Thanks you for the comments. We are getting rid of all the JS and CSS we do not require. We are also using cloudflare to speed up and have installed xcache for opcode cache.

    I appreciate your observations , however due to limited resources I must work on the existing site.

    Having said that - here are the specs


    Here is the link to the product - /http://www.web24.com.au/cPanelVPS/221/AboutCpanel.html

    CPU

    Code:
    processor       : 7
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 26
    model name      : Intel(R) Xeon(R) CPU           E5530  @ 2.40GHz
    stepping        : 5
    cpu MHz         : 2000.125
    cache size      : 8192 KB
    physical id     : 1
    siblings        : 8
    core id         : 3
    cpu cores       : 4
    apicid          : 22
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 11
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc nonstop_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm
    bogomips        : 3999.57
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 40 bits physical, 48 bits virtual
    power management: [8]
    
    processor       : 8
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 26
    model name      : Intel(R) Xeon(R) CPU           E5530  @ 2.40GHz
    stepping        : 5
    cpu MHz         : 2000.125
    cache size      : 8192 KB
    physical id     : 0
    siblings        : 8
    core id         : 0
    cpu cores       : 4
    apicid          : 1
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 11
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc nonstop_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm
    bogomips        : 3999.62
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 40 bits physical, 48 bits virtual
    power management: [8]
    
    processor       : 9
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 26
    model name      : Intel(R) Xeon(R) CPU           E5530  @ 2.40GHz
    stepping        : 5
    cpu MHz         : 2000.125
    cache size      : 8192 KB
    physical id     : 0
    siblings        : 8
    core id         : 1
    cpu cores       : 4
    apicid          : 3
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 11
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc nonstop_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm
    bogomips        : 3999.57
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 40 bits physical, 48 bits virtual
    power management: [8]
    
    processor       : 10
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 26
    model name      : Intel(R) Xeon(R) CPU           E5530  @ 2.40GHz
    stepping        : 5
    cpu MHz         : 2000.125
    cache size      : 8192 KB
    physical id     : 0
    siblings        : 8
    core id         : 2
    cpu cores       : 4
    apicid          : 5
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 11
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc nonstop_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm
    bogomips        : 3999.63
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 40 bits physical, 48 bits virtual
    power management: [8]
    
    processor       : 11
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 26
    model name      : Intel(R) Xeon(R) CPU           E5530  @ 2.40GHz
    stepping        : 5
    cpu MHz         : 2000.125
    cache size      : 8192 KB
    physical id     : 0
    siblings        : 8
    core id         : 3
    cpu cores       : 4
    apicid          : 7
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 11
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc nonstop_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm
    bogomips        : 3999.57
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 40 bits physical, 48 bits virtual
    power management: [8]
    
    processor       : 12
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 26
    model name      : Intel(R) Xeon(R) CPU           E5530  @ 2.40GHz
    stepping        : 5
    cpu MHz         : 2000.125
    cache size      : 8192 KB
    physical id     : 1
    siblings        : 8
    core id         : 0
    cpu cores       : 4
    apicid          : 17
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 11
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc nonstop_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm
    bogomips        : 3999.63
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 40 bits physical, 48 bits virtual
    power management: [8]
    
    processor       : 13
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 26
    model name      : Intel(R) Xeon(R) CPU           E5530  @ 2.40GHz
    stepping        : 5
    cpu MHz         : 2000.125
    cache size      : 8192 KB
    physical id     : 1
    siblings        : 8
    core id         : 1
    cpu cores       : 4
    apicid          : 19
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 11
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc nonstop_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm
    bogomips        : 3999.60
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 40 bits physical, 48 bits virtual
    power management: [8]
    
    processor       : 14
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 26
    model name      : Intel(R) Xeon(R) CPU           E5530  @ 2.40GHz
    stepping        : 5
    cpu MHz         : 2000.125
    cache size      : 8192 KB
    physical id     : 1
    siblings        : 8
    core id         : 2
    cpu cores       : 4
    apicid          : 21
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 11
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc nonstop_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm
    bogomips        : 3999.56
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 40 bits physical, 48 bits virtual
    power management: [8]
    
    processor       : 15
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 26
    model name      : Intel(R) Xeon(R) CPU           E5530  @ 2.40GHz
    stepping        : 5
    cpu MHz         : 2000.125
    cache size      : 8192 KB
    physical id     : 1
    siblings        : 8
    core id         : 3
    cpu cores       : 4
    apicid          : 23
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 11
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc nonstop_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm
    bogomips        : 3999.57
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 40 bits physical, 48 bits virtual
    power management: [8]
    
    Free
    Code:
               total       used       free     shared    buffers     cached
    Mem:       1048576     467128     581448          0          0          0
    -/+ buffers/cache:     467128     581448
    Swap:            0          0          0
    
    Mem Info
    Code:
    MemTotal:      1048576 kB
    MemFree:        581432 kB
    Buffers:             0 kB
    Cached:              0 kB
    SwapCached:          0 kB
    Active:              0 kB
    Inactive:            0 kB
    HighTotal:           0 kB
    HighFree:            0 kB
    LowTotal:      1048576 kB
    LowFree:        581432 kB
    SwapTotal:           0 kB
    SwapFree:            0 kB
    Dirty:               0 kB
    Writeback:           0 kB
    AnonPages:           0 kB
    Mapped:         467144 kB
    Slab:                0 kB
    PageTables:          0 kB
    NFS_Unstable:        0 kB
    Bounce:              0 kB
    CommitLimit:         0 kB
    Committed_AS:  2131536 kB
    VmallocTotal:        0 kB
    VmallocUsed:         0 kB
    VmallocChunk:        0 kB
    HugePages_Total:     0
    HugePages_Free:      0
    HugePages_Rsvd:      0
    Hugepagesize:     2048 kB
    
    Code:
    df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/vzfs              15G  5.4G  9.7G  36% /
    none                  512M  4.0K  512M   1% /dev
    none                  512M     0  512M   0% /var/tmpfs
    
    I hope this info is sufficient.

    From My SQL

    Code:
    Variable_name	Value
    Qcache_free_blocks	75
    Qcache_free_memory	283416
    Qcache_hits	74445
    Qcache_inserts	11061
    Qcache_lowmem_prunes	1964
    Qcache_not_cached	399
    Qcache_queries_in_cache	467
    Qcache_total_blocks	1029
    I know the my.cnf is way too much and needs to be rewritten or optimized. Any help there would be great too.
    Code:
    -------- General Statistics --------------------------------------------------
    [--] Skipped version check for MySQLTuner script
    [OK] Currently running supported MySQL version 5.1.56-log
    [OK] Operating on 64-bit architecture
    
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
    [--] Data in MyISAM tables: 3M (Tables: 74)
    [--] Data in InnoDB tables: 224M (Tables: 21)
    [!!] Total fragmented tables: 22
    
    -------- Security Recommendations  -------------------------------------------
    [OK] All database users have passwords assigned
    
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 2h 3m 42s (95K q [12.934 qps], 1K conn, TX: 208M, RX: 26M)
    [--] Reads / Writes: 83% / 17%
    [--] Total buffers: 107.0M global + 56.2M per thread (500 max threads)
    [!!] Maximum possible memory usage: 27.6G (2757% of installed RAM)
    [OK] Slow queries: 0% (231/95K)
    [OK] Highest usage of available connections: 1% (6/500)
    [OK] Key buffer size / total MyISAM indexes: 32.0M/1.9M
    [OK] Key buffer hit rate: 99.9% (175K cached / 106 reads)
    [OK] Query cache efficiency: 82.5% (74K cached / 90K selects)
    [!!] Query cache prunes per day: 22863
    [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 3K sorts)
    [!!] Temporary tables created on disk: 48% (2K on disk / 4K total)
    [OK] Thread cache hit rate: 99% (6 created / 1K connections)
    [OK] Table cache hit rate: 94% (123 open / 130 opened)
    [OK] Open file limit used: 2% (199/8K)
    [OK] Table locks acquired immediately: 100% (25K immediate / 25K locks)
    [!!] InnoDB data size / buffer pool: 224.1M/8.0M
    
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Run OPTIMIZE TABLE to defragment tables for better performance
        MySQL started within last 24 hours - recommendations may be inaccurate
        Reduce your overall MySQL memory footprint for system stability
        When making adjustments, make tmp_table_size/max_heap_table_size equal
        Reduce your SELECT DISTINCT queries without LIMIT clauses
    Variables to adjust:
      *** MySQL's maximum memory usage is dangerously high ***
      *** Add RAM before increasing MySQL buffer variables ***
        query_cache_size (> 976K)
        tmp_table_size (> 256M)
        max_heap_table_size (> 64M)
        innodb_buffer_pool_size (>= 224M)
    My.cnf
    Code:
    [mysqld]
    local-infile=0
    #skip-networking
    safe-show-database
    table_lock_wait_timeout=2
    query_cache_limit=2M
    query_cache_size=64M ## 32MB for every 1GB of RAM
    query_cache_type=1
    max_user_connections=300
    max_connections=500
    interactive_timeout=10
    wait_timeout=30
    connect_timeout=20
    tmp_table_size=256M
    max_heap_table_size=64M
    thread_cache_size=64
    key_buffer=384M ## 128MB for every 1GB of RAM
    join_buffer=3M
    max_connect_errors=20
    max_allowed_packet=32M
    table_cache=1024
    record_buffer=1M
    sort_buffer_size=2M ## 1MB for every 1GB of RAM
    read_buffer_size=2M ## 1MB for every 1GB of RAM
    read_rnd_buffer_size=8M ## 1MB for every 1GB of RAM
    thread_concurrency=8 ## Number of CPUs x 2
    myisam_sort_buffer_size=64M
    server-id=1
    set-variable=local-infile=0
    
     
Loading...

Share This Page