Short talk on how to cost an application in a containerised environment using multiple methods and custom open source tool.
Further touching on how to optimized an application via tools created.
14. How do we try to solve this challenge ?
• Component A:
o Metering mechanism using AWS services
• Component B:
o Calculate cost based on metered results via open-source tool – Prometheus
• Component C:
o Visualizing running costs via open-source tool - Grafana
15. Component A: Metering via AWS services
Reference: https://aws.amazon.com/blogs/compute/measuring-service-chargeback-in-amazon-ecs/
• Track AWS ECS tasks resource usage.
• Tracking vCPU and memory reserved
• Track when AWS ECS tasks start/stop
16. Component A: Metering via AWS services
Reference: https://aws.amazon.com/blogs/compute/measuring-service-chargeback-in-amazon-ecs/
17. Component B: Calculating Cost
1. Find all the tasks that have ever run or
are currently running as part of the
service.
2. For each task, calculate the up time.
3. For each task, find the container instance
type.
4. Find what percentage of the host’s
compute or memory resources the task
has reserved
5. Associate that percentage with a cost.
6. Store the results of this calculated data in
Prometheus through custom exporter
18. Component B: Calculating Cost
Considerations:
• EC2 pricing is on-demand
• Networking costs not included
• ELB/ALB costs not included
32. Summary:
• How to cost an application ?
• Quality tagging and tools
Helps forming a baseline running cost estimate for an application
• How to cost optimize an application ?
• Observe AWS Cost Optimization Pillars
• Have open discussion with team about application costs, learn
together
• Provide proper tools to team
Good afternoon everyone, and welcome to this afternoon’s session – titled Where did my money go ?
If you can tell by the session title, we are going to talk about money/resources/costs ….
As I’m aware that this is a 4pm session, let me attempt to start with something light hearted first.
In the wonderful world of internet, I stumble upon an individual, a creative one …
And this individual is into cosplay,
Cosplay is a performance art in which participants called cosplayers wear costumes and fashion accessories to represent a specific character
And what struck interest to me was creative attempt to cosplay with the amount of resource/cost he had…
(CLICK)
Scream
Gouku
Terminator
Hm… a cat is involve…
Oh .. I wonder what is the character ….
I do applaud this individual’s creativity. Boldness…. The attention to “some” details
I have to say barely get away with the low budget he had…
Speaking about budget, which brings me to what I actually wanted to share today …
(CLICK)
Unlike the previous creative individual we saw earlier,
We at Carsales had a different kind of resources and goals we try to work with…,
But before we can attempt to operate at a desired resource and costs… there are 2 questions we at carsales attempt to answer…
(CLICK)
How to cost and application
How to cost optimize an application
(CLICK)
Sam, we are thinking of commercialing XYZ product, we would like to know how much it costs us to run such application ….
Sounds familiar ?
I said to myself, alright to answer this question, there is a very good starting place I could go to….
(CLICK)
AWS Billing Dashboard
Still doesn’t show me the cost of running application … our application is a dockerize application runs in AWS ECS…
So there’s some more breakdown we can do … we apply tagging to our ecs tasks and services.. .
(CLICK)
Hm… that doesn’t look right ….
(CLICK)
After doing some digging around…
It turns out that the largest contribution to the cost of all our application seems to be lump together all in this purple bar. Which is 57% of the bill
How do we try to solve this challeng ?
We broke down our approach to 3 component.
(CLICK)
We know that our ECS services runs on EC2 and the costing of EC2 is hourly basis
Surprisingly, AWS have a solution, detailed in the blog reference.
I’m extracting some of the elements out into Componenet A.
The idea is to have a mechanism to detect when a task state changed from RUNNING/STOPPED or vice versa.
And store this information somewhere
Surprisingly, AWS have a solution, detailed in the blog reference.
I’m extracting some of the elements out into Componenet A.
The idea is to have a mechanism to detect when a task state changed from RUNNING/STOPPED or vice versa.
And store this information somewhere
2. At this moment we are calculating within 1 hour how many tasks are up and running
Putting it altogether
Over 24 hours, average running costs of cyclops = $1.393k
Ask crowd about optimization (hands)
Explain the dashboard in General Way
Red circle 1 – Total Request Count
Red circle 2 – Avg Response Time
Red Circle 3 – CPU
Memory unusually high usage resourced ? Real world scenario
Blur image.
Handling about avg 450 000 per month, 15000 request per day, 600 per hour ..,
A few c5 4xlarge to hosts this a few of this related microservices
First deployed, the services keeps dropping out for a few seconds after running for half a day.
Use case
Memory Leaks
Click 1 - Arrow
Click 2 - Red circle Memory change