Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
ffacd3bc
Commit
ffacd3bc
authored
Oct 02, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14645 from socaa/readme
Auto commit by PR queue bot
parents
bd589848
ce5d7d43
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
0 deletions
+84
-0
README.md
test/images/resource-consumer/README.md
+84
-0
No files found.
test/images/resource-consumer/README.md
0 → 100644
View file @
ffacd3bc
# Resource Consumer
## Overview
Resource Consumer is a tool which allows to generate cpu/memory utilization in a container.
The reason why it was created is testing kubernetes autoscaling.
Resource Consumer can help with autoscaling tests for:
-
cluster size autoscaling,
-
horizontal autoscaling of pod - changing the size of replication controller,
-
vertical autoscaling of pod - changing its resource limits.
## Usage
Resource Consumer starts an HTTP server and handle sended requests.
It listens on port given as a flag (default 8080).
Action of consuming resources is send to the container by a POST http request.
Each http request creates new process.
Http request handler is in file resource_consumer_handler.go
The container consumes specified amount of resources:
-
CPU in millicores,
-
Memory in megabytes.
###Consume CPU http request
-
suffix "ConsumeCPU",
-
parameters "millicores" and "durationSec".
Consumes specified amount of millicores for durationSec seconds.
Consume CPU uses "./consume-cpu/consume-cpu" binary (file consume-cpu/consume_cpu.go).
When CPU consumption is too low this binary uses cpu by calculating math.sqrt(0) 10^7 times
and if consumption is too high binary sleeps for 10 millisecond.
One replica of Resource Consumer cannot consume more that 1 cpu.
###Consume Memory http request
-
suffix "ConsumeMem",
-
parameters "megabytes" and "durationSec".
Consumes specified amount of megabytes for durationSec seconds.
Consume Memory uses stress tool (stress -m 1 --vm-bytes megabytes --vm-hang 0 -t durationSec).
Request leading to consumig more memory then container limit will be ignored.
###CURL example
```
console
$
kubectl run resource-consumer
--image
=
gcr.io/google_containers/resource_consumer:beta
$
kubectl expose rc resource-consumer
--create-external-load-balancer
=
true
--port
=
8080
--target-port
=
8080
$
kubectl get services resource-consumer
```
There are two IPs first one is internal, second one is the external load-balanced IP. Both serving port 8080. (Use second one)
```
console
$
curl
--data
"millicores=300&durationSec=600"
http://104.197.103.250:8080/ConsumeCPU.
```
300 millicores will be consumed for 600 seconds.
## Image
Docker image of Resource Consumer can be found in Google Container Registry as gcr.io/google_containers/resource_consumer:beta
## 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
[

]()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment