6

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

2 Answers 2

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 is excellent for quick performance tests against HTTP(S) endpoints
    • Tools such as the MySQL Benchmark 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 or Gattling 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.

1

To expand on Richard'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).

By using these two items you can hopefully make a better educated guess and perform more targeted testing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.