logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache does 6s of reads before serving a simple http request
Author
Gerbus



Joined: 29 Jan 2018
Posts: 2
Location: Canada, Vancouver

PostPosted: Tue 30 Jan '18 5:34    Post subject: Apache does 6s of reads before serving a simple http request Reply with quote

Hi there. So I've got apache (v.2.2.22 Ubuntu) serving my php sites, and I recently wrote some node webapps, and realized that node was serving up http responses way quicker than apache (I had wrongly been assuming Linode was to blame).

I ran
Code:
ps auxw | grep sbin/apache | awk '{print " -p " $2}' | xargs strace -o apache2.log

to look at what happens in apache when I send a request. In Chrome's dev tools (network), I see that the initial request for my page (http://gerbus.ca/laststand) takes about 7 seconds to receive a response.

In the strace (see http://gerbus.ca/apache2.log, I see a ton of read lines, taking about 6 seconds (from 14:19:19 to 14:19:25).

Anyone have any idea what's going on? Why so much reading for a small 8.7kb file?
Back to top
mraddi



Joined: 27 Jun 2016
Posts: 149
Location: Schömberg, Baden-Württemberg, Germany

PostPosted: Wed 31 Jan '18 0:37    Post subject: Reply with quote

Hello,

I can confirm that it takes that much time to open the mentioned URL. Sad

From the strace.log I see that it takes a lot of time to read data from the ip-address 198.103.183.67 (inter-l01.dfo-mpo.gc.ca). Cool

Why does it take so long for your application to read data from that host?
Is it that much data you have to read or is there a bandwidth-throttling (as you are doing to much requests per time-interval)?
Could you speed up things by only requesting the needed data from the remote host (instead of all data you can get) or by caching data localy and work with this data?

In addition I am wondering about the following line within the resulting HTML-code:
Code:
rootpath: "http://45.79.70.145/sites/gerbus.ca/"

What is this for? If I open this URL with a browser I only get a 404.
Back to top
Gerbus



Joined: 29 Jan 2018
Posts: 2
Location: Canada, Vancouver

PostPosted: Wed 31 Jan '18 19:07    Post subject: Reply with quote

Thanks for the quick reply.

Of course! My file is getting data from the hydrography API and doesn't send anything to the client's browser until all that data is fetched. I dialed down the default number of days of data it fetches, and told the api not to return meta data, and that go me to ~3s load time. Better, but probably what I should do is fetch the data asynchronously with javascript so the page loads immediately.

Thanks again!
Back to top


Reply to topic   Topic: Apache does 6s of reads before serving a simple http request View previous topic :: View next topic
Post new topic   Forum Index -> Apache