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

Implement Resource Consumer #11570

Closed
17 of 19 tasks
piosz opened this issue Jul 20, 2015 · 9 comments
Closed
17 of 19 tasks

Implement Resource Consumer #11570

piosz opened this issue Jul 20, 2015 · 9 comments
Assignees
Labels
priority/backlog Higher priority than priority/awaiting-more-evidence. sig/autoscaling Categorizes an issue or PR as relevant to SIG Autoscaling. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle.

Comments

@piosz
Copy link
Member

piosz commented Jul 20, 2015

This is @socaa's intern project.

Background

We are working on autoscaling for Kubernetes in 3 dimensions:

We need a tool which will help us to test e2e those kinds of autoscaling.

Resource Consumer

Resource Consumer will consist of two parts: container consuming resources and library managing this load.

Container

The container which consumes specified amount of resources (cpu/mem). Docker container, uploaded to Google Container Registry, open sourced, possibly written in go (it’s not a requirement, but it’s strongly encouraged). The resources to consume should be set and mutated by sending appropriate http request to the container.

The interface should allow to consume the given amount of cpu/mem for the given period of time. It should consist of the following methods:

ConsumeCPU(milicores, duration_sec)
ConsumeMem(megabytes, duration_sec)
GetCurrentStatus()

Each http request will be handled by spawning a new process which will consume given amount of resource and exit after given timeout.The request cannot be cancelled.

Consuming CPU

Consuming the whole core can be done easily. The problem is how to consume some part of it. One of possible ways to achieve it is to split time into small quants, then perform heavy compute operation during some percentage of quants and sleep during the other ones. It is a part of the task to figure out the best way to consume CPU.

Consuming memory

There are few possible ways how to handle memory consumption. We want to make sure the memory can be correctly freed. The only problem is that the container use some memory itself, so that this amount should be considered in calculations as well. It is a part of the task to figure out the best way to consume memory.

Library

Client side library written in go will be linked with e2e tests and should consist of two kinds of methods: static consumption of resources and dynamic one.

Static consumption

This part of library should allow to consume constant amount of resource over time:

ConsumeCPU(node, percentage)
ConsumeMem(node, percentage)
CreateConsumingPod(node) : PodID
ConsumeCPU(pod, percentageOfRequest)
ConsumeMem(pod, percentageOfRequest)

Dynamic consumption

This part of library should allow to create service on top of replication controller, and then request to consume the given amount of resources by all replicas together based on service level load balancing. It can be implemented with sending a lot of consumption request for short period of time and small amount of resources. The interface should consist of:

CreateConsumingService() : RcID
ConsumeCPU(rc, milicores)
ConsumeMem(rc, megabytes)

In both cases there might be an option to add possibility to modify/stop consumption if needed.

Use cases

Cluster size autoscaling

  1. consume more resources on each node that is specified for autoscaler
  2. observe that cluster size increased

Horizontal autoscaling of pod

  1. create consuming RC and start consuming appropriate amount of resources
  2. observe that RC has been resized
  3. observe that usage on each replica decreased

Vertical autoscaling of pod

  1. create consuming pod and start consuming appropriate amount of resources
  2. observed that limits has been increased

Milestones

Dropped ideas

  • [optional] add possibility to specify initial consumption request
  • [optional] add a status page

Releases

Date Version Image Release notes
8/14/15 alpha gcr.io/google_containers/resource_consumer:alpha Support only for cpu consumption
9/15/15 beta gcr.io/google_containers/resource_consumer:beta Feature complete
12/14/15 beta2 gcr.io/google_containers/resource_consumer:beta2 Added support for custom metrics
@piosz
Copy link
Member Author

piosz commented Jul 20, 2015

cc @jszczepkowski @fgrzadkowski

@piosz piosz added the sig/autoscaling Categorizes an issue or PR as relevant to SIG Autoscaling. label Jul 20, 2015
@piosz piosz self-assigned this Jul 20, 2015
@wojtek-t
Copy link
Member

/cc me

@bgrant0607
Copy link
Member

cc @AnanyaKumar

@vishh
Copy link
Contributor

vishh commented Aug 1, 2015

/sub

socaa pushed a commit to socaa/kubernetes that referenced this issue Aug 4, 2015
@derekwaynecarr
Copy link
Member

/sub

@ramr
Copy link

ramr commented Aug 5, 2015

/sub

@piosz
Copy link
Member Author

piosz commented Aug 14, 2015

The alpha version is released as gcr.io/google_containers/resource_consumer:alpha. It supports consuming cpu only.

@piosz
Copy link
Member Author

piosz commented Sep 15, 2015

The beta version is released as gcr.io/google_containers/resource_consumer:beta. It supports consuming both cpu and memory.

cc @derekwaynecarr

@piosz
Copy link
Member Author

piosz commented Oct 5, 2015

Good job @socaa!

@piosz piosz closed this as completed Oct 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/backlog Higher priority than priority/awaiting-more-evidence. sig/autoscaling Categorizes an issue or PR as relevant to SIG Autoscaling. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle.
Projects
None yet
Development

No branches or pull requests

8 participants