Answers: <p>It's a severe problem to solve if you don't know the performance characteristics of the process you are containerising.  There are a couple of approaches you could take that will get you an answer, although you will need to monitor it carefully in production and an adjust the resource limits as required.</p>
  
  <ul>
  <li><strong>Approach #1: Educated Guess</strong> - take a look around at what other people have done to host a specific process, GitHub is an excellent resource for finding Dockerfiles and their associated Helm Charts.  Equally, if someone has done some tests for Virtual Machine sizing, you may be able to derive an answer that is acceptable in the short term.</li>
  <li><strong>Approach #2: Testing</strong> - my personal preference is to test the component in question:
  
  <ul>
  <li><a href="https://httpd.apache.org/docs/2.4/programs/ab.html" rel="nofollow noreferrer">The Apache Bench</a> is excellent for quick performance tests against HTTP(S) endpoints</li>
  <li>Tools such as the <a href="https://dev.mysql.com/downloads/benchmarks.html" rel="nofollow noreferrer">MySQL Benchmark</a> tool allow you to test MySQL, many applications have dedicated benchmarking tools.</li>
  <li>If the software is more complicated you can use tools such as <a href="https://artillery.io/" rel="nofollow noreferrer">Artillery</a> or <a href="https://gatling.io/" rel="nofollow noreferrer">Gattling</a> to create a performance test suite that you can use to slam the container and find out how it performs.</li>
  </ul></li>
  </ul>
  
  <p>Whichever approach you take, you will need to make sure that you have a proper monitoring and dashboarding solution working so that you can actually analyse the behaviour of the containers under load and adjust accordingly.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-10-30T16:44:43.230Z
Answers: 2019-10-31T13:12:03.597Z
Answers: 2019-10-31T13:12:03.597Z
Answers: Richard Slater
Answers: <p>To expand on Richard's excellent answer, load testing and logging can help as well:</p>
  
  <ul>
  <li>Logging can help with monitoring, dashboards, and alerts.  However, to properly set this up your services will need to properly log when resources are becoming an issue.  If you already have this then you can make a more informed guess at the resources that will be needed.</li>
  <li>Load testing can help you determine if your limits are reasonable for the load you anticipate.  While you may be able to run with a small set of users, load testing can help determine the cost/benefit of increasing your cpu/memory.  Please note that if you are using a cloud provider you often need to contact them before performing this type of testing (e.g. <a href="https://aws.amazon.com/ec2/testing/" rel="nofollow noreferrer">see AWS's policy</a>).</li>
  </ul>
  
  <p>By using these two items you can hopefully make a better educated guess and perform more targeted testing.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-10-30T18:44:33.263Z
Answers: 2019-10-30T18:44:33.263Z
Answers: Wesley Rolnick
Body: <p>This is a question that's been bothering us quite a while. 
  How can you determine how much to allocate per pod? 
  What if I don't know the program, maybe it needs a lot of memory at peak times. </p>
  
  <p>What are some general strategies to finding out how much to allocate? cpu/memory</p>
  
Tags: <kubernetes>
Title: How much memory/cpu to allocate per pod?
UserDisplayName: aclowkay
ThreadText: # How much memory/cpu to allocate per pod?
  
  (Asked by: username_0 on 2019-10-28)
  
  This is a question that's been bothering us quite a while.
  How can you determine how much to allocate per pod?
  What if I don't know the program, maybe it needs a lot of memory at peak times.
  
  What are some general strategies to finding out how much to allocate? cpu/memory
  
  **Tags:** kubernetes
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-10-30. Score: 3
  
  It's a severe problem to solve if you don't know the performance characteristics of the process you are containerising. There are a couple of approaches you could take that will get you an answer, although you will need to monitor it carefully in production and an adjust the resource limits as required.
  
  * **Approach #1: Educated Guess** - take a look around at what other people have done to host a specific process, GitHub is an excellent resource for finding Dockerfiles and their associated Helm Charts. Equally, if someone has done some tests for Virtual Machine sizing, you may be able to derive an answer that is acceptable in the short term.
  * **Approach #2: Testing** - my personal preference is to test the component in question:
    + [The Apache Bench](https://httpd.apache.org/docs/2.4/programs/ab.html) is excellent for quick performance tests against HTTP(S) endpoints
    + Tools such as the [MySQL Benchmark](https://dev.mysql.com/downloads/benchmarks.html) tool allow you to test MySQL, many applications have dedicated benchmarking tools.
    + If the software is more complicated you can use tools such as [Artillery](https://artillery.io/) or [Gattling](https://gatling.io/) to create a performance test suite that you can use to slam the container and find out how it performs.
  
  Whichever approach you take, you will need to make sure that you have a proper monitoring and dashboarding solution working so that you can actually analyse the behaviour of the containers under load and adjust accordingly.
  
  
  ---
  
  ### Answer by username_2 on 2019-10-30. Score: 1
  
  To expand on username_1's excellent answer, load testing and logging can help as well:
  
  * Logging can help with monitoring, dashboards, and alerts. However, to properly set this up your services will need to properly log when resources are becoming an issue. If you already have this then you can make a more informed guess at the resources that will be needed.
  * Load testing can help you determine if your limits are reasonable for the load you anticipate. While you may be able to run with a small set of users, load testing can help determine the cost/benefit of increasing your cpu/memory. Please note that if you are using a cloud provider you often need to contact them before performing this type of testing (e.g. [see AWS's policy](https://aws.amazon.com/ec2/testing/)).
  
  By using these two items you can hopefully make a better educated guess and perform more targeted testing.
  
  
  ---
  
  