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

Decrease cpu limits to allow run a workspace on minikube with default cpu configuration #832

Merged
merged 1 commit into from
Feb 5, 2021

Conversation

vzhukovs
Copy link
Contributor

@vzhukovs vzhukovs commented Feb 4, 2021

What does this PR do?

This change proposal lowers the value for the cpuLimit and cpuRequest to allow workspace to run on minikube, which is run with default CPU configuration. By default the value for the CPU is set to 2. After merging the following PR, the general cpuRequest value is more than minikube is available to provide for normal workspace startup. The new values for the cpuLimit is set from 1.5 to 1 and for the cpuRequest is set from 0.5 to 0.1.

Tested on OSIO, RHPDS, Dogfooding and minikube.

Signed-off-by: Vladyslav Zhukovskyi vzhukovs@redhat.com

Screenshot/screencast of this PR

N/A

What issues does this PR fix or reference?

fixes eclipse-che/che#18955

How to test this PR?

Start minikube with the following configuration:

$ minikube start --addons=ingress --vm=true --memory=8192

Deploy Che:

$ chectl update next && \
  chectl server:deploy -p minikube

Create the workspace from the following devfile:

devfile
apiVersion: 1.0.0
metadata:
  name: java-mysql
projects:
  - name: web-java-spring-petclinic
    source:
      location: 'https://github.com/spring-projects/spring-petclinic.git'
      type: git
      branch: main
components:
  - type: cheEditor
    reference: 'https://gist.github.com/vzhukovs/732676571880f51bc0b87cc2f7ee1304/raw/12706cb543c5572ceb736fffaf143de909a281e7/meta.yaml'
  - type: chePlugin
    reference: 'https://gist.github.com/vzhukovs/071cc61b3c2d170392c41aee98178c16/raw/cb47e2af2006ecfedb7ef45b00ffa72507f09072/meta.yaml'
    alias: exec
  - memoryLimit: 1280Mi
    type: chePlugin
    reference: 'https://gist.github.com/vzhukovs/d375a1ee62df950a9d98fffe5d15c25b/raw/f18e93f2293c3d8e5d85e80d8affa18d4a34c776/meta.yaml'
    alias: java
  - mountSources: true
    endpoints:
      - name: 8080-tcp
        port: 8080
      - attributes:
          public: 'false'
        name: debug
        port: 5005
    memoryLimit: 1000Mi
    type: dockerimage
    volumes:
      - name: m2
        containerPath: /home/user/.m2
    alias: tools
    image: 'quay.io/eclipse/che-java8-maven:nightly'
    env:
      - value: ''
        name: MAVEN_CONFIG
      - value: '-XX:MaxRAMPercentage=50.0 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xms20m -Djava.security.egd=file:/dev/./urandom -Duser.home=/home/user'
        name: JAVA_OPTS
      - value: $(JAVA_OPTS)
        name: MAVEN_OPTS
  - mountSources: true
    endpoints:
      - attributes:
          discoverable: 'true'
          public: 'false'
        name: db
        port: 3306
    memoryLimit: 300Mi
    type: dockerimage
    alias: mysql
    image: 'quay.io/eclipse/che--centos--mysql-57-centos7:latest-e08ee4d43b7356607685b69bde6335e27cf20c020f345b6c6c59400183882764'
    env:
      - value: petclinic
        name: MYSQL_USER
      - value: petclinic
        name: MYSQL_PASSWORD
      - value: petclinic
        name: MYSQL_DATABASE
      - value: '$(echo ${0})\\$'
        name: PS1
commands:
  - name: maven build
    actions:
      - workdir: '${CHE_PROJECTS_ROOT}/web-java-spring-petclinic'
        type: exec
        command: mvn clean install
        component: tools
  - name: run webapp
    actions:
      - workdir: '${CHE_PROJECTS_ROOT}/web-java-spring-petclinic'
        type: exec
        command: |
          SPRING_DATASOURCE_URL=jdbc:mysql://db/petclinic \
          SPRING_DATASOURCE_USERNAME=petclinic \
          SPRING_DATASOURCE_PASSWORD=petclinic \
          java -jar -Dspring.profiles.active=mysql \
          -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 \
          target/*.jar
        component: tools
  - name: prepare database
    actions:
      - type: exec
        command: |
          /opt/rh/rh-mysql57/root/usr/bin/mysql -u root < ${CHE_PROJECTS_ROOT}/web-java-spring-petclinic/src/main/resources/db/mysql/user.sql &&
          /opt/rh/rh-mysql57/root/usr/bin/mysql -u root petclinic < ${CHE_PROJECTS_ROOT}/web-java-spring-petclinic/src/main/resources/db/mysql/schema.sql &&
          echo -e "\e[32mDone.\e[0m Database petclinic was configured!"
        component: mysql
  - name: Debug remote java application
    actions:
      - referenceContent: |
          {
          "version": "0.2.0",
          "configurations": [
            {
              "type": "java",
              "name": "Debug (Attach) - Remote",
              "request": "attach",
              "hostName": "localhost",
              "port": 5005
            }]
          }
        type: vscode-launch

Workspace should be able to start and do not show the error message:

0/1 nodes are available: 1 Insufficient cpu.

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

…ration

Signed-off-by: Vladyslav Zhukovskyi <vzhukovs@redhat.com>
Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vzhukovs vzhukovs changed the title Decrease cpu limits to allow run on minikube with default cpu configuration Decrease cpu limits to allow run a workspace on minikube with default cpu configuration Feb 4, 2021
@benoitf benoitf merged commit a631217 into master Feb 5, 2021
@benoitf benoitf deleted the che#18955 branch February 5, 2021 10:58
@che-bot che-bot added this to the 7.26 milestone Feb 5, 2021
@@ -87,8 +87,8 @@ editors:
- exposedPort: 13132
- exposedPort: 13133
memoryLimit: "512M"
cpuLimit: 1500m
cpuRequest: 500m
cpuLimit: 1000m
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason to lower the CPU Limit?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will decrease Theia performances without any real benefit (on minikube it works fine with cpu limit set to 1500).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why CPU Limit was decreased was monitoring overall consumption of CPU by Theia container, which was around 0.2 CPU for all workspace lifecycle. Created revert commit, that sets up previous value for the cpuLimit: #833. So the only cpuRequest value is being updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

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 this pull request may close these issues.

Java Maven sample on minikube is not starting
5 participants