Skip to content

Conversation

@BillyONeal
Copy link
Member

This commit partially reverts eb108ad in order to work around a reliability problem with WinHttpGetProxyForUrl. That function hangs unless there is an available thread pool thread to complete the WPAD request. As a result, if a customer issued ~512 concurrent HTTP requests, or otherwise needed that many thread pool threads, there would not be a thread available for WinHTTP to complete the operation, and the program would deadlock.

Moreover this call to WinHttpGetDefaultProxyConfiguration is extremely expensive, taking ~20% of overall CPU for the entire program for some Azure Storage SDK customers.

The function WinHttpGetProxyForUrlEx is supposed to help with this problem by being asynchronous, but that function was added in Windows 8, so we can't use it unconditionally. And on Windows 8.1 we already are using WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY instead of trying to do proxy autodetect ourselves.

This commit partially reverts microsoft@eb108ad in order to work around a reliability problem with WinHttpGetProxyForUrl. That function hangs unless there is an available thread pool thread to complete the WPAD request. As a result, if a customer issued ~512 concurrent HTTP requests, or otherwise needed that many thread pool threads, there would not be a thread available for WinHTTP to complete the operation, and the program would deadlock.

Moreover this call to WinHttpGetDefaultProxyConfiguration is extremely expensive, taking ~20% of overall CPU for the entire program for some Azure Storage SDK customers.

The function WinHttpGetProxyForUrlEx is supposed to help with this problem by being asynchronous, but that function was added in Windows 8, so we can't use it unconditionally. And on Windows 8.1 we already are using WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY instead of trying to do proxy autodetect ourselves.
@BillyONeal
Copy link
Member Author

@vadz Any comments?

@BillyONeal
Copy link
Member Author

Ivan Pashov of the WinHTTP team confirms that WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY completely obsoletes WinHttpGetProxyForUrl.

@BillyONeal BillyONeal merged commit 60e067e into microsoft:master Jul 16, 2019
@BillyONeal BillyONeal deleted the proxy_overhaul branch July 16, 2019 14:56
@vadz
Copy link
Contributor

vadz commented Jul 17, 2019

@BillyONeal sorry for the delay with reply. In any case, I don't have much to say: I didn't notice any performance problems, but that's because I use the library from interactive application doing just a few requests. For me the important thing is that it works out of the box even in restricted corporate environments, but I think this should still be the case with your changes.

TL;DR: no real comments.

@BillyONeal
Copy link
Member Author

@vadz In that case you will need to pass in a proxy config set to auto_discovery to request WPAD after this change..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants