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

Disable swap within minikube VM #3012

Closed
gugu opened this issue Jul 24, 2018 · 9 comments
Closed

Disable swap within minikube VM #3012

gugu opened this issue Jul 24, 2018 · 9 comments
Labels
area/guest-vm General configuration issues with the minikube guest VM help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Milestone

Comments

@gugu
Copy link

gugu commented Jul 24, 2018

FEATURE REQUEST

I tried to debug, why minikube is slow for all our team. What I noticed, that minikube has swapiness = 60, this means, it will use swap if it has < 60% memory left. Most host OS already have swapiness set (60 for linux). Currenly if minikube uses >800Mb memory or host OS has <40% memory free, it goes to swap. Host OS is not part of minikube project, but minikube OS is

Doing swapoff or setting swapiness to 10 makes minikube much faster

Please provide the following details:

Environment:

Minikube version 0.28.0 (use minikube version):

  • OS (e.g. from /etc/os-release):
NAME="Ubuntu"
VERSION="18.04 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
  • VM Driver (e.g. cat ~/.minikube/machines/minikube/config.json | grep DriverName):
    kvm2
  • ISO version (e.g. cat ~/.minikube/machines/minikube/config.json | grep -i ISO or minikube ssh cat /etc/VERSION):
        "Boot2DockerURL": "file:///home/kostenko/.minikube/cache/iso/minikube-v0.28.0.iso",
        "ISO": "/home/kostenko/.minikube/machines/minikube/boot2docker.iso",
  • Install tools:
  • Others:

What happened:
Minikube is extremely slow for our team (freezes whole UI)

What you expected to happen:

Make it not to freeze UI

How to reproduce it (as minimally and precisely as possible):

Run minikube with 72% memory usage. Then run htop/iotop on both host andVM

Output of minikube logs (if applicable):

Anything else do we need to know:

@dlorenc
Copy link
Contributor

dlorenc commented Jul 26, 2018

swapoff makes sense to me. k8s has issues with swap in general.

@gugu
Copy link
Author

gugu commented Jul 26, 2018

Swapoff will help as well

@gugu gugu changed the title Set minikube OS swapiness to 10 (to increase speed) Set minikube OS swapiness to 10 (to increase speed) or remove swap at all Jul 30, 2018
@tstromberg tstromberg added kind/feature Categorizes issue or PR as related to a new feature. area/guest-vm General configuration issues with the minikube guest VM labels Sep 19, 2018
@tstromberg tstromberg changed the title Set minikube OS swapiness to 10 (to increase speed) or remove swap at all Disable swap within minikube VM Sep 19, 2018
@afbjorklund
Copy link
Collaborator

Was discussed in #1827, before the bot closed it

@popcornylu
Copy link

++
Whenever i start a minikube, what I always need to do is

minikube start
minikube ssh
sudo swapoff -a

@tstromberg
Copy link
Contributor

This issue seems like an easy win, so I'm testing a possible PR to address it: #3278.

@tstromberg tstromberg added this to the v0.31.0 milestone Oct 30, 2018
@balopat balopat removed this from the v0.31.0 milestone Nov 13, 2018
@chancez
Copy link
Member

chancez commented Dec 19, 2018

Upstream Kubernetes doesn't even officially support swap. I'm kinda surprised this was ever enabled.

@afbjorklund
Copy link
Collaborator

It was a requirement of Docker (for a while), and Minikube was based on Docker Machine...

@afbjorklund
Copy link
Collaborator

@tstromberg tstromberg added this to the v1.0.0-candidate milestone Jan 23, 2019
@tstromberg tstromberg added the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label Jan 23, 2019
@tstromberg tstromberg removed their assignment Jan 23, 2019
@tstromberg tstromberg added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Jan 23, 2019
@tstromberg tstromberg added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels Jan 24, 2019
@tstromberg tstromberg modified the milestones: v1.0.0-candidate, v0.34.0 Jan 24, 2019
@afbjorklund
Copy link
Collaborator

Removing the swap partition will potentially also make the machine disk image a lot smaller...

For some drivers (KVM), formatting the 1000M swap partition (mkswap) increases the image too.
Even though the space is mostly zero, you will have to do a img "compact" operation to reclaim it.

The virtualbox driver seems to do slightly better, and recognizes the the sparse file storage ?

@tstromberg tstromberg removed this from the v0.34.0 milestone Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/guest-vm General configuration issues with the minikube guest VM help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

No branches or pull requests

7 participants