Sometimes webrequest takes 3-5 seconds ??

Discussion in 'Linux Support: RHEL, CentOS, SUSE etc' started by enthess, Apr 5, 2016.

  1. enthess

    enthess Member


    I am building an REST API with OLS and PHP, its pretty clean at the moment and very rapid for the most.

    But sometimes, usually when establishing a connection from a new computer, it takes about 3-5 seconds for the server to respond. I dont know if there's some settings that could help me fix this ?
  2. lsfoo

    lsfoo Administrator

    Hi enthess,

    Could you provide some more information about the situation?

    Is it an http request or https? If https, are you using HTTP/2?

    What kind of page are you accessing? If you use the web console in your preferred browser, which part of the page is taking the longest?
  3. enthess

    enthess Member


    Ofcourse, ill give you all the info you need! :)

    Its an HTTP-GET Request.
    Its a simple RESTAPI-Page which returns data in JSON ( /api/item/1 for example ).

    It's only the _first_ time, and at this time it was through mozilla firefox. But i have seen it from Curl too.
    I didnt think of displaying the request-response time sadly in my web console.

    But, it felt like OLS was waking up from its nightsleep -> fired up an php instance -> did what it was supposed to do -> gave me the response...

    Dont know if this could be the case, it just felt like it, it could also be my broadband connection or something else. But, i would like to not hear questions from future beta-testers "Sometimes it takes 3-4 seconds before i get my items, why?", if you understand me? :).

    But during the day when i have been developing and constantly sending requests to it, it has functioned without problem. And really quick too.
  4. lsfoo

    lsfoo Administrator

    Hi enthess,

    What you are describing may be because of DNS lookup.

    When you have a chance, before you make the first request you should open the web console. When you make the request, you can check the timing of the request.

    What you're looking for is the color distribution of the request. In chrome, I can view the timing of the individual portions of the request (attached image).

    Let me know the timings you see.


    Attached Files:

  5. enthess

    enthess Member

    Absolutely, if this occurs again, i know where to look!

    Thanks !

Share This Page