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.