Calling IServerXmlHttpRequest.Open
:
var http = (IServerXMLHTTPRequest2) new CreateComObject(CLASS_ServerXMLHTTP60);
http.Open("GET", "https://thepiratebay.org/description.php?id=54783221", false, "mhalifa", "hunter2");
causes the library OnDemandConnRouteHelper.dll to be loaded and unloaded every time:
| Time | Operation | Path | Result |
|--------------------|---------------------------|-------------------------------------------------|-------------------------------|
| 3:08:29.0705523 PM | CreateFile | C:\WINDOWS\SysWOW64\OnDemandConnRouteHelper.dll | SUCCESS |
| 3:08:29.0705941 PM | QueryBasicInformationFile | C:\WINDOWS\SysWOW64\OnDemandConnRouteHelper.dll | SUCCESS |
| 3:08:29.0706149 PM | CloseFile | C:\WINDOWS\SysWOW64\OnDemandConnRouteHelper.dll | SUCCESS |
| 3:08:29.0708557 PM | CreateFile | C:\WINDOWS\SysWOW64\OnDemandConnRouteHelper.dll | SUCCESS |
| 3:08:29.0709287 PM | CreateFileMapping | C:\WINDOWS\SysWOW64\OnDemandConnRouteHelper.dll | FILE LOCKED WITH ONLY READERS |
| 3:08:29.0712518 PM | CreateFileMapping | C:\WINDOWS\SysWOW64\OnDemandConnRouteHelper.dll | SUCCESS |
| 3:08:29.0714096 PM | Load Image | C:\WINDOWS\SysWOW64\OnDemandConnRouteHelper.dll | SUCCESS |
| 3:08:29.0714328 PM | QueryNameInformationFile | C:\WINDOWS\SysWOW64\OnDemandConnRouteHelper.dll | SUCCESS |
| 3:08:29.0717643 PM | CreateFile | C:\WINDOWS\SysWOW64\OnDemandConnRouteHelper.dll | SUCCESS |
| 3:08:29.0807774 PM | CloseFile | C:\WINDOWS\SysWOW64\OnDemandConnRouteHelper.dll | SUCCESS |
| 3:08:29.0810143 PM | QueryNameInformationFile | C:\WINDOWS\SysWOW64\OnDemandConnRouteHelper.dll | SUCCESS |
As you can see, this excursion adds 10.462 ms
to my http request.
When the entire request is ~30 ms, this extra load and unload of a dll every time increases the operation times by 50%.
And cuts my throughput from 50 requests/sec → 33 requests/sec.
In other words: i want my 50% back - how do i get it?
I don't know what this dll does, but the only useful function is documented to:
The OnDemandGetRoutingHint function looks up a destination in the Route Request cache and, if a match is found, return the corresponding Interface ID.
Which sounds interesting and all. But if you immediately unload the dll, you throw away the cache with it - thus destroying any usefulness of the cache.
It's not an answer, but a workaround is to load the library once manually.
There is no need in Windows to unload a DLL before program exit - the DLLs will be unloaded when the process is torn down by Windows.
So there's no harm in calling:
LoadLibrary('OnDemandConnRouteHelper');
In fact, there's no harm in calling it multiple times.
Just don't call UnloadLibrary
; because then it has to be loaded again.