server slow response time

Discussion in 'Installation/Configuration' started by brody182, Jul 22, 2018.

  1. brody182

    brody182 Member

    The wait time in Pingdom is very slow response time. Is there a way to check?
    Generally, anything under 100 ms is acceptable and good TTFB. In my case I am approaching the 300-400 ms range I might have something misconfigured on my server
    waitTime.png
     
  2. ztk.me

    ztk.me ISPConfig Developer ISPConfig Developer

    The issue is, the browser does not utilitize one connection to get them (almost) all. That's why your "Web browser is connecting to the server and Web browser is waiting for data from the server" time might be a bit high each time.

    It does fire up to 8 or 10 connections when it knows what to fetch, but it could do that much sooner and could fetch much more at once.

    Use http2 to send multiple files over one lane:
    Code:
        Header add Link "</css/styles.css>; rel=preload; as=style"
        Header add Link "</js/scripts.js>; rel=preload; as=script"
    
    
    there are more options available.

    You can use dynamic languages and smart caching headers to leave out the link headers on some (most) requests.
    https://tools.ietf.org/html/draft-ietf-httpbis-cache-digest-02 soon


    Edit: oh yeah, this brings mpm_worker ( please only event if you have backported newer apache, I assume its your debian 9 box ) leaves out mod_php mpm_prefork which boosts your stats on its own already.

    https://de.wordpress.org/plugins/http2-server-push/
    https://extensions.joomla.org/extension/http-2-server-push/
    https://extensions.typo3.org/extension/http2_push/
    https://github.com/terminal42/contao-http2
    https://www.drupal.org/project/http2_server_push
     
    Last edited: Jul 22, 2018
    Jesse Norell likes this.
  3. brody182

    brody182 Member

    does css and js need to be in the /js/ and /css/ directory?
    can I do without it?
     
  4. ztk.me

    ztk.me ISPConfig Developer ISPConfig Developer

    it is just an example, you can of course put them into root directory and use
    Code:
        Header add Link "</otherstyles.css>; rel=preload; as=style"
        Header add Link "</yet/otherstyle.css>; rel=preload; as=style"
        Header add Link "</dist/generated.css>; rel=preload; as=style"
    
    as long as they match the referenced path in your document.

    You could set a session-cookie with a specific name depending on your (sub)resources and send headers based on that :
    Code:
    SetEnvIf PUSH_MAIN ^ PUSH_MAIN
    SetEnvIf Cookie "(^|;\s*)pushmaincss=no($|\s*;)" !PUSH_MAIN
    Header add Link "</main.css>; rel=preload; as=style" env=PUSH_MAIN
    Header add Link "</main.js>; rel=preload; as=script" env=PUSH_MAIN
    Header add Link: </logo.png>; rel=preload; as=image; env=PUSH_MAIN
    
    
    https://www.w3.org/TR/preload/
     
    Last edited: Jul 22, 2018
  5. brody182

    brody182 Member

  6. ztk.me

    ztk.me ISPConfig Developer ISPConfig Developer

    Last edited: Jul 23, 2018
    Jesse Norell likes this.
  7. ztk.me

    ztk.me ISPConfig Developer ISPConfig Developer

    Also enable zend opcode if you use php and not done already
    Code:
    opcache.enable=1
    opcache.use_cwd=1
    opcache.validate_timestamps=1
    opcache.revalidate_freq=2
    opcache.save_comments=1
    opcache.load_comments=1
    
    and if PHP prior 7.0.16 and 7.1.2
    Code:
    realpath_cache_size = "4M"
    
     
  8. brody182

    brody182 Member

    I see duplicates in the Response Headers
    is "Header set Link" better?
    Code:
        Header add Link "</otherstyles.css>; rel=preload; as=style"
       Header add Link "</yet/otherstyle.css>; rel=preload; as=style"
       Header add Link "</dist/generated.css>; rel=preload; as=style"
    
     
  9. brody182

    brody182 Member

    Also I need the Link Headers to work with all websites, ( wordpress, drupal, etc )
     
  10. ztk.me

    ztk.me ISPConfig Developer ISPConfig Developer

    duplicates? https://tools.ietf.org/html/rfc5988#section-5.5 you can link multiple same kind resources together, however you might have some link headers, that's not bad, just try to keep the request / response small but efficient.

    If you need them to work with all websites... well that's not my job :) Everything there to help you make it
     

Share This Page