Poor Initial Connect Time

Discussion in 'PHP' started by XN-Matt, Mar 10, 2017.

  1. XN-Matt

    XN-Matt Well-Known Member

    Hi,

    We're seeing some really poor initial connect times. Have tried all methods of PHP (using lsapi/PHP via cPanels repo and Easy Apache 4).

    Subsequent loads are good, just the initial.

    Have unrestricted the user in CL giving all CPU/Memory as needed but no change there either.

    Any initial suggestions. Have reverted the PHP handler back to defaults for now.
     
  2. NiteWave

    NiteWave Administrator

    we have received another user report: a wordpress site is slow to access for first time, but much faster for subsequent visits.
    after investigating in Chrome browser, it's because of initial connection and SSL handshaking takes long time. after a http 2.0 connection set up, the website becomes much faster. this is mainly a network issue, not relating to php or web server. in this case, you can test a plain simple http page(non SSL), to see if it becomes much faster.
    another factor may be the homepage size is big and take long time to generate. in this case, the web server may wait for backend php to generate the whole page and cause the slowness.
     
  3. XN-Matt

    XN-Matt Well-Known Member

    It does appear to be PHP related but having compared Nginx with PHP-FPM and Litespeed, we only see the issue with the latter.

    I think I have correlated it to the PHP process having to start up and although have tried altering the settings to keep this "alive", it appears this does not work that well at all. Once the PHP process dies, it takes just as long on the next attempt (i.e set to 10 seconds, any requests after that will take just as long as the first).
     
  4. NiteWave

    NiteWave Administrator

  5. XN-Matt

    XN-Matt Well-Known Member

    Daemon mode has helped overall. First connection is lower, where as others are little higher.

    Is there any benefit of having more Instances or increasing Max Idle Time in such mode?
     
  6. NiteWave

    NiteWave Administrator

    maybe don't change Instances setting, but you can try "Max Idle Time" to see any difference.
     
  7. XN-Matt

    XN-Matt Well-Known Member

    Will play with that.

    I note that in the docs it states that Deamon mode does not work with CloudLinux PHP selector. What about cPanel native PHP version control?
     
  8. Pong

    Pong Well-Known Member Staff Member

    You can try it.
     

Share This Page