<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Santiago Campuzano on Medium]]></title>
        <description><![CDATA[Stories by Santiago Campuzano on Medium]]></description>
        <link>https://medium.com/@santiago_51772?source=rss-fbeefd7b7fae------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*EN306nqLsEqgZCBQR-gRIw.jpeg</url>
            <title>Stories by Santiago Campuzano on Medium</title>
            <link>https://medium.com/@santiago_51772?source=rss-fbeefd7b7fae------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 01:02:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@santiago_51772/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AWS Graviton eco-friendly technology slashed 25% of GumGum’s computing cost]]></title>
            <link>https://medium.com/gumgum-tech/aws-graviton-eco-friendly-technology-slashed-25-of-gumgums-computing-cost-8ddc2f37e16d?source=rss-fbeefd7b7fae------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ddc2f37e16d</guid>
            <category><![CDATA[adtech]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[carbon-emissions]]></category>
            <category><![CDATA[graviton]]></category>
            <dc:creator><![CDATA[Santiago Campuzano]]></dc:creator>
            <pubDate>Thu, 20 Oct 2022 20:01:20 GMT</pubDate>
            <atom:updated>2023-05-04T23:06:50.884Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/696/0*YjcRZ3OUj5skmdcq" /></figure><p><strong>Introduction</strong></p><p>The Digital Ads Industry may be one of the most overlooked carbon emitters. Unfortunately, understanding and measuring the carbon footprint of a ‘non-tangible’ industry like Digital Ads is not as easy and evident as in sectors like aviation. Still, according to some estimates, the internet has a large carbon footprint share of 3.5% of global emissions.</p><p>There has been much discussion recently in the tech industry about strategies to reduce cost and carbon footprint due to the market demand for low-emission. GumGum is continuously looking for ways to decarbonize its digital presence as part of its <a href="https://www.adexchanger.com/adexplainer/adexplainer-what-is-supply-path-optimization-spo/">Supply Path Optimization (SPO)</a> efforts, which led the DevOps team to explore switching to <a href="https://www.arm.com/">ARM</a> processors. <a href="https://www.arm.com/">ARM</a> processors use significantly less energy than traditional x86 processors, making them an attractive option for those looking to reduce their environmental impact. This blog post will explore what ARM processors are and how at GumGum, we reduced our Ad Exchange computing cost by <strong>25%</strong> and carbon emissions by up to <strong>60%</strong> by switching to ARM processors.</p><p><strong>AdTech ecosystem carbon emissions</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Bs6H7qDnXtueyPMN" /><figcaption><em>Figure 1. Programmatic Supply Chain Emissions</em></figcaption></figure><p>The programmatic supply chain has many different and complex parts, and every piece has its emission challenges.</p><ol><li><strong>Demand Side Platforms (DSP)</strong> — Enables advertisers to automatically purchase digital ad space made available by media publishers on an exchange.</li><li><strong>Supply Side Platforms (SSP)</strong> — Used by publishers to manage space inventory.</li><li><strong>Data Management Platform (DMP)</strong> — Centralized data warehouse to collect and analyze data from different sources to ensure Ads are displayed to the right audience</li><li><strong>Ad Exchanges — </strong>This is where the magic happens; the dark, smoke-filled room where traders meet to agree on a price.</li></ol><p>Every part of this ecosystem relies on servers and devices to operate and run digital ad campaigns that generate heat and carbon that fall under brands’ and advertisers’ Scope 3 emissions. Scope 3 Emissions are those caused by activities outside of owned assets, but still impacting the company’s value chain. Every ad call and a layer of ad tech activated within the programmatic ecosystem carries a carbon footprint — even the failed bids for the ads not delivered require media storage, computing power, and network traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JZf_Dh-WJnbK_H2O" /><figcaption><em>Figure 2. Carbon emissions equivalent to 1M Ad Impressions</em></figcaption></figure><p>GumGum’s AdTech platform runs on the AWS cloud, which means we can track the company’s carbon footprint with the “<a href="https://aws.amazon.com/aws-cost-management/aws-customer-carbon-footprint-tool/">Customer Carbon Footprint Tool</a>.” The tool provides GumGum’s total carbon emissions and a few details grouped by geography and AWS Service. In 2021, GumGum produced around 227 metric tons of CO2 emissions vs. 310 metric tons in 2020, and we are expecting another aggressive reduction in 2022 after migrating to ARM-based processors.</p><p><strong>ARM Processors, Energy saving choice</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/0*Pcn0YiJr5R_GeCLw" /></figure><p>The fundamental difference between x86 and x86–64 architectures and ARM is in its name (Advanced RISC Machine). Here, RISC means Reduced Instruction Set Computer, meaning that ARM processors use fewer instructions and consume less energy. Unfortunately, this comes with a potential for performance reduction. But finally, in May 2022, <a href="https://aws.amazon.com/blogs/aws/new-amazon-ec2-c7g-instances-powered-by-aws-graviton3-processors/">Amazon announced its Graviton3 C7g ARM instances for compute-intensive workloads</a>, which set the stage for us at GumGum to start one of our coolest experiments with ARM processors as an alternative to omnipresent x86-based EC2 instances powered by Intel and AMD.</p><p><strong>AWS Graviton Migration</strong></p><p>The Ad Exchange platform is the biggest application here at GumGum. It is a monolithic Java-Spring application that runs on large EC2 instances and spans multiple AWS regions, suggesting a change in a key component of the application platform, the server processor, has to be evaluated, tested, and deployed. Thus, when changing the application base architecture from x86 to ARM, you have to consider all the software that makes up no the platform supporting your application.</p><p>For GumGum, this looks like this:</p><ul><li>Ubuntu is the base OS</li><li>Tomcat as the Java application server</li><li>OpenJDK 17</li><li>FluentBit agent</li><li>Sumologic hosted collector</li><li>Nginx HTTP Server</li><li>NewRelic Java APM agent</li><li>Consul Client for Service Discovery</li><li>Ad Exchange is a Java-Spring application.</li></ul><p>The main challenge for the migration was building the <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html">AWS AMI (Amazon Machine Image) </a>for Ad Exchange, which requires finding the compatible ARM-based release/version for all of the dependencies/tools mentioned above. Fortunately, the ARM software ecosystem is rich and well-maintained. As a result, we got a ready-to-be-tested ARM-based Ad Exchange AMI earlier than expected, thanks to our solid Packer/Ansible AMI bakery automation. Furthermore, the Java-Spring Ad Exchange application&#39;s migration was free because Java is a portable platform language and doesn’t need to be recompiled.</p><p>The next step was to test this new ARM-based version of Ad Exchange, so we picked up a small cluster in which we rolled out the AMI using ARM-based EC2 instances with similar CPU Cores and Memory. After testing this ARM-based version of Ad Exchange for a few weeks, we can conclusively say that:</p><ul><li>The overall EC2-associated cost of the Ad Exchange platform has been reduced by up to 25%</li><li>The availability of ARM-based Spot instances, heavily used by Ad Exchange, has been almost 100% since we started this test, which is great news for the Finance team at GumGum.</li><li>The performance of the ARM-based instances is similar to the equivalent x86-based instances.</li><li><a href="https://aws.amazon.com/ec2/spot/">The Spot</a> availability of the latest generation of <a href="https://aws.amazon.com/ec2/graviton/">Graviton</a> 3-based instances (c7g) is not good, mostly because AWS released the instance family in May 2022.</li><li>The carbon emissions related to the Ad Exchange EC2 instances will be reduced by up to 60%!</li></ul><p>After the initial test, we decided to fully roll out the ARM-based version of Ad Exchange to all clusters and AWS regions, and the results are better than expected. “<em>Intel for </em>Ad Exchange<em> is dead; long live ARM-based instances!</em>”</p><p><strong>What comes next?</strong></p><p>Given our great success with the Ad Exchange migration to ARM-based processors, we are now eager to test and migrate the other EC2-intensive workloads at GumGum, including data streaming platforms, machine learning systems, Kubernetes clusters, and more!</p><p><strong>Key Takeaways</strong></p><ul><li>Graviton-based (ARM) EC2 instances have better price performance than similar x86-based instances; therefore, they should be considered for any workload.</li><li>The software ecosystem for ARM is rich and well-maintained, including major Linux distributions, open-source tools, and Docker images.</li><li>Graviton-based servers are a great option to reduce your AWS infrastructure workloads’ carbon footprint and energy consumption.</li><li>Graviton processors use ARM architecture, which is available in most cloud vendors, meaning that migration to this platform does not mean vendor lock-in.</li><li>Every application and workload is different, so you should carefully analyze and test if you migrate to ARM-based instances. First, establish the KPI/metrics you need to watch out for during the migration: performance, scaling, latency, and % errors.</li><li>Realize that reducing emissions does not mean sacrificing revenue or increasing costs.</li></ul><p>References:</p><ul><li><a href="https://www.sharethrough.com/blog/infographic-research-reveals-consumer-understanding-of-advertisings-impact-on-carbon-emissions">https://www.sharethrough.com/blog/infographic-research-reveals-consumer-understanding-of-advertisings-impact-on-carbon-emissions</a></li><li><a href="https://www.admonsters.com/ad-techs-sustainable-programmatic-supply-chain/">https://www.admonsters.com/ad-techs-sustainable-programmatic-supply-chain/</a></li><li><a href="https://www.sharethrough.com/blog/infographic-understanding-how-the-programmatic-supply-chain-generates-co2-emissions">https://www.sharethrough.com/blog/infographic-understanding-how-the-programmatic-supply-chain-generates-co2-emissions</a></li><li><a href="https://www.trustedreviews.com/explainer/what-is-arm-processor-architecture-4045044">https://www.trustedreviews.com/explainer/what-is-arm-processor-architecture-4045044</a></li></ul><p>We’re always looking for new talent! <a href="https://gumgum.com/careers">View jobs</a>.</p><p>Follow us: <a href="https://www.facebook.com/gumguminc">Facebook</a> | <a href="https://twitter.com/gumgum">Twitter</a> | | <a href="https://www.linkedin.com/company/167379/">Linkedin</a> | <a href="https://www.instagram.com/gumgum/">Instagram</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ddc2f37e16d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gumgum-tech/aws-graviton-eco-friendly-technology-slashed-25-of-gumgums-computing-cost-8ddc2f37e16d">AWS Graviton eco-friendly technology slashed 25% of GumGum’s computing cost</a> was originally published in <a href="https://medium.com/gumgum-tech">GumGum Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing Kubernetes: The Hidden Part of the Iceberg — Part 2]]></title>
            <link>https://medium.com/gumgum-tech/implementing-kubernetes-the-hidden-part-of-the-iceberg-part-2-d76d21759de0?source=rss-fbeefd7b7fae------2</link>
            <guid isPermaLink="false">https://medium.com/p/d76d21759de0</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[devops-practice]]></category>
            <category><![CDATA[kubernetes-engine]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <dc:creator><![CDATA[Santiago Campuzano]]></dc:creator>
            <pubDate>Tue, 28 Sep 2021 12:36:41 GMT</pubDate>
            <atom:updated>2021-09-28T21:54:52.584Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Implementing Kubernetes: The Hidden Part of the Iceberg — Part 2</strong></h3><p>Kubernetes Scheduling and Resource Management.</p><figure><img alt="A crane carrying shipping containers" src="https://cdn-images-1.medium.com/max/852/0*tcR34EjzSESMNZLh.jpg" /><figcaption>Figure 1. A gantry crane — a specialized type of crane for loading and unloading container vessels.</figcaption></figure><p>In the <a href="https://medium.com/gumgum-tech/implementing-kubernetes-the-hidden-part-of-the-iceberg-part-1-76c3e9684d49">1st part</a> of this K8S series, we covered much ground related to building, maintaining, and operating an extensive fleet of K8S clusters. This 2nd part will be more condensed and focused on Kubernetes Resource Management and Scheduling.</p><p>If we look up the official definition of Kubernetes at kubernetes.io, it says, “<em>Kubernetes, also known as K8s, is an open-source system for automating </em><strong><em>deployment</em></strong><em>, </em><strong><em>scaling</em></strong><em>, and management of containerized applications.</em>”. So there are two words in this definition that make Kubernetes’s deployment and scaling of containerized applications: deployment and scaling. Although deployment and scaling are K8S concepts that involve a lot of documentation, fine-grained technical configuration, and squares of hours to understand and implement correctly, I will try to keep it simple and stick to our experiences at GumGum.</p><h3>The Kubernetes Scheduler</h3><p>Roughly speaking, the Kubernetes scheduler is in charge of watching for new Pods and deciding the best/optimal Nodes to run them on, based on a myriad of criteria and real-time metrics collected from the cluster nodes and the applications. This scheduling challenge will be as straightforward or as complicated as your microservices and workloads are. Typically, on a production-grade K8S cluster, you will have many different microservices/applications, each with a different CPU, memory, networking, storage, and possible other non-implicit constraints and requirements that we will mention later. The K8S scheduler must consider those requirements and restrictions to properly decide the optimal nodes to run your applications/Pods.</p><p>As with any other algorithm, the scheduler’s decisions will be as accurate and optimal as the quality of the provided application’s details. Therefore, resource requests and limits are the most critical information you should provide about your applications.</p><p>Before we dive into the details of the K8S scheduler, resource management, and the related auto-scaler, I’d like to borrow a great analogy that I found when reading articles and documentation on this topic and continue from now on using that analogy so that the reader can get more familiar with the concepts.</p><p>The Kubernetes scheduling process is like the Tetris game, slightly different, but keeping the basics from the game:</p><ol><li>In Tetris, you have a board/field with a fixed dimension of N rows and M columns; in the Kubernetes land, you have a Node(s) with a limited amount of N CPU and M memory.</li><li>In Tetris, you have incoming geometrical shapes or <a href="https://en.wikipedia.org/wiki/Tetromino">tetrominoes</a> that the player has to accommodate in the field/board, trying to optimize the available space; in K8S, you have incoming Pods that the scheduler has to accommodate in the existing Nodes, which have some free amount of memory and CPU each, same as Tetris, trying to optimize the available resources.</li></ol><p>Following the analogy, the Kubernetes Scheduler is the Tetris player that has to make quick and optimal decisions about the best way to accommodate the incoming requests for new Pods that need to be executed in the Cluster. To refresh your Kubernetes knowledge, you must remember that the pod is the smallest schedulable unit in a K8S cluster. Still, the pod is made of one or more containers, each having a different CPU and memory requirements.</p><figure><img alt="Tetris game" src="https://cdn-images-1.medium.com/max/600/0*o_EcKICTjam5KjL5" /><figcaption>Figure 2. The Kubernetes scheduler as a Tetris player analogy</figcaption></figure><p>Let’s take a look at the following Java application that has been containerized to take full advantage of all the bells and whistles that come from running it in a platform like K8S. According to figure 3, the application requires 8 Gib of memory and 1.5 vCores of CPU to properly work; properly meaning an approximate number of RPS, concurrent users, TPS, or whatever workload measure you want to use.</p><figure><img alt="Chart showing 8 Gib of memory and 1.5 vCores of CPU" src="https://cdn-images-1.medium.com/max/1024/0*V0U3vfBeRwQbnV2w" /><figcaption>Figure 3. Java container/Pod that needs to be scheduled</figcaption></figure><p>To run this Java application on a K8S cluster, you will create a Pod resource definition that will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DM2wdWa_2hHMr0xLpQeLaA.png" /><figcaption>Figure 4. Java standalone Pod definition without resources.</figcaption></figure><p>If you create this pod on any Kubernetes cluster, it will be scheduled and possibly executed if at least one node is available. One problem with this Pod definition is that it does not have any CPU and memory specifications, so it’s like if the Tetris player, a.k.a. the K8S scheduler, receives a piece that needs to be accommodated, but without any information about its dimensions, a.k.a. CPU and memory. The pod will be scheduled for sure, but we don’t know if it will be able to run and if it’s able to run, we don’t know if it will be able to handle the expected workload. That’s why we need to properly define both requests and limits for the CPU and the memory.</p><h3>Resource Limits and Requests</h3><p>Following the above-mentioned Java application example, if we want K8S to execute the application correctly, we need to instruct the scheduler on the CPU and memory it requires, given a particular workload. The container’s CPU and memory <em>instructions</em> for Kubernetes are provided using the resources dictionary, as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6KhbIvczdeGgHS146cD3pQ.png" /><figcaption>Figure 5. Single-container Pod definition with resources definition</figcaption></figure><p>The resources dictionary has two parts, the <strong>requests</strong> and the <strong>limits</strong>. To summarize, the cpu and memory <strong>requests</strong> are used by the Kubernetes scheduler to decide the best node to accommodate the pod. In contrast, the cpu and memory <strong>limits </strong>are used by the <strong>kubelet </strong>to enforce the maximum cpu and memory that the container can use at any time. The kubelet also reserves at least the <strong>request</strong>ed amount of cpu and memory specifically for that container to use. If the pod has more than one container, all container requests are added up for scheduling purposes, while the limits are enforced individually per <strong>container.</strong></p><p>Let’s consider the following example of a Deployment with a multi-container Pod:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*DbUrnSTNbK-FqegTcgRZrQ.png" /><figcaption>Figure 6. Multi-container Pod definition with resources definition.</figcaption></figure><p>Let’s say we are running a single-node cluster, with, for example, four vCPUs and 16GB RAM nodes. Then, we can extract a lot of information:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oqtfarnlaAhKxvB1.png" /><figcaption>Figure 7. Multi-container Pod definition — CPU and memory resources</figcaption></figure><ol><li>Pod effective request is 400 MiB of memory and 600 millicores of CPU. Therefore, you need a node with enough free allocatable space to schedule the pod.</li><li>CPU shares for the redis container will be 512 and 102 for the busybox container. Kubernetes always assign 1024 shares to every core, so:<br>redis: 1024 * 0.5 cores ≅ 512<br>busybox: 1024 * 0.1cores ≅ 102</li><li>Redis container will be OOM killed if it tries to allocate more than 600MB of RAM, most likely making the pod fail.</li><li>Redis will suffer CPU throttle if it tries to use more than 100ms of CPU in every 100ms (since we have four cores, available time would be 400ms every 100ms), causing performance degradation.</li><li>Busybox container will be OOM killed if it tries to allocate more than 200MB of RAM, resulting in a failed pod.</li><li>Busybox will suffer CPU throttle if it uses more than 30ms of CPU every 100ms, causing performance degradation.</li></ol><p>There are probably hundreds of blog posts and documents related to Kubernetes container resource limits and requests. Still, it’s never enough to stress the criticality of <strong><em>ALWAYS</em> </strong>setting up both resource limits and requests for any application deployed to Kubernetes, and you will understand that sooner or later.</p><h3>How to properly setup resource request and limits?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*xwKuAbPRYcxeZO0R" /><figcaption>Figure 8. Different resource requirements per application type.</figcaption></figure><p>Defining the right values for both the CPU and memory requests and limits can be a challenge, depending on the kind of application/container that you are dealing with. There are certain technologies, like Java, that let the user to restrict the maximum memory usage at any time, regardless of the workload, but the CPU won’t be restricted and it would be throttled by the Kublet and/or container runtime engine.</p><p>Running a load test on your local or dev/test environment should be a good approach to better understand the real requirement of CPU and memory for your application. I personally recommend using <a href="https://locust.io/">Locust</a>, an amazing OpenSource/distributed load testing tool, that will greatly help you to quickly setup and run a load test of any size and/or complexity. After running the load test for a considerable time, the following guidelines should be a general approach for setting limits and requests for your containers/Pods.</p><ol><li>For applications where the <strong>memory</strong> reserved/used remains the same regardless the workload (like most JVM-based applications), you should set both <strong>requests</strong> and <strong>limits</strong> for <strong>Memory</strong> to the same value.</li><li>For applications where the memory reserved/used varies according to the workload, you should set the <strong>Memory request </strong>to the value observed when the application is during a “normal” workload of users and/or RPS and the <strong>Memory limit </strong>set to 20–30% above that value</li><li>For applications where the CPU utilization is related with the workload, you should set the <strong>CPU request </strong>to the value observed when the application is during a “normal” workload of users and/or RPS and the <strong>CPU limit </strong>set to 40–50% above that value, due to the CPU being a special kind of resource, that can be compressed or throttled by the container runtime (kubelet), and can be somehowshared with other containers.</li></ol><p>Figure 9 and 10 briefly describe the possible consequences of setting too low or too high values for both CPU and memory (requests and limits).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/0*6BLrYrUhLZpTD1JR.png" /><figcaption>Figure 9. Possible consequences of too low or too high Requests</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/0*reV4GZgV1okvDKYy.png" /><figcaption>Figure 10. Possible consequences of too low or too high Limits</figcaption></figure><h3>Key Takeaways</h3><ol><li>Defining requests and limits in your application’s containers is hard, but necessary.</li><li>Getting those values right can be a daunting task unless you rely on a proven method, like load testing.</li><li>The Kubernetes Scheduler is the component in charge of determining which node is most suitable for running pods, based on the <strong>requests</strong> defined.</li><li>If you set too low or too high values for the resources and limits for your Pod’s container(s) you will face potential issues like resource starvation and resource waste.</li></ol><h3>Conclusion</h3><p>While your Kubernetes cluster and workloads might work fine without setting resource requests and limits, you will start facing stability issues as your teams and projects grow. Adding requests and limits to your Pods and Namespaces only takes a little extra effort, and can save you from being paged at 3:00 AM !</p><p>We’re always looking for new talent! <a href="https://gumgum.com/careers">View jobs</a>.</p><p>Follow us: <a href="https://www.facebook.com/gumguminc">Facebook</a> | <a href="https://twitter.com/gumgum">Twitter</a> | | <a href="https://www.linkedin.com/company/167379/">Linkedin</a> | <a href="https://www.instagram.com/gumgum/">Instagram</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d76d21759de0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gumgum-tech/implementing-kubernetes-the-hidden-part-of-the-iceberg-part-2-d76d21759de0">Implementing Kubernetes: The Hidden Part of the Iceberg — Part 2</a> was originally published in <a href="https://medium.com/gumgum-tech">GumGum Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing Kubernetes: The Hidden Part of the Iceberg — Part 1]]></title>
            <link>https://medium.com/gumgum-tech/implementing-kubernetes-the-hidden-part-of-the-iceberg-part-1-76c3e9684d49?source=rss-fbeefd7b7fae------2</link>
            <guid isPermaLink="false">https://medium.com/p/76c3e9684d49</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Santiago Campuzano]]></dc:creator>
            <pubDate>Tue, 11 May 2021 20:49:18 GMT</pubDate>
            <atom:updated>2021-10-30T17:36:12.442Z</atom:updated>
            <content:encoded><![CDATA[<h3>Implementing Kubernetes: The Hidden Part of the Iceberg — Part 1</h3><figure><img alt="Comic about how much is involved with Kubernetes. A dinosaur expresses excitement at starting Kubernetes and plunges into the deep end of a lake as you see all the elements involved with Kubernetes." src="https://cdn-images-1.medium.com/max/1024/0*ARf3gMi8UjxrNMTJ" /><figcaption>Figure 1: Kubernetes comic</figcaption></figure><p>The main goal of writing this article was to gather personal and team experiences and challenges when implementing a production-grade fleet of <a href="https://kubernetes.io/">Kubernetes</a> clusters at <a href="https://gumgum.com/">GumGum</a>. I hope you enjoy the reading!</p><p>This is Part 1 of this series. You can find Part 2 <a href="https://medium.com/gumgum-tech/implementing-kubernetes-the-hidden-part-of-the-iceberg-part-2-d76d21759de0">here</a>.</p><h3>The Tip of the Iceberg</h3><p>Everyone is in love with <a href="https://kubernetes.io/">Kubernetes</a>. It’s the most popular high school student, and no one can escape their enchants. It seems to be perfect, as it aims to solve most of the problems modern companies face when dealing with complex microservice architectures and cloud-native applications. Most people are convinced about that, and whenever asked about how to handle this situation, a single word pops up in your mind: Kubernetes.</p><p>Kubernetes will provide your applications with service discovery, health checks, autoscaling, scheduling, enhanced security, and way more. Wow, that sounds amazing! <em>You must be a stone-age DevOps/Developer if you don’t want to follow the Kubernetes path. </em>Well, that is just the tip of the Iceberg.</p><p>That is what most people navigating the vast IT landscape can see when looking at Kubernetes. Let me confess something about myself: I’ve been navigating those IT seas for quite some time. I don’t consider myself to be a captain, maybe a helmsman, but I am a very seasoned sailor, one that has seen a lot of beautiful things and treasures, but one that had also witnessed ships (teams and projects) sink after colliding with gigantic icebergs, like SOA Architecture, Virtualization, Cloud Computing, etc. Don’t get me wrong. I am not an IT caveman; I love new technologies. I am passionate about reading, learning, and implementing new tech, tools, and frameworks. My key point is that most of these technology trends/innovations have been tremendously overhyped, and the same is true about Kubernetes. As I mature as a DevOps Engineer, I try to be more watchful and thoughtful about new technologies, like Kubernetes, to make sure I understand what I’m getting my company into.</p><h3>GumGum’s Kubernetes Voyage</h3><p>Our Kubernetes voyage has an exciting background. Back in 2017, we were sweating and battling with our container orchestration solution, <a href="https://aws.amazon.com/ecs/">AWS ECS</a>. We implemented ECS mostly because GumGum was born as a 100% cloud-native company, working with AWS since its beginnings in 2008, so implementing ECS was a natural move for us after Dockerizing our apps. When I joined GumGum in 2018, I had previous experience with Docker and some of its ecosystems, like Docker Swarm, <a href="http://mesos.apache.org/">Apache Mesos</a>, and <a href="https://mesosphere.github.io/marathon/">Marathon</a>, but ECS was entirely new. To be honest, ECS lacked a lot of the required features to be a mature/production-ready container orchestration engine, including proper service discovery and volume management, and the scheduling and autoscaling features are trivial. Long story short, we decided that it was time to move away from ECS to a more mature, scalable, and feature-rich container orchestration system. We raised our heads, looked up to the horizon, and it was there: Kubernetes!</p><p>As a DevOps team, we decided that it was time to migrate all our container/cloud-native applications to Kubernetes; in the end, it was a no-brainer. Kubernetes provided all the features that ECS was lacking and more than that. Kubernetes became the industry-standard container orchestration engine, and it would have been misguided to not accept that reality. The Kubernetes ecosystem was vast, we loved what we saw, but with so many building blocks to pick from, we needed a map. We will talk about that more later on.</p><h3>How we Implemented Kubernetes at GumGum</h3><p>OK, we decided to migrate from ECS to Kubernetes. Now what? Whenever you embark on a project with an enormous scope, it’s critical that you spend time to understand the trade-offs of each solution for the business. To do this, you need to ask hard questions and research all available options. Right after, we started to have some heated — but professional — internal discussions. Everyone was proposing ideas, tools, strategies, frameworks to deploy Kubernetes at GumGum properly. Some of the questions and concerns that we discussed, and you should also consider, were:</p><ul><li>Are we going to deploy, configure and manage Kubernetes ourselves?</li><li>How are we going to build, package, test, and deploy the applications to Kubernetes?</li><li>How are we going to monitor the applications deployed to Kubernetes and the Kubernetes control plane itself?</li><li>How are we going to collect and aggregate logs for the apps running in the clusters? Are any application changes needed?</li><li>As we run applications on AWS, how will we grant and isolate IAM permissions for every application?</li><li>When deploying/running stateful applications, how will we provision and manage the required persistent storage for the apps (PV/PVC)?</li><li>How are we going to handle apps secrets securely?</li><li>How will developers and administrators access the Kubernetes clusters and resources?</li></ul><p>These are just a sample of questions that developers and DevOps engineers have to answer when deploying and managing Kubernetes for an enterprise. I am not talking about playing around with minikube or k3s, which requires a couple of CLI commands to have up and running a bare Kubernetes cluster to which you can deploy and test your newly developed microservice. I am talking about deploying, configuring, and maintaining a Kubernetes cluster capable of scheduling, running, and monitoring applications handling 100,000 requests per second, all without disrupting the services’ availability or the DevOps team’s sweet dreams (hopefully).</p><p>Those questions are the <strong>Hidden Part of the Iceberg</strong>, the often-overlooked aspects of Kubernetes that most people don’t consider when migrating their stack to Kubernetes. Unfortunately, these limitations are often discovered much later, when design changes are much more expensive. I include myself and part of my team into that majority of the people. To be honest, we overlooked many of those questions listed above. We started taking them into account when our ship sailed (Kubernetes) and its containers started scraping up against an enormous iceberg hidden underneath the surface.</p><h3>Kubernetes Deployment Strategy</h3><p><strong>“All you need to do is run minikube, right?”</strong></p><p>Deploying a Kubernetes cluster can be as simple as running:</p><p>brew install minikube &amp;&amp; minikube start</p><figure><img alt="Code sample of what happens when you start minikube" src="https://cdn-images-1.medium.com/max/800/0*kUPo6AKFluK87FOv" /><figcaption>Fig 2 — Spinning up a cluster with minikube</figcaption></figure><p>As I mentioned earlier, deploying and running a Kubernetes cluster like this should be enough for local development purposes and for learning and exploring the Kubernetes universe, but not enough when you need to run real-world applications serving users and systems that need to be online 24/7.</p><p>Deploying and configuring a production-grade Kubernetes cluster requires repeatability, predictability, consistency, and safety when installing, configuring, upgrading, and managing any Kubernetes clusters.</p><p>Before choosing the strategy and tool to deploy your fleet of Kubernetes clusters, you need to consider one key aspect of the Kubernetes strategy, probably the most crucial question/factor: should you use a managed Kubernetes solution (AKS, EKS, GKE, Rancher, OpenShift)? Or is it going to be a vanilla Kubernetes distribution that you will deploy and manage by yourself? This is a profound question that should be answered after thoughtful consideration. If you consider deploying and managing a fleet of Kubernetes clusters by yourself, be prepared to spend a lot of time and energy from you and your team to maintain those clusters. Some large companies have the budget for a dedicated Kubernetes team, which makes sense given their scale and regulatory needs. They will have more control and probably will be saving money at the end of the day. But if you are a startup or a small/medium company, I would say that the most reasonable deployment strategy is to use a cloud/managed Kubernetes distribution/deployment, and in that land, there are a few leading players to consider:</p><ul><li><a href="https://cloud.google.com/kubernetes-engine">Google Kubernetes Engine</a> (GKE)</li><li><a href="https://aws.amazon.com/eks/">Amazon Elastic Kubernetes Service</a> (EKS — GumGum’s Choice)</li><li><a href="https://azure.microsoft.com/en-us/services/kubernetes-service/">Azure Kubernetes Service</a> (AKS)</li><li><a href="https://rancher.com/products/rke/">Rancher Kubernetes Engine</a> (RKE)</li><li><a href="https://www.openshift.com/">RedHat OpenShift</a></li><li><a href="https://us.alibabacloud.com/">Alibaba Cloud Container Service for Kubernetes</a> (ACK)</li></ul><p>I am not going to do a deep dive into each of the KaaS (Kubernetes as a Service) offerings, as that would be a huge blog post on its own, but for GumGum, the decision was relatively easy to make. As I mentioned earlier, GumGum is a 100% cloud-native company, with all the cloud eggs residing in one basket: AWS. So, picking a different vendor/cloud provider for our managed Kubernetes solution would have led to additional management overhead (managing two cloud vendors instead of one), paying hefty networking fees due to all the traffic between the fleet of Kubernetes clusters and our AWS VPCs, and other unexpected results of this multi-cloud strategy (expect the unexpected!) Although I must recognize that Google GKE is the most advanced managed Kubernetes platform out there, this makes sense given that Google invented Kubernetes itself (<a href="https://kubernetes.io/blog/2015/04/borg-predecessor-to-kubernetes/">Borg</a>)!</p><figure><img alt="Kubernetes joke: “Running a bare metal Kubernetes cluster in production isn’t stressing me out anymore” — Mark, 22 years old, with an image of a much older man" src="https://cdn-images-1.medium.com/max/800/0*Y1osauY9GCrQgfCV" /><figcaption>Fig 3 — Running a bare metal Kubernetes Cluster</figcaption></figure><p><strong>Kubernetes Deployment Tool</strong></p><p>Now you have chosen a pattern or platform to deploy Kubernetes for your company. That’s amazing! But wait, we are just starting to pave the road to a successful and mature fleet of Kubernetes clusters. You need some sort of tool/platform that will help you with the installation, configuration, management, and upgrade of your clusters. The most popular tools for doing the job are kops, kubeadm, kupespray, kargo, and Terraform. While I’m not going to compare those tools in this article, here is a couple of interesting links that will shed some light on the matter:</p><ol><li><a href="https://platform9.com/docs/deploy-kubernetes-the-ultimate-guide/">Kubernetes Deployment: The Ultimate Guide</a></li><li><a href="https://www.altoros.com/blog/a-multitude-of-kubernetes-deployment-tools-kubespray-kops-and-kubeadm/">A Multitude of Kubernetes Deployment Tools</a></li></ol><p>Terraform is not a tool designed specifically for deploying Kubernetes clusters, but its powerful and flexible capabilities make it an ideal tool for doing this job. We selected Terraform because we have been growing and maturing expertise with the tool and its ecosystem, which we use for provisioning and maintaining all kinds of AWS infrastructure. The next step with Terraform and EKS was to create a flexible but robust reusable module to deploy, update, and maintain Kubernetes clusters across all AWS regions and accounts. AWS provides and supports an official <a href="https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/latest">Terraform module for EKS</a>. Using that as a base EKS module, we created our own module, with additional features and perks such as IAM-based authentication, Spot.io integration (for provisioning <a href="https://aws.amazon.com/ec2/spot/">spot-based</a> worker nodes), and AWS Secrets Manager integration.</p><p>Having our custom Terraform module in place, we now needed a mechanism for safely creating, modifying, and upgrading our small fleet of Kubernetes clusters. By the time of writing this article, GumGum operated 20 EKS clusters across 4 AWS regions.While not Google-scale, this fleet is large enough (and will grow more) to necessitate automation for its management. For this, we built a CI/CD pipeline created with <a href="https://www.drone.io/">Drone</a> and <a href="https://terragrunt.gruntwork.io/">Terragrunt</a> (Terraform thin wrapper), which helps us maintain a DRY infrastructure. So far, Drone, Terraform, and Terragrunt have been the right fit for GumGum. That stack worked well originally, but scaling up had limitations, like how to handle breaking changes or testing to make sure an upgrade went through okay. For that reason, we are considering moving to a more robust and fully managed CI/CD solution, like <a href="https://harness.io/">Harness.io</a> which we will use to fully automate upgrades by utilizing canary deployments and automatic roll-backs.</p><figure><img alt="Image of sample GumGum drone.io pipeline" src="https://cdn-images-1.medium.com/max/800/0*-2eHRD0tTqKxM4OB" /><figcaption>Fig 4 — Drone.io pipelines for provisioning and updating EKS clusters.</figcaption></figure><p><strong>Application Deployment</strong></p><p>We just started to dive below the surface, trying to understand the most extensive hidden parts of the Iceberg. With the great help of EKS, Terraform and Drone, we now have a shiny and brand-new fleet of Kubernetes clusters, ready to be loaded with the most complicated and heavy containers/applications. Hey, we just discovered a new piece of the Iceberg! How will we deploy, configure and update all the applications and microservices we want to run into our Kubernetes clusters? Running kubectl apply =f my-application.yaml should be more than enough for having your application up-and-running in a matter of seconds, sure, but if you have tens or hundreds of applications running on several Kubernetes clusters, across different environments (dev, staging, prod, etc.), then using your old and reliable kubectl friend is not enough. As for the Kubernetes cluster deployment problem, we needed to find a solution to this challenge. When we started this Kubernetes endeavor at GumGum, there were tens, if not hundreds, of different tools and methodologies for deploying applications to Kubernetes.</p><p>When picking the right tools to help you with Kubernetes, you can be, and you will be, overwhelmed by the vast landscape of open source and commercial applications, frameworks, tools, methodologies, and approaches available to help you solve your challenges. To give you an idea of the size of this vast space, the following screenshot is the most up-to-date “CNCF Cloud Native Interactive Landscape”, which contains 919 OSS projects backed by the CNCF (<a href="https://www.cncf.io/">Cloud Native Computing Foundation</a>). Although those projects are not strictly Kubernetes projects, all of them can be used in conjunction with Kubernetes, and I consider this landscape to be an indispensable resource when diving into a new Kubernetes-related technology. In addition to that landscape, there are thousands of opens-source projects related to Kubernetes somehow. Just searching the term “Kubernetes” on GitHub returned 80K results! Don’t feel intimidated by this vastness of tools and frameworks; use your judgment and instincts when picking a specific tool. If you are considering a particular tool for your Kubernetes stack, please consider one that is well supported and maintained by the community, with enough adoption and well-written documentation.</p><figure><img alt="Image of all the players in the cloud native landscape. The image contains many many many logos." src="https://cdn-images-1.medium.com/max/800/0*jv7bm3m-fn-W1pnZ" /><figcaption>Fig 5: CNCF Landscape.</figcaption></figure><p>Putting that aside and going back to the main idea of application management and deployment, it is crucial to consider a tool or toolchain to help you with the building, packaging, distribution, deployment, and maintenance of your Kubernetes applications. Let’s crumble this a little bit so we can better digest the whole idea. As with any other mature software build and release process, most modern enterprises have adopted CI/CD practices and tools that significantly improve the speed and quality of the software delivered to the customers, and there is no novelty here. What we need to understand is how to translate those well-established patterns and methodologies to the Kubernetes land.</p><p>To tackle the challenge of packaging, deploying, and updating applications into a Kubernetes cluster, we decided to go with the previously de facto/industry-standard tool: <a href="https://helm.sh/">Helm</a>. As with any other tool and technology, there will always be fans and detractors of Helm. It is not about taking positions; it is about understanding your needs and the pros and cons before deciding what tool you’re going to implement for your Kubernetes stack. When we started implementing Kubernetes at GumGum, Helm v3 was just released, with whistles and bells, and because it was the industry-standard tool, it was a no-brainer decision to make. I am not going to deep dive into Helm, as that requires and deserves a lot of blog posts per se. Still, I need to emphasize that a huge community has grown around Helm, with many active charts being developed and and some great tooling has emerged like like <strong>helmfile</strong> and <strong>helmsman</strong>, which will significantly help your team with Helm adoption and maintenance.</p><p>The remaining part of the software build and delivery process corresponds to the actual orchestration required to properly perform CI/CD with the tool(s) of your choice, in our case, Helm. As with the other challenges, this one has tens of tools/frameworks/methodologies that will fill the void and then some; as I recommend, try not to be overwhelmed by this. Carefully assess your needs, what you want to provide to your engineering teams and what you can support and maintain in time. Let me just list some of the tools that are worth mentioning:</p><ul><li>ArgoCD</li><li>Flux</li><li>Octopus Deploy</li><li>Harness</li><li>CircleCI</li><li>CodeFresh</li><li>Gitlab</li><li>Jenkins X</li></ul><h3><strong>Monitoring &amp; Logging</strong></h3><p>You are now becoming a Kubernetes Ninja; you’ve fully automated the deployment, management, and upgrading of your Kubernetes clusters and applications. A myriad of Kubernetes applications are running in tens or hundreds of Kubernetes clusters; that’s huge! But something is missing here: Your fleet of Kubernetes clusters is navigating blind. There’s a thick fog made of thousands of metrics and logs that don’t let you properly steer and maneuver your applications and clusters in a timely and proactive manner. You are the captain, and you feel like the guy in the picture below, staring at this massive panel of instruments, dials, levers, and counters that you kind of understand, but because of the amount and complexity of those metrics, you are not able to assess the actual state of the fleet of clusters. Your team asks many questions; but they mainly want to know what is going on with their precious applications running there. You want to provide the correct answers, so you need a comprehensive, integrated, and easy-to-deploy and manage Monitoring and Logging solution. I decided to merge these two critical categories into one: Observability, precisely what we want to accomplish with the fleet of Kubernetes clusters and the multitude of applications running in there.</p><figure><img alt="Man staring at a panel of many levers and switches." src="https://cdn-images-1.medium.com/max/800/0*NTDH5Xg3h8pPmzGd" /><figcaption>Fig 6: Monitoring &amp; Logging a complex system</figcaption></figure><p><strong>Logging</strong></p><p>Let’s start with the often more requested and used feature of the observability paradigm: logging. Logging encompasses the process of producing, collecting, filtering, aggregating, and searching logs across lots of Kubernetes clusters and applications. Piece of cake, right? Well, it’s not as simple as it seems. Certain challenges and features need to be considered when choosing, designing, and implementing your logging strategy.</p><p>First of all, how are your applications producing logs? You need to properly understand this to know how you are going to capture/collect them. There are mainly two ways to emit/produce logs: Writing to log files and writing to standard and error output. Most modern logging frameworks such as log4j, SLF4j, logback, and others, provide you with rich configurations that will let you decide the appropriate logging levels (INFO, ERROR, etc.) for the messages that your applications produce as well as the destination for those messages, either a log file or the standard error/output or both. Sending messages to the standard error/output should be the preferred way when working with containerized applications, as most of the logging solutions compatible with Kubernetes will plugin to the container’s standard output/error, looking for the logs to collect and process.</p><p>Second, your applications produce messages/logs, but here comes a new challenge, how is your logging solution deciding what to collect and what needs to be ignored or dropped? You probably don’t want to collect every single piece of log emitted by all the pods running in your Kubernetes clusters. Remember that in addition to your application Pods, there are a considerable amount of Kubernetes cluster Pods (i.e., kube-proxy) that you may or not may want to collect logs from, as the high verbosity of some of those components could quickly eat up a large chunk of your logging quota (epecially when paying for a SaaS logging solution). In addition to that, if you are running a semi-managed or fully-managed Kubernetes cluster as we do, the cloud provider will be “responsible” for the health of those pods/components, so don’t waste precious logging resources on them. For this particular purpose of discovering, collecting, and sending logs to your preferred logging provider, we are leveraging an excellent Kubernetes operator created and maintained by VMWare: <a href="https://github.com/vmware/kube-fluentd-operator"><strong>kube-fluentd-operator</strong></a><strong>. </strong>Based on the robust and reliable fluentd project, this operator installs and auto-configure fluentd agents that run as a Daemon Set, based on custom ConfigMaps, one per namespace. You can easily customize your fluentd config from the most elementary cases of just collect and send container logs, to more advanced uses cases where you want to collect multi-line messages, filter out or drop unwanted records, etc. The operator supports multiple input and output plugins that can ship logs to most logging solutions out there, including the one we use and love at GumGum: Sumologic. We have just scratched the surface with the <a href="https://github.com/vmware/kube-fluentd-operator">kube-fluentd-operator</a>, meaning that we are kind of primary users and have not leveraged its full potential as an advanced-yet-easy-to-use Kubernetes logging operator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*6M6WMcc8raIHeiEb" /><figcaption>Fig 7 — Docker/container logging</figcaption></figure><p><strong>Monitoring</strong></p><p>The other side of the observability coin: monitoring. That powerful yet overlooked concept keeps developers and DevOps engineers wandering through many methodologies, best practices, tools, frameworks, and platforms that promise the monitoring nirvana; still, there is no such thing as that. It is impossible to have a perfect monitoring strategy; monitoring must be a continuous process looking for valuable insights and metrics for both the business and the IT stakeholders in a practical and cost feasible manner. Wow, I deserve a Nobel prize for that sentence. To be honest, the truth of monitoring is far away from that paragraph; most of the time, IT engineering teams tumble with monitoring. Large companies spend millions of dollars implementing fancy and huge monitoring platforms that may fail to deliver the promise to the end-users. Small and medium companies try to invest the least required time and money to achieve a decent monitoring platform, with mixed results. Regardless of the theory vs. the truth, monitoring applications running in a Kubernetes cluster, and Kubernetes itself, is usually more challenging than monitoring legacy/static infrastructure and applications. If you want to learn more about this, please look at this article that I created a while ago, discussing <a href="https://medium.com/gumgum-tech/prometheus-monitoring-at-scale-war-stories-from-the-gumgum-trenches-f66393c52d0a">this</a> matter.</p><p>Out of the box, a Kubernetes cluster comes with a minimal set of monitoring features, meaning that, as with the other challenges that we’ve been discovering down the road with Kubernetes, you need to provide the improved monitoring batteries to the Kubernetes cluster. The built-in monitoring mechanism, “metrics-server”, collects resource metrics from Kubelets and exposes them in the Kubernetes API server through Metrics API. Metrics-server is meant to be used mainly for HPA and VPA and as a source of metrics for more advanced monitoring platforms such as Prometheus.</p><p>Monitoring an entire fleet of Kubernetes clusters plus all the containers running on top of them requires a robust but flexible monitoring solution, which should tackle the following challenges:</p><ol><li><strong>Service Discovery.</strong> The solution must be compatible with any third-party Service Discovery mechanism, i.e., Consul or tightly integrated with the Kubernetes API, to discover all the Kubernetes resources that need to be monitored: Pods, Deployments, Services, etc. This is crucial for a microservices architecture, where each Service can be distributed across multiple instances, and containers move across your infrastructure as needed.</li><li><strong>Cloud-native metrics explosion and scale requirements</strong>. Monitoring metrics cardinality has exploded. Kubernetes adds some multidimensional levels, like cluster, node, namespace, or Service, so the different aggregations or perspectives can explode.</li><li>It should be <strong>capable of monitoring containers and get as many insights from them as possible</strong>. Containers are ephemeral in the Kubernetes world, so it means we need a tool capable of capturing all critical information and traces about them.</li><li>We need a monitoring system that allows us to <strong>alert for high-level service objectives but retains the granularity to inspect individual components as required</strong>.</li></ol><p>With these considerations in mind, now we can better understand why monitoring Kubernetes is very different from monitoring VMs and cloud instances.</p><p>Considering those requirements to properly monitor a Kubernetes cluster and its valuable load of containerized applications, we thought that the right fit for doing the job was <a href="https://prometheus.io/">Prometheus</a> after evaluating some alternatives. Why is Prometheus the most common tool for containerized environments? These four characteristics made Prometheus the de-facto standard for Kubernetes monitoring:</p><ol><li>The multidimensional data model is based on key-value pairs, similar to how Kubernetes organizes infrastructure metadata using labels. It allows for flexible and accurate time-series data, powering its Prometheus query language.</li><li>Accessible format and protocols: exposing Prometheus metrics is a straightforward task. Metrics are human-readable, in a self-explanatory format, and published using a standard HTTP protocol. You can check that the metrics are correctly exposed by using your web browser.</li><li>Service discovery: the Prometheus server is in charge of periodically scraping the targets so that applications and services don’t need to worry about emitting data (metrics are pulled, not pushed). These Prometheus servers have several methods to auto-discover scrape targets. You can configure some of them to filter and match container metadata, making it an excellent fit for ephemeral Kubernetes workloads.</li><li>Modular and high available components: metric collection, alerting, graphical visualization, etc., are performed by different composable services. All these services are designed to support redundancy and sharding.</li></ol><figure><img alt="Graph of how you use Kubernetes with Prometheus" src="https://cdn-images-1.medium.com/max/800/0*51AHOWZxoPzeef98" /><figcaption>Fig 8 — Kubernetes monitoring with Prometheus</figcaption></figure><p>We originally designed and implemented a self-hosted Prometheus and Grafana architecture that worked well when we started to ingest metrics from ECS and some other legacy EC2 platforms, but after a few billon metrics later, it began to show some signs of instability. The challenges and drawbacks of this implementation are mentioned in the above-mentioned article <a href="https://medium.com/gumgum-tech/prometheus-monitoring-at-scale-war-stories-from-the-gumgum-trenches-f66393c52d0a">“Prometheus Monitoring at Scale: War Stories from the GumGum Trenches”</a>. To overcome this challenge of hosting and scaling a HA Prometheus and Grafana platform, and since we are 100% AWS, we decided to give a try to of the most recent fully managed Service from Amazon: <a href="https://aws.amazon.com/prometheus/">Amazon Managed Service Prometheus</a>, a service which is still in preview, but because we are <em>Prime</em> customers of AWS, we got a chance to do an early PoC of it, and in addition to that, AWS is offering a fully managed service for the perfect monitoring companion for Prometheus: <a href="https://aws.amazon.com/grafana/">Amazon Managed Service for Grafana</a>. As I write this article, we are still implementing both Amazon Managed Prometheus and Grafana, assessing the financial impact of a fully managed Prometheus stack and other technical considerations worth a future blog post. The only insights that we can provide right now are that we are leveraging the <a href="https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack">Prometheus Operator Helm Chart </a>, a simple yet powerful way to install and configure a per-Kubernetes cluster Prometheus stack that discovers, scrapes, and filters all the Kubernetes and application metrics. Then it forwards all those metrics to the AWS-managed Prometheus stack. So, we are implementing the Prometheus Operator as some sort of proxy or federated Prometheus, used for the sole purpose of scraping, buffering and forwarding metrics to the AWS managed monitoring stack, which is more reliable, scalable, and fully managed.</p><p>We are far from reaching the monitoring nirvana, but are continuously improving our monitoring platform and strategy, making it more stable, affordable and empowering developers to create and deploy their own metrics, giving the most granular insight to the business.</p><h3>HTTP Traffic Management</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/0*gwO_d9inyTQZbSrg" /><figcaption>Fig 9 — Kubernetes Traffic with an Ingress</figcaption></figure><p>You are about to become a respectable Kubernetes captain. Your applications are up and running with proper monitoring and logging. There are CI/CD pipelines in place for deploying and updating your applications to your fleet of clusters. Yet, one question arises. How are the end users going to securely access your microservices and applications deployed to your Kubernetes clusters? To answer that question, we need to remember that a barebones Kubernetes cluster, whatever distribution or managed service you choose, does not include all the required batteries for exposing, securing, and routing the end-users’s HTTP requests to the right services and pods running in the cluster. A vanilla Kubernetes cluster offers Services, a high-level abstraction to expose an application/microservice running as a set of pods and load balance across them. I am not going to detail all the types of Kubernetes Services and their configurations, but one thing you need to know: Kubernetes Services on their own are not enough to securely expose and load-balance your applications and Pods.</p><p>SSL/TLS encryption is taken for granted and should be standard across most HTTP traffic, especially when facing external customers. This is one of the batteries that you need to choose and provide to Kubernetes. You need a reliable mechanism for delivering SSL and TLS certificates to the Kubernetes services and applications you expose to your internal/external users. Some cloud providers like AWS facilitate automated and straightforward ways for requesting and signing SSL and TLS certificates, so you can quickly secure your applications and endpoints. As with any other topic that we have discussed so far, SSL/TLS management for Kubernetes deserves many blog posts and pages, so we are not going to further detail into that. I just want to mention that there are tools that will help you with certificate management in cloud-native environments; one tool worth mentioning is <a href="https://cert-manager.io/">cert-manager</a>. Regarding Kubernetes certificate management at GumGum, we leverage AWS Certificate Manager, which we can freely use for provisioning SSL/TLS certificates that we can deploy to our ALB/ELB load balancers. So far, we are doing that kind of manually. We know beforehand what domain names will be managed by a certain ELB/ALB, so we request a wildcard ACM certificate with those domains (*.appA.gumgum.com, *.appB.gumgum.com, etc.). We know it is not the best or optimal solution, but please bear in mind that we are still growing and maturing our Kubernetes platform.</p><p>One additional piece of the Iceberg that becomes visible once you start deploying a lot of applications and microservices to a Kubernetes cluster is DNS management. Imagine this scenario: you enable your development teams to have <strong>ephemeral </strong>environments that are built and deployed to Kubernetes every time a developer pushes/commits to a branch. You will have many ephemeral applications that need to be exposed and accessed by the developers, and you don’t want to create a DNS record for every one of them manually. You need some sort of tool or automation that will make the proper DNS records for you. Here it comes: <a href="https://github.com/kubernetes-sigs/external-dns">ExternalDNS</a>, an amazing OSS that you can easily install and configure with a simple Helm Chart. ExternalDNS retrieves a list of resources (Services, Ingresses, etc.) from the Kubernetes API to determine the desired list of DNS records. Then it will create those DNS records in 3rd party DNS providers, like AWS Route53 or Google Cloud DNS.</p><p>Last but not least, the last part of the HTTP traffic management puzzle, the big dilemma of how you are going to expose your Pods, Deployments, ReplicaSets, or whatever Kubernetes resources you have created for your applications. We briefly mentioned that Kubernetes provides a high-level Load Balancer-like resource, the Service, which could be used for exposing applications with fundamental HTTP traffic management requirements, like a standalone microservice or a legacy web application. We have a couple of applications deployed like that, so we leverage Kubernetes services for them. Today, complex microservice architectures and deployments bring many challenges and complex HTTP traffic management requirements, such as HTTP path-based routing and load balancing, canary release support, traffic security policies, authentication, and authorization API Gateway, Service Mesh, traffic flow control, etc. Whenever you have an application with any of those requirements, the Kubernetes included batteries won’t be sufficient, and you will have to install and configure an Ingress Controller or Service Mesh. Deliberating around the best or appropriate IC/Service Mesh for your functional and non-functional requirements deserves a long conversation, assessment, and even some load testing. We went through all that at GumGum, when facing a dilemma with a microservice that attends around 50K requests per second and requires response latencies to be under 5ms. At that point, no Ingress Controller / Service Mesh was able to keep up with those non-functional requirements, so we ended up discarding the idea of an IC for that application and decided to use an AWS NLB as a high performance/low latency TCP load balancer, that can be easily created from a Kubernetes Service resource.</p><p>Don’t get me wrong, Ingress Controllers are amazing! We have other applications and microservices leveraging some of its features. My point here is that you shouldn’t try to force an Ingress Controller or Service Mesh pattern into every application or deployment just because it is the hype. Every application has its own functional and non-functional requirements. With the above application that I mentioned, forcing an IC pattern could be an over-engineering solution that could end up causing unexpected problems, like compute costs for processing requests.</p><h3>More ice to discover</h3><p>There are other remarkable chunks from this iceberg to be discovered, but my coffee cup is empty and my cigar is a stub. Keep an eye on this blog; I will be discussing other important matters like IAM (Identity and Access Management), stateful applications, secrets management, resource allocation, auto scaling, Kubernetes release upgrade, etc in an upcoming blog post.</p><h3>Conclusions</h3><ol><li>Kubernetes is the industry standard container orchestration engine, it should be a no-brainer for every company wanting to embark in a complex microservices architecture.</li><li>Kubernetes provides, out of the box, a lot of great features like service discovery, health checks, autoscaling, scheduling, enhanced security, etc; but it is not enough when dealing with applications with advanced requirements and additional features.</li><li>Keep in mind that the Kubernetes ecosystem could be a double sided sword: Just the CNCF is large enough to overwhelm any Developer or DevOps engineer wanting to adopt and create a robust fleet of Kubernetes clusters, but don’t be scared into inaction: try to pick-up tools with large adoption by the community.</li><li>Defining the appropriate Kubernetes deployment strategy for your company should be the first decision to make; some of the remaining aspects to be considered, like monitoring, logging, upgrading, etc., will mostly build on this decision.</li><li>Features like monitoring, logging, application deployment, should be designed and developed closely with the development teams, as they are stakeholders getting more value from those features and can help you make the necessary changes for your migration to Kubernetes.</li><li>Kubernetes is not a silver bullet that will magically solve the design and code issues that your applications being migrated to K8S come with! But it might help expose them, which when dealt with properly will improve the reliability of your applications.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*3GlSfJOp5acIdI0w" /></figure><p>This is Part 1 of this series. You can find Part 2 <a href="https://medium.com/gumgum-tech/implementing-kubernetes-the-hidden-part-of-the-iceberg-part-2-d76d21759de0">here</a>.</p><p>We’re always looking for new talent! <a href="https://gumgum.com/careers">View jobs</a>.</p><p>Follow us: <a href="https://www.facebook.com/gumguminc">Facebook</a> | <a href="https://twitter.com/gumgum">Twitter</a> | | <a href="https://www.linkedin.com/company/167379/">Linkedin</a> | <a href="https://www.instagram.com/gumgum/">Instagram</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76c3e9684d49" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gumgum-tech/implementing-kubernetes-the-hidden-part-of-the-iceberg-part-1-76c3e9684d49">Implementing Kubernetes: The Hidden Part of the Iceberg — Part 1</a> was originally published in <a href="https://medium.com/gumgum-tech">GumGum Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prometheus Monitoring at Scale: War Stories from the GumGum Trenches]]></title>
            <link>https://medium.com/gumgum-tech/prometheus-monitoring-at-scale-war-stories-from-the-gumgum-trenches-f66393c52d0a?source=rss-fbeefd7b7fae------2</link>
            <guid isPermaLink="false">https://medium.com/p/f66393c52d0a</guid>
            <category><![CDATA[grafana]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[Santiago Campuzano]]></dc:creator>
            <pubDate>Fri, 25 Oct 2019 02:57:19 GMT</pubDate>
            <atom:updated>2019-10-25T02:57:19.182Z</atom:updated>
            <content:encoded><![CDATA[<p>Monitoring a system, application or any other IT component is one of the most basic and critical, yet often under prioritized IT process that all companies deal with.</p><p>The monitoring landscape has changed in ways that nobody would have believed in the last 10–15 years. The widespread popularity of cloud native applications, microservice-based systems and sprawling ephemeral environments introduce a host of new challenges, especially for legacy monitoring platforms that were designed for more static environments.</p><p><strong>The Good Ol’ Days</strong></p><p>A few years ago, monitoring at GumGum was pretty much a fairy tale: applications, servers, and services were pretty much fixed and well-known. Icinga, Nagios, Ganglia, AWS CloudWatch, and some other off-the-shelf SaaS tools were just right for the monitoring needs and challenges that we faced during those days.</p><p>We collected host metrics from a predefined list of clusters, services and applications. We’d send alerts based on some basic thresholds that usually indicated something was wrong. For some services, we created basic Ganglia and CloudWatch dashboards. That was it. Indeed, it was a simpler time — dashboarding was still new and the business didn’t yet have the appetite for real-time metrics that it does today.</p><p><strong>Onboarding with Docker</strong></p><p>But, as we mentioned earlier, the IT landscape at GumGum is vastly different nowadays: we have fully embraced the microservices pattern and the Docker ecosystem, with all its advantages like portable applications, homogeneous environments, fast and easy scaling, rapid deployments and more.</p><p>While these are great improvements for the business, these patterns often come at the cost of increased complexity for the GumGum DevOps team. The explosion in the quantity and complexity of the systems to be monitored was neither manageable nor sustainable with the legacy monitoring stack that we had in place.</p><p>For more details on what the legacy monitoring stack at GumGum looked like and the challenges it presented, <a href="https://slides.com/floriandambrine/prometheus-ditch-your-legacy-monitoring">check out this presentation</a> thanks to Florian Dambrine.</p><p>While we had a very good run with our old monitoring stack at GumGum, we needed something new to address the complexity and scale of our new containerized ecosystem.</p><p><strong>Prometheus to the Rescue!</strong></p><p>We needed a new monitoring solution for GumGum, taking into consideration the technical challenges and requirements for a containerized landscape. To accomplish this, we analyzed a variety of approaches and tools and decided to implement a monitoring stack based on <a href="http://prometheus.io/">Prometheus</a>, an open-source monitoring solution based on a Time Series Database (TSDB) and a pull-based pattern for gathering (scraping) metrics from the target systems. We chose Prometheus among other systems, mostly because of its flexibility, extensibility and huge open source community backing the project (<a href="https://www.cncf.io/">Cloud Native Computing Foundation</a>).</p><p>Prometheus alone is not a complete or fully-fledged monitoring stack for a company of our size (100s of people, dozens of microservices, 1000s of containers). Prometheus is built for scrapping metrics with a well-defined format from its target systems, which are collected and exposed to Prometheus via HTTP using specialized agents called <a href="https://prometheus.io/docs/instrumenting/exporters/">Exporters</a>. The following diagram depicts a birds-eye view of GumGum’s batteries-included Prometheus solution, including the components necessary for a highly available deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*45MAOSbeIrnI1hcC" /><figcaption>Figure 1: GumGum’s Prometheus Architecture</figcaption></figure><p>Thus, for completing the monitoring puzzle, we make use of open-source specialized tools that are loosely coupled together, each one being the best fit for its particular use:</p><p><strong>Data Visualization and Dashboarding</strong>: <a href="https://grafana.com/">Grafana</a> is the open-source analytics &amp; dashboarding solution that can be easily coupled to Prometheus using native Grafana data sources. For building Prometheus dashboards on Grafana, you are encouraged to use the powerful <a href="https://prometheus.io/docs/prometheus/latest/querying/basics/">PromQL</a> language, which allows you to perform complex operations and aggregations over the data being queried.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6sRMc0hTjJIq5CQY" /><figcaption>Figure 2: Verity API Grafana Dashboard</figcaption></figure><p>Bonus: <a href="https://static.sched.com/hosted_files/kccnceu19/27/Kubecon%202019_%20Kubernetes%20dashboards%20final.pdf">Best Practices for Building Grafana Dashboards</a></p><p><strong>Alerting</strong>: <a href="https://prometheus.io/docs/alerting/overview/">Alert Manager</a> is the Prometheus-native solution for creating, managing, sending and silencing via a variety of methods such as email, on-call notification systems like PagerDuty, and chat platforms such as Slack.</p><p><strong>Service Discovery</strong>:</p><ul><li><a href="https://www.consul.io/">Consul</a> is a flexible service mesh solution that can be used for multiple purposes, a popular one being service discovery. Prometheus can be easily integrated with Consul, so that it will have a catalog with all the services and nodes to be monitored. Each node to be monitored has a Consul agent installed in it, so the Consul agent will register itself to the Consul cluster, letting the cluster know what services need to be monitored.</li><li><a href="https://github.com/gliderlabs/registrator">Registrator</a>: Registrator is a service registry bridge for Docker. It can automatically detect and register/deregister Docker containers as they come online and disappear from the host. Registrator agent running on each ECS instance is reporting to the local Consul agent, so the Consul cluster will know every time a new Docker container appears, and thus Prometheus will be aware of it as well.</li></ul><p><strong>Metric Exporters</strong></p><ul><li><a href="https://prometheus.io/docs/guides/node-exporter/">Node Exporter</a>: It is a Prometheus exporter for exposing hardware and OS metrics on *nix systems. By default, Node Exporter publishes more 600+ metrics, which is a double-sided sword. You gain access to a huge amount of metrics and valuable info about the system, on the other side, Prometheus will have to scrape and process a ton of different metrics per system, which could potentially become an issue known as <a href="https://blog.freshtracks.io/bomb-squad-automatic-detection-and-suppression-of-prometheus-cardinality-explosions-62ca8e02fa32">Prometheus Cardinality Explosion</a>.</li><li><a href="https://github.com/google/cadvisor">cAdvisor</a>: Similar to NodeExporter, cAdvisor (Container Advisor) is a daemon or service that collects, aggregates, processes, and exports information about running Docker containers.</li><li><a href="https://github.com/prometheus/jmx_exporter">JMX Exporter</a>: An exporter that can be run as a Java Agent and it’s able to collect and expose JVM and JMX metrics in Prometheus format. We’ve used the JMX Exporter @ GumGum to replace DataDog for monitoring Zookeeper.</li><li><a href="https://www.baeldung.com/spring-boot-actuators">Spring Boot Actuator</a>: Custom Java exporter for applications built using the Spring Boot framework. It can retrieve metrics from the JVM, the host and user-defined Java metrics (Similar to JMX Exporter).</li><li><a href="https://github.com/prometheus/cloudwatch_exporter">CloudWatch Exporter</a>: This exporter can retrieve metrics from AWS CloudWatch and then it exposes them so Prometheus can scrape properly. Take into account that this process has an extra cost, because of AWS API calls.</li><li><a href="https://github.com/prometheus/pushgateway">Prometheus Pushgateway</a>: Pushgateway is not a Prometheus Exporter per se, but it behaves like that. Pushgateway allows ephemeral and batch jobs to expose its metrics to Prometheus. The batch/ephemeral jobs push the metrics to Pushgateway and the Prometheus scrapes the metrics from it.</li></ul><p>Prometheus ecosystem has a lot of different <a href="https://prometheus.io/docs/instrumenting/exporters/">exporters</a> that you could potentially implement for your application/stack, such as PHP, Python, NodeJS, etc. We could even implement the <a href="https://github.com/mrf/newrelic_exporter">NewRelic</a> exporter to have AdServer APM metrics on Prometheus.</p><p><strong>Putting all the pieces together</strong></p><p>So far, we have covered all the jigsaw pieces on the Prometheus monitoring puzzle, but we should understand how the pieces are glued and deployed together: Terraform, ECS and Docker.</p><p>We are not gonna explain with that much detail the Terraform project created for setting up all this infrastructure, it is out of the scope of this article. The Terraform project consists of a Terraform module (tf_monitoring) and submodules (alertmanager, cloudwatch, grafana, monitoring-cluster, prometheus and pushgateway). It is worth mentioning that the Consul cluster required by Prometheus is managed on a separate Terraform project, as it is being used by other services.</p><p>All services/components are run on a single ECS cluster, one per AWS account (Advertising, Sports and AI/Verity), so each AWS account has its own Prometheus Monitoring Stack, fully independent.</p><p>So far so good. Prometheus is up and running, we are collecting metrics from the servers, applications and containers, we are able to create beautiful and meaningful Grafana dashboards with those metrics. But not everything is a fairy tale, as we would like it to be.</p><p>The way we architected, configured and deployed Prometheus and all the other pieces have some challenges and drawbacks that are really worth mentioning.</p><p><strong>Biting the dust</strong></p><p>Now that we have now a general understanding of the GumGum Prometheus architecture and implementation, it is worth mentioning the lessons learned so far and the challenges and drawbacks found.</p><ul><li><strong>Configuration Changes</strong>. Prometheus, Alertmanager and Cloudwatch Exporter configuration is hardcoded inside the Docker container running each one of those services, so, any change to the configuration requires a change to the Bitbucket repo managing the specific Docker Project (docker-prometheus, docker-alertmanager, docker-cloudwatch), then after the new Docker is built and pushed to the JFrog Repo, then, we need to modify the Terraform project managing the whole Prometheus Cluster, apply the changes and wait for ECS to update/recycle the modified service (i.e. Prometheus), incurring in an unwanted downtime for such a critical service like Prometheus. At the time of writing this article, we DevOps team are thinking of a way of performing configuration changes and hot reloads to apply them.</li><li><strong>Prometheus High Availability</strong>: Prometheus High Availability is achieved by having 2 “Twin” Prometheus Servers with the very same configuration, scraping or collecting the very same metrics on the same hosts. It’s basically duplicated monitoring. This pattern is effective for achieving HA on Prometheus, but it has some drawbacks/disadvantages worth mentioning it:</li></ul><ol><li>The monitored servers/services/applications need to perform some extra work to deliver their metrics to a pair of Prometheus servers, thus having a small performance overhead.</li><li>The way each Prometheus service is configured at ECS level requires having separate EBS volumes for storing metrics, which means paying more for AWS storage and resources.</li><li>When Grafana is querying metrics from Prometheus for building dashboards, we could potentially have inconsistent information, as Grafana is querying a pair of Prometheus “twin” servers.</li><li>Scaling Prometheus to scrape millions of metrics from thousands of nodes with the current architecture/deployment is not feasible.</li></ol><p>How to improve Prometheus HA Architecture to be able to scale out? There are other Architectures proposed for scaling out Prometheus, such as the <a href="https://prometheus.io/docs/prometheus/latest/federation/">Federated Prometheus Architecture</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/0*u4cUC18sk70Oeytp" /><figcaption>Figure 3: Federated Prometheus Architecture</figcaption></figure><ul><li><strong>Prometheus Metrics Storage. </strong>The standard storage method used by Prometheus requires space on local disks, presented to the server, meaning AWS EBS volumes for GumGum deployment. In addition to that, Prometheus saves all its metrics to just one location. This limitation does not allow Prometheus to easily scale up in terms of storage when the company starts growing the number of metrics, nodes and applications being monitored. In addition to that, the retention time for the stored metrics is quite limited to the space available on the EBS volumes. The retention time for the metrics is set to 15 days, which is the default value. Even the <a href="https://prometheus.io/docs/prometheus/latest/storage/">official</a> documentation mention these limitations with the storage. There are different options to be considered for overcoming these limitations, like <a href="https://prometheus.io/docs/operating/integrations/#remote-endpoints-and-storage">Prometheus Remote Storage</a>, which allows using different storage options, such as InfluxDB, OpenTSDB, Cassandra, etc.</li><li><strong>Prometheus Cardinality Explosion</strong>: We briefly mentioned this issue before. The main Prometheus server for Advertising Account has ~2.221.978 different time series right now!. That’s a huge number, and it could be way bigger in a matter of months. Prometheus creates a time series for every combination of a metric+tags/labels. So, for every Docker container that spins up on ECS it will create N new Time Series (N being the number of metrics collected for that particular container). We love having a lot of metrics to work with, but we care for Prometheus performance and resources as well. This explosion in the cardinality could potentially lead to:</li></ul><ol><li>Severe memory inflation in both Prometheus</li><li>Increased scrape durations</li><li>Querying becomes effectively impossible</li></ol><p>Is there anything to do about this? For sure! We could work on effectively scraping the really needed metrics and discard duplicated or meaningless metrics. There are ways of doing that at both the exporters and/or Prometheus level. There are tools that help in analyzing the cardinality on Prometheus TSDB, check this <a href="https://www.robustperception.io/using-tsdb-analyze-to-investigate-churn-and-cardinality">article</a>.</p><p><strong>Conclusion</strong></p><p>We DevOps team have a lot of work to do about monitoring, the job that has been done so far with Prometheus has been amazing (Thanks Flo) We’ve learned a lot on the road. Following are some general monitoring thoughts worth considering:</p><ul><li>Prometheus is not a monitoring silver bullet, it’s great though.</li><li>Monitoring is not a role or job, it’s a skill everyone at GumGum should embrace as part of the software development process. The Ops team is responsible for designing, building and maintaining the core monitoring infrastructure while the development teams should define -with DevOps guidance- meaningful KPIs, dashboards and alerts to reflect the value and impact on the business</li><li>We need to pay more attention to metrics and alerts closer to the end-users: application response times, HTTP errors, etc. You can monitor as deep and wide as you want, but always keep in mind: How will these metrics show me end-user impact?</li><li>Individual instance/host metrics and alerts are not that important in modern microservices architectures and ephemeral environments.</li><li>Metrics may have different meanings and relevance depending on the context, workload or application.</li></ul><p>Thanks to Ops team, especially to Corey Gale for helping me with the redaction.</p><p>We’re always looking for new talent! <a href="https://gumgum.com/careers">View jobs</a>.</p><p>Follow us: <a href="https://www.facebook.com/gumguminc">Facebook</a> | <a href="https://twitter.com/gumgum">Twitter</a> | | <a href="https://www.linkedin.com/company/167379/">Linkedin</a> | <a href="https://www.instagram.com/gumguminc/">Instagram</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f66393c52d0a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gumgum-tech/prometheus-monitoring-at-scale-war-stories-from-the-gumgum-trenches-f66393c52d0a">Prometheus Monitoring at Scale: War Stories from the GumGum Trenches</a> was originally published in <a href="https://medium.com/gumgum-tech">GumGum Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>