0

At an architectural section of an interview I was asked to produce hardware requirements for a certain system I designed. It was a microservice-based system which runs in Kubernetes, Openshift or any other virtual env.

Basically the question can be rephrased as: how much CPU, RAM and storage will every instance of microservices require to run? Why these numbers?

When I came to think of this, I realized that my knowledge is purely empirical. Normally I would deploy a service instance with 500m CPU, 500Mb RAM and a few Gb of HDD, see how many connections it can handle and, if necessary, add more resources or spawn another instance. But I have no idea how much CPU or RAM I need to handle one HTTP request or send a message to Kafka or upload a 1MB image to S3.

How can I calculate hardware requirements analytically and not empirically?

4
  • There are a lot of factors to consider here. Maybe start by creating a model of your deployment e.g. are there ephemeral containers, do you need to allow for scaling, what kind of concurrent load are you expecting. Then run some tests in a local container to get some hard numbers on single transactions. Then, if you still aren't sure, you can update the question with that info and maybe get a meaningful answer.
    – JimmyJames
    Feb 22 at 20:24
  • @JimmyJames, this is a purely theoretical question not related to any particular system. What I'm looking for is any rough estimates that may be used as reference when designing a system (any system). Say, I want a pod with a CRUD app that should handle 1000 rps. Basic inserts, updates, etc.. Where do I start building my estimate?
    – svz
    Feb 22 at 20:30
  • 2
    I would probably start by estimating the cost/requirements of a single transaction. Don't forget IO.
    – JimmyJames
    Feb 22 at 20:42
  • 1
    Chances are that your software has too many moving parts to accurately calculate the memory usage of all of them. It really is just an estimation.
    – user253751
    Feb 22 at 23:05

1 Answer 1

2

You are expecting too much.

  1. There is no such analytical approach beyond trying and measuring which works for any software (inside or container, or without it, does not matter).

  2. For a specific software product, one might collect statistics how memory and CPU depend on certain "input factors". Then you might be able to extrapolate. What these meaningful input factors are depends 100% on the software and the use cases. A webserver has different use cases and input parameters than a database or an accounting application or an image processing software or a physics simulation.

Modern real-world software is way too complex to determine resource requirements completely up-front (it may even differ a lot from one major version to the next if you look at the same software product or product family).

Containerization does not change this. But tools like Docker will allow to gather the numbers about the resource consumption of a certain application empirically in a simple manner.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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