Typical resource request required for an nginx file explorer deployed on kubernetes

5/29/2021

I have 2 nfs mounts of 100TB each i.e. 200TB in total. I have mounted these 2 on Kubernetes container. My file server is a typical log server that holds a mix of data types like JSON, HTML, images, logs and text files, etc. The size of files also varies a lot. I am kind of guessing what should be the ideal resource request for this kubernetes container? My assumption, 1. As this is file reads its i/o intensive operation, CPU should be high 2. Since we may have a large file size transferred over, Memory should also be high.

Just wanted to check if my assumptions are right?

-- Hacker
fileserver
kubernetes
nginx

1 Answer

6/14/2021

Posting this community wiki answer to set a baseline and to show one possible set of actions that should led to solution.

Feel free to edit and expand.


As I stated previously, this setup will heavily depend on case to case basis and giving the approximate could be misleading. In my opinion the best course of actions to take would be:

  • Install monitoring tools
  • Deploy the application for testing
  • Simulate the load

Install monitoring tools

There are a lot of monitoring tools that can retrieve the data about the CPU and Memory usage of your Pods. You will need to choose the one that suits your workloads and infrastructure best.

Some of them are:


Deploy the application for testing

This can also be a quite wide topic considering the fact that the exact requirements and the infrastructure is not known. One of many questions is if the Deployment should have a steady replica amount or should use some kind of Horizontal Pod Autoscaling (basing on CPU and/or Memory). The access modes on the storage shouldn't matter as NFS supports RWX.

The basic implementation of the Deployment that could be used can be found in the official Kubernetes documentation:


Simulate the load

The simulation part could go either as a real life usage or by using a tool to simulate the load. You would need in this part to choose the option/tool that suits your requirements the most. This part will show you the approximate resources that should be allocated to your nginx file explorer.

A side note!

In my testing I've used ab to check if the load was divided equally by X amount of replicas.


Additional resources

I do recommend to check the official guide on official Kubernetes documentation regarding managing resources:

I also think that the VPA could help you in the whole process as:

Vertical Pod Autoscaler (VPA) frees the users from necessity of setting up-to-date resource limits and requests for the containers in their pods. When configured, it will set the requests automatically based on usage and thus allow proper scheduling onto nodes so that appropriate resource amount is available for each pod. It will also maintain ratios between limits and requests that were specified in initial containers configuration.

It can both down-scale pods that are over-requesting resources, and also up-scale pods that are under-requesting resources based on their usage over time.

-- Github.com: Kubernetes: Autoscaler: Vertical Pod Autoscaler

I'd reckon you could also look on this answer:

-- Dawid Kruk
Source: StackOverflow