How to keep Cloud cost under control?

Mageswaran D
3 min readApr 16, 2022
  1. Collect the hardware metrics (CPU/memory utilization, disk I/O)

2. Collect the app/web server metrics — The ones like Tomcat, Apache HTTP, Flask, Django etc running on the hardware (Collect metrics like top processes that consume more CPU memory, available heap memory, thread usage, request throughput, sessions, connection pooling etc)

3. Collect all the DB metrics (connection pool stats, memory/connection leaks, low performing queries/SP’s etc)

4. Collect Real usage metrics (concurrent connections, load on a particular service/feature etc)

5. Network metrics (latency, throughput, packet loss etc)

6. UI metrics — page response, DNS lookup, latency with connecting to third party API’s etc

Once all these are collected, wear the hat of a performance tuning engineer (maybe along with a solution architect who knows how the full stack works) and then analyze what causes the bottleneck.

As an e.g, if you see the CPU of your VM peaking up, then check which are the processes that consume the CPU. If it is a app/web server process that eats CPU, then check what causes that spike in that app/web server (maybe a complex calculation or poorly written code)

Similarly, with the metrics that we collected in the 6 steps, we should be able to identify the issue exactly.

Tools like zabbix, zoho site 24/7, Prometheus, Cloudwatch, Idera, dynatrace, appdynamics, datadog, Google developer toolbar, Fiddler etc can provide you with the required metrics

All these data ingestion can be automated by tools like ELK, Splunk, AWS Open Search etc.

Now, I leave it to your imagination on what can be automated, how patterns can be identified and fed into machine learning and AI for self healing systems etc.

Hope you got the concept — This will help in having efficient applications that won’t hog all your hardware resources and ultimately you won’t end up over provisioning your resources.

Always remember cloud (any vendor for that matter) is a double edged sword — If not used in the right way, the expenses will exponentially skyrocket and when you really want to bring it down, you will face a nightmare!

--

--