Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Causing aroung 800ms delay between version 3.2.0 and 3.3.0 #16

Closed
Deepanshu2017 opened this issue Apr 27, 2020 · 6 comments · Fixed by #18
Closed

Causing aroung 800ms delay between version 3.2.0 and 3.3.0 #16

Deepanshu2017 opened this issue Apr 27, 2020 · 6 comments · Fixed by #18

Comments

@Deepanshu2017
Copy link

The scenario -

I had a production system running on Cosmos NodeJS package (version 3.6.2) and recently I made some changes and tried to deploy the new code over the production. I started to see the latency of around 800ms in cosmos DB insertion call. The cosmos DB package version was the same so the issue was in one of the dependency. I manually checked each and every package on which Cosmos DB and it's dependencies are dependent on (trust I checked a lot of code and releases) and could drill down to the specific version which is causing the issue.

The Windows-release package version 3.3.0 is causing the Cosmos to delay the result by 800ms to 1000ms. While with Windows-release package version 3.2.0 Cosmos DB doesn't show this much of delay. (Given that everything in the system was constant and every other factor which might impact the results had been eliminated).

When comparing Windows-release 3.3.0 with Windows-release 3.2.0, I found that the only part in the code that has been changed is the below snippet

windows-release/index.js

Lines 36 to 40 in 39b78e7

try {
stdout = execa.sync('powershell', ['(Get-CimInstance -ClassName Win32_OperatingSystem).caption']).stdout || '';
} catch (_) {
stdout = execa.sync('wmic', ['os', 'get', 'Caption']).stdout || '';
}

Basically Windows-release moved from wmic to use PowerShell by default in this commit and in case PowerShell fails, fallback to wmic and I suspect that due to this fallback and changing default from wmic to PowerShell is causing the delay.

@Deepanshu2017
Copy link
Author

SideNote:
I don't necessarily know whether I should create this issue here or in the os-name package or in CosmosDB. But anyway creating the issue here.
Also seems like, you are the owner of this package as well as the owner of os-name package.

@sindresorhus
Copy link
Owner

// @landsfiskalen

@Deepanshu2017 Deepanshu2017 changed the title Causing aroung 800ms delay between version 3.2.0 and 3.3.3 Causing aroung 800ms delay between version 3.2.0 and 3.3.0 Apr 27, 2020
@landsfiskalen
Copy link
Contributor

Hmmm, weird. @Deepanshu2017 could you try and change the order of the powershell and wmic command?

@Deepanshu2017
Copy link
Author

@landsfiskalen But the thing is, I really don't know if I can do that in your code and push the deployment since it was on the Azure function app.

The confirmed thing is, changing from 3.3.0 to 3.2.0 made resolved everything.

@Deepanshu2017
Copy link
Author

One thing I can try is, try to run the 3.3.0 and 3.2.0 on my local system and check if I can replicate the issue on local.

@landsfiskalen
Copy link
Contributor

That would be great if you could!

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 a pull request may close this issue.

3 participants