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.

cPanel server performance optimization

Discussion in 'Workarounds and Optimization' started by joomla, Sep 25, 2014.

  1. joomla

    joomla Well-Known Member

    Jul 23, 2014
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator

    I set server by using Igor Seletskiy blog, where he describes how fcgid and opcode cachers works. I will citate:

    Lets first explore how mod_fcgid works:
    When request comes in for PHP, mod_fcgid checks if there is idle php process available for that user. If there is none, it starts a new one (up to FCGIDMaxProcessesPerClass, default 100). The request is served, and php process becomes idle. Until next request comes in.

    Lets now add opcode caching, like eAccelerator, APC or xCache. Opcode caching software saves opcode (php pre-compiled into "operation code" ) into shared memory. Next time it has to process same PHP file, PHP process would not compile php, using opcode from cache instead.That will significantly decreasing CPU usage, and improving performance.

    PHP processes with opcode cache enabled use shared memory for opcode caching. Yet, PHP processes will be able to "share" that shared memory, only if they were all created (forked) from the same, original PHP process, that allocated that shared memory.

    This is not the case with mod_fcgid, as each and every PHP process is started by mod_fcgid itself. As the result, they don't "share" shared memory. In this case. each PHP process has its own shared memory, amd no opcode is shared between processes.

    So, if process A is responding for request for index.php, and process B is responding to request for index.php, each of them will store its own copy of opcode in its own cache.

    Yet, on the second request for index.php to process A, that process can use cached opcode. Gven that single PHP process can process thousands of requests -- opcode caching is useful with mod_fcgid.

    Here are all clear. I choosed fastcgi and eaccelerator and set values.

    But I included mod_expire settings and mod_deflate settings for all server accounts by using Pre virtual host include, global conf. This settings are as follow:

    # Cache Control Settings for one hour cache
    <FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    Header set Cache-Control "max-age=3600, public"

    <FilesMatch ".(xml|txt)$">
    Header set Cache-Control "max-age=3600, public, must-revalidate"

    <FilesMatch ".(html|htm)$">
    Header set Cache-Control "max-age=3600, must-revalidate"

    # Mod Deflate performs data compression
    <IfModule mod_deflate.c>
    <FilesMatch ".(js|css|html|php|xml|jpg|png|gif)$">
    SetOutputFilter DEFLATE
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4.0[678] no-gzip
    BrowserMatch bMSIE no-gzip

    I understand how fastcgi and eaccelerator works. But, is not clear to me how mod expire and mod deflate interact with these settings. Does mod expire and mod deflate I set globally could speed down Web pages load in some cases, or break fastcgi and eaccelerator to work properly.

    After first request for example index.php and fcgid proces, and after second request for index.php and eaccelerator proces, how mod_expire and mod_deflate interact in this combination.

    Many thank you for your time and wish to help me! :)
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator

Share This Page