logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in  RSS Apache Lounge  


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 2.4: localhost responses very slow
Author
severin



Joined: 04 Aug 2013
Posts: 2
Location: Czech Republic, Prague

PostPosted: Sun 04 Aug '13 11:13    Post subject: Apache 2.4: localhost responses very slow Reply with quote

Hi,
I've very slow response (from 1-2 seconds to tens of seconds) from http://localhost using Apache 2.4.3/Win32 service on Windows 8/32bit (6.2 build 9200). It doesn't depend on the browser used. Responses from all other sites are much faster.

Because it seemed to me to be a DNS issue, I tried to uncomment "127.0.0.1 localhost" and/or "::1 localhost" line in the hosts file, put "http://127.0.0.1" or "http://[::1]" instead of "http://localhost" into the browser, flushing dns by ipconfig /flushdns, stopping DNS Client by "net stop dnscache", disabling IPV6, etc. but nothing helped.

It seems that hosts file is ignored and "localhost" is passed to external DNS. Ping localhost yields to "Reply from ::1: time<1ms" response, ping 127.0.0.1 yields to expected "Reply from 127.0.0.1: bytes=32 time<1ms TTL=128" response.

Finally, "unplugging the network cable" is the only solution I've found: then the connection to localhost is much faster.

Any ideas how to get instant response when connected?

Thanks, S.
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 2761
Location: Hilversum, NL, EU

PostPosted: Sun 04 Aug '13 11:19    Post subject: Reply with quote

It is known, with the later Windows versions, when using localhost that it can give issues. Also a golden rule is use always with php, MySQL, apache etc. 127.0.0.1 instead of localhost.

Also be sure you have in your httpd.conf:

AcceptFilter http none
AcceptFilter https none
EnableSendfile off
EnableMMAP off

Steffen
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 2761
Location: Hilversum, NL, EU

PostPosted: Sun 04 Aug '13 21:53    Post subject: Reply with quote

Forget.

Are the any errors/warnings in the the Apache error.log ?

Special attention to lines like:

AH01753: access check of 'xx.xxxx.com' to xxxxx failed, reason: unable to get the remote host name

Steffen
Back to top
severin



Joined: 04 Aug 2013
Posts: 2
Location: Czech Republic, Prague

PostPosted: Tue 20 Aug '13 6:52    Post subject: solved Reply with quote

Thank you very much for your help. There are no errors/warnings in error.log, but those four options you've suggested to add to httpd.conf helped. (In fact I don't know which one of those four actually helped, but it doesn't matter.) Now localhost works much faster. Thank you.
Back to top
Lideln



Joined: 02 Jan 2014
Posts: 1
Location: France, Paris

PostPosted: Thu 02 Jan '14 15:10    Post subject: Thanks!! Reply with quote

Thank you Steffen for that fix!!

OMG it was driving me crazy! From 5 to 20 seconds for each page load, it was madness.

I searched a lot of forums and did not find anything. But thanks to your fix, not it works like a CHARM!! Smile

Thank you again, and happy new year!
Back to top
Eliptical



Joined: 10 Mar 2014
Posts: 1
Location: US, Bridgeport

PostPosted: Tue 11 Mar '14 3:18    Post subject: Reply with quote

Steffen wrote:
AcceptFilter http none
AcceptFilter https none
Thank you!

I have also have been having a very slow localhost problem. But for me it is very intermittent, like one out of every 10 or 30 accesses.

So far(time will tell for sure) the first two of these suggestions, i.e. AcceptFilter http none, ... appears to have fixed it.

It still occured with the last two in, i.e. EnableSendfile off and EnableMMAP. In other words they did NOT fix it. (I tested them one at a time.)

I had 5 browsers open at the same time. Once a page would get stuck, with the little wherlie gig spinning counter clock wise on IE for example, then all subsequent page loads, in all 5 browsers, would also hang. In other words, if IE hung on a page, then any requests on FireFox, Chrome, Opera and Safari would also hang.

The slow down I was seeing could be cleared by restarting Apache, by toggling WiFi access (either up or down), or by waiting, sometimes many minutes.

When cleared, then all browsers would suddenly get their page, including the original tab that hung (which sort of surprised me), and things would again appear as normal until the next hang.

IE seemed to be the most likely to hang. Safari and Opera either never hung, or did it so infrequently that I didn't notice. FireFox and Chrome were about half as bad as IE.


I whittled my httpd.conf down to just this and the problem still occurred:
-------------------
ServerRoot "c:/Program Files (x86)/Apache24"

LoadModule authz_core_module modules/mod_authz_core.so
LoadModule log_config_module modules/mod_log_config.so

ErrorLog "logs/error.log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t %k %D \"%r\" %>s %b" common
CustomLog "logs/access.log" common
</IfModule>

Listen 80
DocumentRoot "c:/Home/usedsoup/public_html"
ServerName http://localhost:80

-------------------
My config:
* Win7 x64 Pro - Intel Core 2 Duo
* Apache Lounge VC11 Apache 2.4.7 (Win32) OpenSSL/1.0.1e

hosts:
127.0.0.1 secure.localhost. i.localhost. localhost.
Back to top
jsgoupil



Joined: 28 Aug 2014
Posts: 1
Location: Seattle, USA

PostPosted: Thu 28 Aug '14 20:39    Post subject: Solved! but? Reply with quote

The information in this post is really important.
In my case, IE was blocking Apache for 3 minutes. Once it resolves, the other browsers were able to get their content.

It does sounds like a bug to me. I can't use 127.0.0.1 because I use multiple host URL to match different VirtualHost:
client1.localhost
client2.localhost

Those lines definitely helped
AcceptFilter http none
AcceptFilter https none

After looking into the log in debug, the only info I could find was repeated authz_core granting the requested page. But no errors.
Back to top


Reply to topic   Topic: Apache 2.4: localhost responses very slow View previous topic :: View next topic
Post new topic   Forum Index -> Apache