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

Improve Hyper-V performance by reduce duplicate Hyper-V operations #10136

Open
lingsamuel opened this issue Jan 13, 2021 · 17 comments
Open

Improve Hyper-V performance by reduce duplicate Hyper-V operations #10136

lingsamuel opened this issue Jan 13, 2021 · 17 comments
Labels
co/hyperv HyperV related issues kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@lingsamuel
Copy link
Contributor

lingsamuel commented Jan 13, 2021

See #10135

docker-env and status need 10s in average. Seems like each Hyper-V operation (get running state, get ip addr) takes 2s+.

Comparison: Linux OS < 1s

/kind feature

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 13, 2021
@lingsamuel lingsamuel changed the title Improve Hyper-V performance by reduce duplicate calls Improve Hyper-V performance by reduce duplicate Hyper-V operations Jan 13, 2021
@lingsamuel
Copy link
Contributor Author

/label os/windows

@k8s-ci-robot
Copy link
Contributor

@lingsamuel: The label(s) /label os/windows cannot be applied. These labels are supported: api-review, community/discussion, community/maintenance, community/question, cuj/build-train-deploy, cuj/multi-user, platform/aws, platform/azure, platform/gcp, platform/minikube, platform/other, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash

In response to this:

/label os/windows

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@medyagh
Copy link
Member

medyagh commented Jan 14, 2021

thats a good idea @lingsamuel if indeed we doing those operations multiple times. could we verify how many times we actually call those funcs ? maybe adding some debug.Printstack() and them and see how many times we call it and reduce those calls

@medyagh medyagh added the priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. label Jan 14, 2021
@lingsamuel
Copy link
Contributor Author

From the log I pasted #10135 we can say it repeat .state at least 3 times and get ip address twice

@lingsamuel
Copy link
Contributor Author

lingsamuel commented Jan 14, 2021

The latency only happens when we are accessing host.Driver.XXX. I suspect the reason is powershell starts slowly.

	host, _ := api.Load(machineName)
	s, _ := host.Driver.GetState()

Slow operation is Driver.GetState().

In status command:

func nodeStatus(api libmachine.API, cc config.ClusterConfig, n config.Node) (*Status, error) {
// ...
	hs, err := machine.Status(api, name)
// ...
	if _, err := cluster.DriverIP(api, name); err != nil {
// .....
	host, err := machine.LoadHost(api, name)
	cr, err := machine.CommandRunner(host)
//...
  • machine.Status, has 1 .GetState()
  • cluster.DriverIP() has 1 .GetIP() (from log I found before IP access, there is a State access, it happened inside GetIP())
  • New a CommandRunner (SSH here) has a State and IP access (inside GetSSHHostname())

@lingsamuel
Copy link
Contributor Author

lingsamuel commented Jan 14, 2021

Some libmachine codes: GetIP, GetState, GetSSHHostname()

From the code we know machine-drivers/machine doesn't cache anything.

@lingsamuel
Copy link
Contributor Author

lingsamuel commented Jan 14, 2021

The strange thing is the lib already set IP inside Start().
Is there any reason to retrieve IP every time?

@lingsamuel
Copy link
Contributor Author

By this simple patch, docker-env and status only need 2s currently (1 State call).

@lingsamuel
Copy link
Contributor Author

xref machine-drivers/machine#31

@lingsamuel
Copy link
Contributor Author

Can we use a fork version with this patch machine-drivers/machine#32? @medyagh

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 27, 2021
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 27, 2021
@lingsamuel
Copy link
Contributor Author

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label May 28, 2021
@lingsamuel
Copy link
Contributor Author

Any updates? I think I've provided enough information to confirm this.
/ping @medyagh

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 16, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Dec 16, 2021
@sharifelgamal sharifelgamal added co/hyperv HyperV related issues and removed priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Dec 22, 2021
@sharifelgamal sharifelgamal added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. labels Dec 22, 2021
@sharifelgamal
Copy link
Collaborator

I believe @afbjorklund has write access to machine-drivers/machine, hopefully he can merge your PR there and we can update the reference in our code here.

@spowelljr spowelljr added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/hyperv HyperV related issues kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

7 participants