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

hyperv: Default to disabling dynamic memory (--hyperv-disable-dynamic-memory to driver) #1766

Open
DenisBiondic opened this Issue Jul 28, 2017 · 15 comments

Comments

Projects
None yet
@DenisBiondic
Copy link
Contributor

DenisBiondic commented Jul 28, 2017

Is this a BUG REPORT or FEATURE REQUEST?
Feature Request

Minikube version v0.20.0

Environment:

  • OS Windows 10
  • VM Driver Hyper-V

Couple of issues already point out to problem with Hyper-V and dynamic memory:
1252 & 1762

Would it not be better to start the Hyper-V machine with dynamic memory turned off? Currently this switch in not given in to Powershell configuration, but it would be a simple thing to do:
-DynamicMemoryEnabled $true --- check here: https://technet.microsoft.com/en-us/itpro/powershell/windows/hyper-v/set-vmmemory

I would be happy to send a pull request for this.

@DenisBiondic DenisBiondic changed the title Feature: Hyper-V should start with Dynamic Memory off? Feature request - Hyper-V should start with Dynamic Memory off? Jul 28, 2017

@aaron-prindle

This comment has been minimized.

Copy link
Contributor

aaron-prindle commented Aug 1, 2017

@DenisBiondic Having dynamic memory turned off or at least making it configurable would definitely help resolve some issues we are seeing with the Hyper-V driver. That would be great if you could send PR for this, thanks!

@DenisBiondic

This comment has been minimized.

Copy link
Contributor Author

DenisBiondic commented Aug 2, 2017

@aaron-prindle will try to do it in the next few days

@whereisaaron

This comment has been minimized.

Copy link

whereisaaron commented Aug 25, 2017

The problem I was that the default setting for dynamic memory is the uncapped maximum amount. Over a couple days Hyper-V would suck up 20GB+ of RAM in to 'Driver Locker' even though the minicube was only using less than 2MB. Setting a sensible max amount for dynamic memory fixed that for me. (Windows 10 version 1703). I guess turning it off is the alternative fix!

@DenisBiondic

This comment has been minimized.

Copy link
Contributor Author

DenisBiondic commented Sep 8, 2017

@aaron-prindle could you give me some pointers for where the relevant code for configuring powershell flags for Hyper V is? I never did anything in Go, I will try to go through some tutorials in the meantime to try to understand the structure better...

@msnelling

This comment has been minimized.

Copy link
Contributor

msnelling commented Nov 1, 2017

@DenisBiondic While the VM is stopped (or before it's started you can use the following PowerShell command to set the dynamic memory flag.

$VM | Set-VMMemory -DynamicMemoryEnabled $false

or

Set-VMMemory -VMName 'minikube' -DynamicMemoryEnabled $false

https://docs.microsoft.com/en-us/powershell/module/hyper-v/set-vmmemory?view=win10-ps

@JockDaRock

This comment has been minimized.

Copy link

JockDaRock commented Dec 15, 2017

I am not sure I consider this as a feature and more of a bug fix. You cannot currently use Hyper-V without disabling Dynamic Memory. That seems like a bug to me.

That being said the Docker-For-Windows Hyper-V VM disables Dynamic Memory when it is booted. Seems that minikube should follow suit and do the same thing

@Disturbing

This comment has been minimized.

Copy link

Disturbing commented Mar 9, 2018

Agreed on this - Bumping for now!

@shahiddev

This comment has been minimized.

Copy link

shahiddev commented Apr 27, 2018

Hello everyone,
I've been bitten by this so many times (mostly just before a demo) that I decided to take a look at this.

I'm not very experienced in Go but I think I've implemented the changes, however rather embarrassingly not sure how to build this on a Windows machine.
Any pointers ?

@fejta-bot

This comment has been minimized.

Copy link

fejta-bot commented Jul 26, 2018

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-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@whereisaaron

This comment has been minimized.

Copy link

whereisaaron commented Jul 26, 2018

/remove-lifecycle stale

I think this is wrongly labeled as a feature request. I think it bug and AFAIK not fixed?

@shahiddev

This comment has been minimized.

Copy link

shahiddev commented Jul 27, 2018

The required changes were made to upstream Docker Machine but not yet wired up to Minikube, there has been some questions around what the team want to do with the docker machine dependency otherwise I'm ready to implement

@adinunzio84

This comment has been minimized.

Copy link

adinunzio84 commented Oct 12, 2018

I disabled DynamicMemory with this change:

diff --git a/pkg/minikube/drivers/hyperv/driver.go b/pkg/minikube/drivers/hyperv/driver.go
index 2323b6383..7b2843a0e 100644
--- a/pkg/minikube/drivers/hyperv/driver.go
+++ b/pkg/minikube/drivers/hyperv/driver.go
@@ -45,6 +45,7 @@ func createHypervHost(config cfg.MachineConfig) interface{} {
 	d.MemSize = config.Memory
 	d.CPU = config.CPUs
 	d.DiskSize = int(config.DiskSize)
+	d.DisableDynamicMemory = true
 	d.SSHUser = "docker"
 
 	return d

Then I recompiled with this (using Git Bash on Windows)

MSYS_NO_PATHCONV=1 docker run --rm -v "$(pwd)":/go/src/k8s.io/minikube -w /go/src/k8s.io/minikube golang:stretch make cross

Edit* For some reason, I would get this warning while building:

WARNING: You are building minikube outside the expected GOPATH

But if I start bash instead, then run the make command from inside, that doesn't happen:

$ MSYS_NO_PATHCONV=1 docker run -it --rm -v "$(pwd)":/go/src/k8s.io/minikube -w /go/src/k8s.io/minikube golang:stretch /bin/bash
root@d7305eb27c46:/go/src/k8s.io/minikube# make cross
GOPATH=/go ./makedepend.sh out/docker-machine-driver-kvm2 k8s.io ./cmd/drivers/kvm/  > out/docker-machine-driver-kvm2.d
...
out/minikube-windows-amd64 k8s.io/minikube/cmd/minikube
cp out/minikube-windows-amd64 out/minikube-windows-amd64.exe
@fejta-bot

This comment has been minimized.

Copy link

fejta-bot commented Jan 10, 2019

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-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@baltiyskiy

This comment has been minimized.

Copy link

baltiyskiy commented Jan 11, 2019

/remove-lifecycle stale

@tstromberg tstromberg changed the title Feature request - Hyper-V should start with Dynamic Memory off? hyperv: Default to disabling dynamic memory (--hyperv-disable-dynamic-memory to driver) Jan 24, 2019

@tstromberg

This comment has been minimized.

Copy link
Contributor

tstromberg commented Jan 24, 2019

I'd never heard of dynamic memory before, but read up a little on it:

https://blogs.technet.microsoft.com/virtualization/2015/05/26/when-to-use-hyper-v-dynamic-memory-versus-runtime-memory-resize/

I don't know much about HyperV, but I would definitely be happy to help someone implement this if they want to tackle it. It seems like the --hyperv-disable-dynamic-memory option is supported already by the hyperv driver:

https://docs.docker.com/machine/drivers/hyper-v/#4-create-the-nodes-with-docker-machine-and-the-microsoft-hyper-v-driver

Does someone mind taking this on?

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