Closed Exanlv closed 1 year ago
@Exanlv Thanks for reporting, but I can not currently reproduce this locally: Both examples take around ~0.8s here and on a number of different hosts I've tried.
There are a large number of factors that could have an influence on this because this is currently a very broad report:
Can you provide more details about your environment and what steps you've taken to reproduce this? Can you try individual layers or do you need help with adding some debugging steps? Can you try this with other hosts, without DNS resolution, with different DNS settings, with and without HTTPS? Have you tried creating a network dump (Wireshark) to see where the time is spent?
Until we have more information, I don't think this looks like a bug at the moment, so I'll go ahead and label this as question instead. Please report back in either case 👍
@Exanlv What is your work's network set up like? Any DNS or proxying enforcements in place? This somewhat reads like an exotic bit of configuration we don't pick up for whatever reason that is biting you.
Overwriting the DNS with Google/Cloudflare fixes the poor performance.
$dnsConfig = DnsConfig::loadSystemConfigBlocking();
$dnsConfig->nameservers = [
'1.1.1.1',
'1.0.0.1',
'8.8.8.8',
'8.8.4.4',
];
$dnsFactory = (new DnsFactory())->createCached($dnsConfig);
$browser = new Browser(
new Connector([
'dns' => $dnsFactory,
])
);
Not sure what the problem is with the default DNS - how would I go about figuring out what's causing the slowdowns?
Fyi, I work remotely most of the time, so won't be able to try stuff immediately. This is also why I didn't get back to this sooner.
Overwriting the DNS with Google/Cloudflare fixes the poor performance.
$dnsConfig = DnsConfig::loadSystemConfigBlocking(); $dnsConfig->nameservers = [ '1.1.1.1', '1.0.0.1', '8.8.8.8', '8.8.4.4', ]; $dnsFactory = (new DnsFactory())->createCached($dnsConfig); $browser = new Browser( new Connector([ 'dns' => $dnsFactory, ]) );
Not sure what the problem is with the default DNS - how would I go about figuring out what's causing the slowdowns?
Interesting, can you share your resolve.conf
? The network might expect specific options to be strictly follow, or there is something in general off on that network.
Fyi, I work remotely most of the time, so won't be able to try stuff immediately. This is also why I didn't get back to this sooner.
No worries, we all have lives :).
I'm closing this for now as it hasn't received any input in a while and we can not currently reproduce this. If this problem persists, please come back with more details and we can always reopen this :+1:
Depending on network configuration, making HTTP requests can be extremely slow.
Using the code below, I compared React HTTP with Guzzle HTTP. React is far slower
This only occurs on my work's network, when doing this test on the exact same machine at home, this is not an issue. (It's about 6km of physical distance so that's negligible)
I can't get access to the router config to look around at the settings, if there's any specific configuration that you'd like to know about this network I could ask.