<?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 Gokhan Karadas on Medium]]></title>
        <description><![CDATA[Stories by Gokhan Karadas on Medium]]></description>
        <link>https://medium.com/@gokhan-karadas1992?source=rss-c5b1e01bf082------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SWzGQi2TzQhUkwHg0YK4Pw.png</url>
            <title>Stories by Gokhan Karadas on Medium</title>
            <link>https://medium.com/@gokhan-karadas1992?source=rss-c5b1e01bf082------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 09:11:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gokhan-karadas1992/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[ArgoCD + Kubevela Integration]]></title>
            <link>https://gokhan-karadas1992.medium.com/argocd-kubevela-integration-eb88dc0484e0?source=rss-c5b1e01bf082------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb88dc0484e0</guid>
            <category><![CDATA[gitops]]></category>
            <category><![CDATA[oam]]></category>
            <category><![CDATA[internaldeveloperplatform]]></category>
            <category><![CDATA[argo]]></category>
            <category><![CDATA[kubevela]]></category>
            <dc:creator><![CDATA[Gokhan Karadas]]></dc:creator>
            <pubDate>Thu, 05 Jan 2023 07:27:11 GMT</pubDate>
            <atom:updated>2023-01-05T07:27:11.272Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/268/1*nbzohBA2tpIRHqkmn0LUNw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*Ib0XSoJOnB7VS8x9fLF7zQ.png" /></figure><p>This document aims to explain the integration of Kubevela and ArgoCD. We have<strong> two approaches</strong> to integrate this flow. This doc is trying to explain the pros and cons of two different approaches. Before diving deep into details, we can describe Kubevela and ArgoCD.</p><p><a href="http://kubevela.io/">KubeVela</a> is a modern software delivery platform that makes deploying and operating applications across multi environments<em> easier, faster, and more reliable.</em></p><p>KubeVela is infrastructure agnostic and<strong><em> </em>application-centric<em>.</em></strong> It allows you to build robust software and deliver them anywhere! Kubevela provides an Open Application Model (OAM) based abstraction approach to ship applications and any resource across multiple environments.</p><p>Open Application Model (OAM) is a set of standard yet higher-level abstractions for modeling cloud-native applications on top of today’s hybrid and multi-cloud environments. You can find more conceptual details <a href="https://github.com/oam-dev/spec">here</a>.</p><pre>apiVersion: core.oam.dev/v1beta1<br>kind: Application<br>metadata:<br>  name: first-vela-app<br>spec:<br>  components:<br>    - name: express-server<br>      type: webservice<br>      properties:<br>        image: oamdev/hello-world<br>        ports:<br>         - port: 8000<br>           expose: true<br>      traits:<br>        - type: scaler<br>          properties:<br>            replicas: 1</pre><p><strong>ArgoCD</strong></p><p>Argo CD is a declarative continuous delivery tool for Kubernetes applications. It uses the GitOps style to create and manage Kubernetes clusters. When any changes are made to the application configuration in Git, Argo CD will compare it with the configurations of the running application and notify users to bring the desired and live state into sync.</p><p><strong>Flux</strong></p><p>By default, Kubevela works with Flux addon to complete the Gitops journey for applications. You need to enable the flux addon and perform git operations quickly. <a href="https://kubevela.io/docs/end-user/gitops/fluxcd">https://kubevela.io/docs/end-user/gitops/fluxcd</a></p><pre>vela addon enable fluxcd</pre><h3>Integration with ArgoCD</h3><p>If you want to use Kubevela with ArgoCD, there are two options to enable it.</p><ul><li>Kubevela dry-run option</li><li>Kubevela + ArgoCD</li></ul><h3>1. Vela dry-run approach</h3><p>First approach is that without using Kubevela GitOps Controller, we can use ArgoCD as the GitOps Controller, which means ArgoCD applies a raw manifest to the target cluster. Kubevela provides us to export oam application components and traits to native Kubernetes resource therefore we can still use OAM based model and ArgoCD can manage resources with custom argo-repo-server plugin. Behind this approach that <strong>KubeVela</strong> and OAM can also works as a client side tool with the feature <strong>dry-run.</strong></p><p>This part describe how argocd apply dry-run mode on kubevela resources. Firstly, ArgoCD and Kubevela same should be installed.</p><p><strong>ArgoCD version v2.5.4</strong></p><p><strong>Kubevela version v1.6.4</strong></p><h4>Prerequisites</h4><p>Argo CD allows integrating more config management tools using config management plugins.</p><h4>1. Write the plugin configuration file</h4><p>Plugins will be configured via a ConfigManagementPlugin manifest located inside the plugin container.</p><pre>apiVersion: v1<br>kind: ConfigMap<br>metadata:<br>  name: vela-cmp<br>  namespace: argocd<br>data:<br>  plugin.yaml: |<br>    apiVersion: argoproj.io/v1alpha1<br>    kind: ConfigManagementPlugin<br>    metadata:<br>      name: vela<br>    spec:<br>      version: v1.0<br>      init:<br>        command: [&quot;vela&quot;, &quot;traits&quot;]<br>      generate:<br>        command: [&quot;sh&quot;]<br>        args:<br>          - -c<br>          - |<br>            vela dry-run -f test-argo-oam.yml<br>      discover:<br>        # fileName: &quot;-oam.yml*&quot;<br>        find:<br>          # This does the same thing as fileName, but it supports double-start (nested directory) glob patterns.<br>          glob: &quot;**/*oam*.yml&quot;</pre><pre>kubectl apply -f vela-cmp.yml</pre><p>This plugin is responsible for converting Kubevela OAM manifest definition to raw kubernetes object and ArgoCD should be responsible to deploy.</p><h4>2. Register the plugin sidecar</h4><p>To install a plugin, patch argocd-repo-server to run the plugin container as a sidecar, with argocd-cmp-server as its entrypoint.</p><p>Vela plugin runs the vela command to export manifest when the plugin is discovered on git manifest. Before initializing the plugin, we need to install Kubevela CLI to run the order successfully. The below configuration adds an init container to download the necessary CLI.</p><pre>initContainers:<br>        - name: kubevela<br>          image: nginx:1.21.6<br>          command:<br>            - bash<br>            - &#39;-c&#39;<br>            - |<br>              #!/usr/bin/env bash<br>              set -eo pipefail<br>              curl -fsSl https://kubevela.io/script/install.sh | bash -s 1.6.4<br>          env:<br>            - name: VELA_INSTALL_DIR<br>              value: /custom-tools<br>          resources:<br>            limits:<br>              cpu: 50m<br>              memory: 64Mi<br>            requests:<br>              cpu: 10m<br>              memory: 32Mi<br>          volumeMounts:<br>            - name: custom-tools<br>              mountPath: /custom-tools<br>          terminationMessagePath: /dev/termination-log<br>          terminationMessagePolicy: File<br>          imagePullPolicy: IfNotPresent</pre><p>after adding init container, we need to add our custom sidecar binary to run plugins properly. To use configmap plugin configuration in our sidecar, we need to mount configmap plugin to our pods</p><pre>containers:<br>        - name: vela<br>          image: nginx<br>          command:<br>            - /var/run/argocd/argocd-cmp-server<br>          env:<br>            - name: KUBECONFIG<br>              value: /kubeconfig<br>          resources: {}<br>          volumeMounts:<br>            - name: var-files<br>              mountPath: /var/run/argocd<br>            - name: vela-cli-dir<br>              mountPath: /.vela<br>            - name: kubeconfig<br>              mountPath: /kubeconfig<br>              subPath: kubeconfig<br>            - name: plugins<br>              mountPath: /home/argocd/cmp-server/plugins<br>            - name: vela-cmp<br>              mountPath: /home/argocd/cmp-server/config/plugin.yaml<br>              subPath: plugin.yaml<br>            - name: cmp-tmp<br>              mountPath: /tmp<br>            - name: custom-tools<br>              mountPath: /usr/local/bin/vela<br>              subPath: vela</pre><h4>3. Configure Argo CD to watch this repo for Git pushes.</h4><p>Create git repository and put oam manifest to target directory after you can create a simple ArgoCD application that watch git repository and apply manifests to local kubernetes cluster.</p><pre>apiVersion: core.oam.dev/v1beta1<br>kind: Application<br>metadata:<br>  name: test-2<br>spec:<br>  components:<br>    - name: wf-poc-app-2<br>      type: webservice<br>      properties:<br>        image: oamdev/helloworld-python:v1<br>        env:<br>          - name: &quot;TARGET&quot;<br>            value: &quot;ArgoCD&quot;<br>        port: 8080</pre><p><strong>4. Final Output</strong></p><p>ArgoCD synced applications successfully and rendered kubernetes resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*noBT6sj-0K-DQ3PB" /><figcaption>ArgoCD is gitops controller way</figcaption></figure><h3>2. Kubevela Controller + ArgoCD Gitops syncer</h3><p>Second approach is that we can use kubevela gitops controller way as the server side and argocd can be our gitops syncer. This approach is flexible to use native kubevela feature set without using a custom plugin or dry run module. We just need to add below annotations to our manifest repository to ignore outofsync.</p><pre>argocd.argoproj.io/compare-options: IgnoreExtraneous</pre><p>In this example, ArgoCD tracks native Kuevela application resources and its revision .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*97AatDKE2fC5wQdX" /><figcaption>ArgoCD is gitops syncer way</figcaption></figure><h3>Conclusion</h3><ol><li><strong>Vela Dry-run approach</strong></li></ol><ul><li>Kubevela can be installed different cluster from ArgoCD.</li><li>Limited kubevela features, we just use component and traits definition.</li><li>Workflow and policy features don’t supported by this way.</li><li>Depend on kubevela dry run feature.</li><li>No needed rbac, ui or any different experience from ARGO.</li></ul><p><strong>2. Kubevela Controller + ArgoCD Gitops syncer</strong></p><ul><li>Kubevela must be installed to ArgoCD cluster.</li><li>We can use all the features of kubevela.</li><li>No need depends on anything.</li></ul><p><strong>Big thanks to</strong> <a href="https://medium.com/u/62a94df5b395">Erkan Zileli</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb88dc0484e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Developer Experience Is Critical?]]></title>
            <link>https://medium.com/trendyol-tech/why-developer-experience-is-critical-8baaefaa381f?source=rss-c5b1e01bf082------2</link>
            <guid isPermaLink="false">https://medium.com/p/8baaefaa381f</guid>
            <category><![CDATA[developer-experience]]></category>
            <category><![CDATA[platform]]></category>
            <category><![CDATA[docs]]></category>
            <category><![CDATA[devx]]></category>
            <category><![CDATA[developer-productivity]]></category>
            <dc:creator><![CDATA[Gokhan Karadas]]></dc:creator>
            <pubDate>Mon, 18 Jul 2022 11:13:25 GMT</pubDate>
            <atom:updated>2022-07-18T13:09:35.398Z</atom:updated>
            <content:encoded><![CDATA[<p>Technology is continually growing, becoming more powerful with each passing day. According to EventsData.com, the number of developers globally is expected to increase from 23.9 million in 2019 to 28.7 million in 2024. An organization&#39;s complexity is growing and solving a problem can be struggling. Repeated daily tasks can make more pressure on engineers and increase cognitive load. Big tech companies try to focus on creating platforms for their consumers. In order to build such platforms, it requires developers with different skills like an engineering mindset, innovative thinking, and problem-solving. At this point, DE has mission-critical responsibility for growing the organization to provide the platform, standardization and better productivity flows for teams.</p><h4>Who is the Developer Experience Engineer?</h4><p>Developer Experience Engineering is the discipline of using data to make builders more productive through tools, automation, infrastructure, analysis, and collaborating with SRE, thereby improving their happiness and enhancing their efficiency. When applied successfully brings optimized development practices, fast and reliable delivery feedback cycles, and builder happiness. And gracefully handle ever-growing codebases. Hence it is as important as the production of software.</p><p>In Trendyol, the primary focus of DPE would be enabling teams to bring ideas to production fast in a compliant and sustainable way. To do this, DPE supports teams in terms of best practices on delivery (CI &amp; CD, CLI tools), providing developer platform components and client application frameworks, great documentation, etc, by analyzing developer insights and considering those insights while developing tools so. This helps curate and create secure and compliant software while enabling the build and deployment processes without friction, with quality, and in a continuous manner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*11IIi2NgSmE0E50UvNgTkQ.jpeg" /></figure><h3>Successful Developer Experience Approach</h3><p>After the 3 years in the developer experience team, I try to explain how you succeed in offering a seamless developer experience. This section will cover our way to approach for seamless developer experience offering.</p><h4>Understanding what exactly your developers want</h4><p>The first and most important approach is to understand and meet developers&#39; needs. Working with different teams and understanding their problem and executing them sometimes can be challenging. As Devx, we need to understand exactly how developer flow is going on and carefully observe the missing process in that flow. Here are some approaches to understanding developers’ needs.</p><ul><li>Satisfaction survey feedback.</li><li>Analyzing engineering metrics (Dora and sub-engineering metrics).</li><li>Monthly request feedback meeting.</li></ul><p>In many ways, we consider developer problems and try to solve them together.</p><h4>Providing a self-service environment</h4><p>Self-service is the practice of serving oneself without the need for additional help. That is a critical point when we build our infrastructure everything should be provided us self services. This means providing self-service tooling for common use cases, making tools, SDK, and APIs easily discoverable and well-documented. Engineers shouldn’t care about crossing cutting concerns and we need to remove friction when deploying applications safely. Here is an example of when you want to enable the rate limit feature for multi-zone scenarios. Just a simple YAML definition provides to enable the rate limit feature for your services.</p><pre>apiVersion: trendyol.com/v1beta1<br>kind: GlobalRateLimit<br>metadata:<br>  name: name<br>spec:<br>  rate:<br>  - dimensions:<br>    - header_value_match:<br>        descriptor_value: healthcheck<br>        headers:<br>        - name: :path<br>          prefix_match: healthcheck<br>    request_per_unit: 10<br>    unit: minute<br>  workload: label-app<br>  domain: multi-dc-app</pre><p>Next series we will continue with more examples of self-service environments and tools.</p><h4>Product thinking and mindset</h4><p>While identifying opportunities for new products or even improving your present product, you would research what engineers want or if there are any challenges that they happen to come across. Getting various feedback from teams would be awesome to decide which product is most critical for the business delivery. So that it tends to adopt product thinking for technology platforms and products in order to accelerate development, and minimize operational complexity.</p><h4>Great technical onboarding and Devx toolkit docs</h4><p>Devx team has a big responsibility to improve the developer onboarding process and technical documentation standardization. Technical documentation explains anything to do with your software product, ranging from internal documentation for teams. Developers should integrate any toolkits without asking someone provided rich technical documentation. It describes the features and functionality of the product clearly so that anyone can use it. The primary goal is to explain a particular aspect of the product to the target audience.</p><ul><li>The technical document should be served on one page.</li><li>The notification system should send a notification when specific documents have changed and engineers should only focus on new documents and updated documents parts.</li><li>The document reading stats system should be activated and needs to improve according to specific read ratio, view etc…</li><li>The document repository should be public and anyone can contribute to toolkit docs.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dN_lNZIYPJTrx0Y3kRZd4A.png" /></figure><h3>Developer experience OKRs</h3><p>We have a lot of different OKRs targets that are technical and cultural and it’s important to identify OKRs that fit your business and will resonate with your software development team. Below are some examples for Devx OKRs:</p><ul><li>Measure Stability of Delivery Tools</li><li>Increase adoption of Delivery Tools</li><li>Measure Time To first commit of newcomer</li><li>Measure Lead Time to production</li><li>Publish the developer Satisfaction Survey at least 1 time</li><li>Increase adoption of Delivery Tools</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XrxfQeNkUJsgjkCnXGRUMw.png" /><figcaption>Internal Developer Portal of Trendyol</figcaption></figure><h3>With better developer experience;</h3><ul><li>Motivation and happiness increase.</li><li>Productivity increases.</li><li>Duplications and overhead are eliminated.</li><li>Provides great documentation and better standardization for our Tech team.</li><li>A successful onboarding experience.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IQuB8cpZR_Jhbt1YMpU2RQ.jpeg" /></figure><p>We have a lot of improvement areas we need to complete. We’re happy with the results until this time and we think that the team is having a very positive impact on our Tech team in many ways. Please don’t forget to review our job posts.</p><h4>More about us</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fopen.spotify.com%2Fembed%2Fepisode%2F4GcqIGh4EP2KLoePurXNyP%3Futm_source%3Doembed&amp;display_name=Spotify&amp;url=https%3A%2F%2Fopen.spotify.com%2Fepisode%2F4GcqIGh4EP2KLoePurXNyP&amp;image=https%3A%2F%2Fi.scdn.co%2Fimage%2Fcd5019c19876229778034afdf4de4f00abff6fd9&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=spotify" width="456" height="152" frameborder="0" scrolling="no"><a href="https://medium.com/media/3ff31ff9d939e0c5bb742d44c7e5847f/href">https://medium.com/media/3ff31ff9d939e0c5bb742d44c7e5847f/href</a></iframe><ul><li><a href="https://jobs.lever.co/trendyol/c4eb3a36-6431-4f27-b13f-353cea8b7538">Trendyol - Software Engineer - Developer Experience - Germany (Remote) - (m/f/d)</a></li><li><a href="https://jobs.lever.co/trendyol/40c4e50d-7340-4585-b877-61184ab22bb2">Trendyol - Software Engineer - Developer Experience - Netherlands (Remote)</a></li></ul><p>References:</p><ul><li><a href="https://www.redhat.com/architect/developer-experience">Developer experience: an essential aspect of enterprise architecture | Enable Architect</a></li><li>Developer Experience (DevEx) — Code With Engineering Playbook</li><li><a href="https://evansdata.com/press/viewRelease.php?pressID=278">https://evansdata.com/press/viewRelease.php?pressID=278</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8baaefaa381f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trendyol-tech/why-developer-experience-is-critical-8baaefaa381f">Why Developer Experience Is Critical?</a> was originally published in <a href="https://medium.com/trendyol-tech">Trendyol Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Domain naming standards for internal services?]]></title>
            <link>https://medium.com/trendyol-tech/domain-naming-standards-for-internal-services-64bb8b68bab6?source=rss-c5b1e01bf082------2</link>
            <guid isPermaLink="false">https://medium.com/p/64bb8b68bab6</guid>
            <dc:creator><![CDATA[Gokhan Karadas]]></dc:creator>
            <pubDate>Wed, 28 Jul 2021 08:36:03 GMT</pubDate>
            <atom:updated>2021-07-28T08:36:03.799Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s say you have thousands of microservices and you need the access these services by their domain names. How to create these domain names and make them less complicated?</p><p>Before starting deep dive I want to tell you why domain naming standardization is useful for your microservices.</p><ul><li>A domain name should be self-explanatory.</li><li>If you have many teams in your organization you need to pre-validation the step for registering domains.</li><li>A domain should be short as match as possible.</li></ul><p><strong>How do we register a domain in Trendyol?</strong></p><p>We use consul to service discovery and catalog. An application developer can register their microservices easily via Kubernetes. We use the consul-catalog project for registering microservices to the Consul. A service definition is a configuration that looks like the following.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*T853Pi1uQcj9tE5QbmCjXQ.png" /><figcaption>Consul catalog</figcaption></figure><pre>[<br>  {<br>    &quot;Service&quot;: {<br>      &quot;Service&quot;: &quot;discovery-team-servicename-service&quot;<br>    }<br>  }<br>]</pre><p><strong>What is the domain naming for internal microservices?</strong></p><p>We use tribe-team-servicename standardization for our microservices. In this way, application developers can find necessary microservice easily. We have many tribes like discovery, mobile, delivery each tribe contains multiple domain teams. Each microservice represents in this way. For example, you have a favorite service you register with it servicename.ty.com I think that this domain name is not self-explanatory and you don’t know who is responsible for this project. If you use discovery-reco-favorite-service you can easily find a responsible team for this microservice. You can see this project belongs to Discovery tribe and Reco team. Now you know who to contact.</p><p><strong>Do you host a microservice for multiple data centers?</strong></p><p>When you work with multiple data centers you should access each one easily. Above I talked about microservice naming for internal microservices but how we access each data center. We use tribe-team-service.datacenter it to access microservice for specific data centers.</p><h3>Conclusion</h3><ul><li>With strong domain naming conventions, you can reduce the effort to find a responsible team.</li><li>It makes it easy for the onboarding process.</li></ul><h3>Contributors</h3><p><a href="https://medium.com/u/ac5839c27d40">Oğuzhan Demir</a></p><p><a href="https://medium.com/u/c50c70d779e7">Emre Savcı</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64bb8b68bab6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trendyol-tech/domain-naming-standards-for-internal-services-64bb8b68bab6">Domain naming standards for internal services?</a> was originally published in <a href="https://medium.com/trendyol-tech">Trendyol Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Some best practices for running Istio in production]]></title>
            <link>https://gokhan-karadas1992.medium.com/some-best-practices-for-running-istio-in-production-61a5442ce900?source=rss-c5b1e01bf082------2</link>
            <guid isPermaLink="false">https://medium.com/p/61a5442ce900</guid>
            <category><![CDATA[istio]]></category>
            <category><![CDATA[istio-sidecar]]></category>
            <category><![CDATA[istio-mesh]]></category>
            <category><![CDATA[tuning]]></category>
            <category><![CDATA[mesh]]></category>
            <dc:creator><![CDATA[Gokhan Karadas]]></dc:creator>
            <pubDate>Wed, 21 Jul 2021 19:42:10 GMT</pubDate>
            <atom:updated>2021-07-22T22:17:53.856Z</atom:updated>
            <content:encoded><![CDATA[<p>Istio isn’t easy. There are a lot of options and best practices to manage Istio in the production environment. This article contains some learnings and useful information for system and developer maintainers. Let’s start with data plane and control plane configurations.</p><p><strong>1- Control configuration sharing across namespaces</strong></p><p>You can define multiple virtual services and destination rules in one namespace and then reuse them in other namespaces. Istio exports all traffic management rules to all namespaces by default, but you can control and tune with the exportTo field.</p><pre>apiVersion: networking.istio.io/v1alpha3<br>kind: VirtualService<br>metadata:<br>  name: transaction-log<br>  namespace: seller<br>spec:<br>  gateways:<br>    - istio-system/secure-gateway<br>  hosts:<br>    - selleradstransactionlogapi.trendyol.com<br>  http:<br>    - match:<br>        - uri:<br>            prefix: /<br>      route:<br>        - destination:<br>            host: transaction-log<br>      timeout: 1.000s<br>  exportTo:<br>  - &quot;.&quot;</pre><p><strong>2- Manage Envoyfilter workloadSelector scope</strong></p><p>EnvoyFilter CRD provides a patching mechanism for customizing Envoy configuration. EnvoyFilter has a workloadSelector field that is used to select the specific set of pods/VMs on which this patch configuration should be applied.</p><p>If omitted, the set of patches in this configuration will be applied to all workload instances in the same namespace. If omitted, the EnvoyFilter patches will be applied to all workloads in the same namespace. I suggest you select specific pods/VMs to reduce overhead. Envoy is really sensitive cache configuration dump in memory.</p><pre>apiVersion: networking.istio.io/v1alpha3<br>kind: EnvoyFilter<br>metadata:<br>  name: cluster-idletimeout<br>  namespace: istio-system<br>spec:<br>  configPatches:<br>    - applyTo: NETWORK_FILTER<br>      match:<br>        context: SIDECAR_OUTBOUND<br>        listener:<br>          filterChain:<br>            filter:<br>              name: envoy.filters.network.http_connection_manager<br>      patch:<br>        operation: MERGE<br>        value:<br>          typed_config:<br>            &#39;<a href="http://twitter.com/type">@type</a>&#39;: &gt;-<br>             type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager<br>            common_http_protocol_options:<br>              idle_timeout: 10s</pre><p>The above configuration is applied to all sidecar outbound in a sidecar.</p><p><strong>3- Always use Sidecar Resource</strong></p><p>I told you Istio isn’t easy. Without any tuning Istio data plane uses nearly 200MB of course it depends on your mesh size and configuration. It can be tedious to fight this kind of problem. Most people can say we can change our mesh tool to save our budget quota. This solution isn’t an easy task why I am telling this because we have a lot of custom mesh configurations like ratelimit, service to service auth bla bla. At this point Istio sidecar resource rescue some memory and startup time problems.</p><p>The Istio <a href="https://istio.io/docs/reference/config/networking/sidecar/">documentation</a> says the following about it:</p><blockquote>Sidecar describes the configuration of the sidecar proxy that mediates inbound and outbound communication to the workload instance it is attached to. By default, Istio will program all sidecar proxies in the mesh with the necessary configuration required to reach every workload instance in the mesh, as well as accept traffic on all the ports associated with the workload. The Sidecar configuration provides a way to fine tune the set of ports, protocols that the proxy will accept when forwarding traffic to and from the workload. In addition, it is possible to restrict the set of services that the proxy can reach when forwarding outbound traffic from workload instances.</blockquote><p>The Sidecar resource can be used to fine-tune the Envoy config for a set of workloads.</p><p>With this configuration, you can <strong>save about 40 or 50%</strong> of the sidecar proxy memory consumption. Your istio-proxy startup time reduced <strong>%30 or %50</strong></p><p>Default namespace sidecar configuration:</p><pre>apiVersion: networking.istio.io/v1alpha3<br>kind: Sidecar<br>metadata:<br>  name: default<br>  namespace: ratelimit<br>spec:<br>  egress:<br>    - hosts:<br>        - ratelimit/*</pre><p>Specific workload sidecar configuration:</p><pre>apiVersion: networking.istio.io/v1alpha3<br>kind: Sidecar<br>metadata:<br>  name: api<br>  namespace: browsing<br>spec:<br>  egress:<br>    - hosts:<br>        - &#39;*/servicename.namespace.svc.cluster.local&#39;<br>        - ./service.browsing.svc.cluster.local<br>  workloadSelector:<br>    labels:<br>      app: api</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*754TdnbNWY5joaB5YLs5ow.png" /><figcaption><a href="https://github.com/Hitachi/istio-bench">https://github.com/Hitachi/istio-bench</a></figcaption></figure><p><strong>4- Activate compression on Istio instead of an application container</strong></p><p><strong>Compression</strong> is a reduction in the number of bits needed to represent data. Before starting work with mesh or API gateway we enable compression on application level code. At this point, we use a lot of different programming languages to develop and maintain our business code. By default, some application framework provides us compression on network level some are not. It’s hard to control compression settings application level. We can move compression responsibility to our mesh with easy configuration. Please keep in mind when disabling Istio for any workload you will lose compression at the network level. You can define alert rules according to Istio metrics. (istio_response_bytes_bucket)</p><pre>apiVersion: networking.istio.io/v1alpha3<br>kind: EnvoyFilter<br>metadata:<br>  name: application-gzip<br>  namespace: istio-system<br>spec:<br>  workloadSelector:<br>    labels:<br>      app: workload-app<br>  configPatches:<br>    - applyTo: HTTP_FILTER<br>      match:<br>        context: SIDECAR_INBOUND<br>        listener:<br>          filterChain:<br>            filter:<br>              name: envoy.http_connection_manager<br>              subFilter:<br>                name: envoy.router<br>      patch:<br>        operation: INSERT_BEFORE<br>        value:<br>          name: envoy.filters.http.compressor<br>          typed_config:<em><br>            </em>&#39;@type&#39;: type.googleapis.com/envoy.extensions.filters.http.compressor.v3.Compressor<br>            compressor_library:<br>              name: text_optimized<br>              typed_config:<br>                &#39;@type&#39;: type.googleapis.com/envoy.extensions.compression.gzip.compressor.v3.Gzip<br>            remove_accept_encoding_header: true</pre><p><strong>5- Hide some configuration from the application developer</strong></p><p>Istio has a lot of configurations to configure data plane. It’s good practice to hide some features which are traffic management, security, and logging policies. You can give a declarative user interface and application developers can customize workload without touching any configuration rules. We started to work building all in one portal. Application developers can configure mutual-tls just an enable disable button or they can change application timeout, retry-policy without any side effect. If you don’t have resources to build up a custom portal you can use an awesome Kiali dashboard that provides high-level custom configuration dashboard besides Kiali only works with Istio’s replicated control planes scenario. <a href="https://kiali.io/documentation/v1.18/features/#_multi_cluster_support">https://kiali.io/documentation/v1.18/features/#_multi_cluster_support</a></p><p>You can also glance at <a href="https://github.com/XiaoMi/naftis">https://github.com/XiaoMi/naftis</a> custom dashboard.</p><p><strong>6- Remove some envoy response header</strong></p><p>By default, envoy adds some tracing response header. For security reasons, you might want to remove those headers on your ingress configuration.</p><ul><li><strong>x-envoy-peer-metadata</strong></li><li><strong>x-envoy-peer-metadata-id</strong></li><li><strong>x-envoy-decorator-operation</strong></li></ul><p>x-envoy-peer-metadata is some base64 encoded metadata about envoy instance. For example, go to <a href="https://www.wantedly.com/">https://www.wantedly.com/</a> you can see those response headers. You can see clear text data in below</p><pre><br> INSTANCE_IPS<br>100.96.50.107<br><br>LABELS*<br><br>app<br>wantedly<br> <br>pod-template-hash  dfc5f9699</pre><pre>roleweb<br>$<br>security.istio.io/tlsModeistio<br>-<br>service.istio.io/canonical-name<br>wantedly<br>/<br>#service.istio.io/canonical-revisionlatest<br><br>MESH_ID<br>cluster.local<br>&quot;<br>NAMEwantedly-dfc5f9699-fmbjj<br><br> NAMESPACE<br>wantedly<br>M<br>OWNERDBkubernetes://apis/apps/v1/namespaces/wantedly/deployments/wantedly<br><br>SERVICE_ACCOUNT default<br></pre><pre>WORKLOAD_NAME<br>wantedly</pre><p>Some sensitive information about your workload and infrastructure.</p><h3>Conclusion</h3><p>Be careful about your resource consumption in production. Move some network-level process application layer to Istio. Use Istio metrics to define alerts rule. We will continue to share production experience with any mesh tool.</p><p><strong>References</strong>:</p><ul><li><a href="https://istio.io/latest/docs/reference/config/networking/sidecar/">Sidecar</a></li><li><a href="https://istio.io/latest/docs/ops/best-practices/">Best Practices</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61a5442ce900" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Activate gzip compression on the Istio-proxy workload]]></title>
            <link>https://gokhan-karadas1992.medium.com/activate-gzip-compression-on-the-istio-proxy-workload-b75f20ea257?source=rss-c5b1e01bf082------2</link>
            <guid isPermaLink="false">https://medium.com/p/b75f20ea257</guid>
            <category><![CDATA[istio]]></category>
            <category><![CDATA[envoy]]></category>
            <category><![CDATA[compression]]></category>
            <category><![CDATA[gzip]]></category>
            <category><![CDATA[istio-compression]]></category>
            <dc:creator><![CDATA[Gokhan Karadas]]></dc:creator>
            <pubDate>Sun, 02 May 2021 15:50:01 GMT</pubDate>
            <atom:updated>2021-05-02T15:50:01.714Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>Do you want to optimize your network bandwidth easy way?</em></blockquote><blockquote>Envoy compression filter helps us to improve this process.</blockquote><p>Istio doesn&#39;t have any <a href="https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/"><strong><em>CRD</em></strong></a> to enable gzip compression. Alright at this point EnvoyFilter rescues us to enable gzip.</p><p>Gzip is an HTTP filter that enables Envoy to compress dispatched data from an upstream service upon client request. Compression is useful in situations where large payloads need to be transmitted without compromising the response time.</p><h3><strong>Before Istio 1.7</strong></h3><p>Enable gzip any workload or istio-ingress gw</p><pre>apiVersion: networking.istio.io/v1alpha3<br>kind: EnvoyFilter<br>metadata:<br>  name: application-gzip<br>  namespace: istio-system<br>spec:<br>  workloadSelector:<br>    labels:<br>      app: workload-app<br>  configPatches:<br>    - applyTo: HTTP_FILTER<br>      match:<br>        context: SIDECAR_INBOUND<br>        listener:<br>          filterChain:<br>            filter:<br>              name: &quot;envoy.http_connection_manager&quot;<br>              subFilter:<br>                name: &#39;envoy.router&#39;<br>      patch:<br>        operation: INSERT_BEFORE<br>        value:<br>          name: envoy.gzip<br>          config:<br>            remove_accept_encoding_header: true<br>            compression_level: DEFAULT<br>            compression_strategy: </pre><h3>How it works</h3><p>When gzip filter is enabled, request and response headers are inspected to determine whether or not the content should be compressed.</p><h3>config.filter.http.gzip.v2.Gzip</h3><pre>memory_level: 1 to 9<br>Value from 1 to 9 that controls the amount of internal memory used by zlib.</pre><pre>compression_level: DEFAULT|BEST|SPEED<br>A value used for selecting the zlib compression level.</pre><pre>compression_strategy: DEFAULT|FILTERED|HUFFMAN|RLE<br>A value used for selecting the zlib compression strategy which is directly related to the characteristics of the content.</pre><h3>config.filter.http.compressor.v2.Compressor</h3><pre>content_length: Minimum response length, in bytes, which will trigger compression</pre><pre>content_type:  Set of strings that allows specifying which mime-types yield compression</pre><h3>After Istio 1.7</h3><pre>apiVersion: networking.istio.io/v1alpha3<br>kind: EnvoyFilter<br>metadata:<br>  name: application-gzip<br>  namespace: istio-system<br>spec:<br>  workloadSelector:<br>    labels:<br>      app: workload-app<br>  configPatches:<br>    - applyTo: HTTP_FILTER<br>      match:<br>        context: SIDECAR_INBOUND<br>        listener:<br>          filterChain:<br>            filter:<br>              name: envoy.http_connection_manager<br>              subFilter:<br>                name: envoy.router<br>      patch:<br>        operation: INSERT_BEFORE<br>        value:<br>          name: envoy.filters.http.compressor<br>          typed_config:<em><br>            </em>&#39;@type&#39;: type.googleapis.com/envoy.extensions.filters.http.compressor.v3.Compressor<br>            compressor_library:<br>              name: text_optimized<br>              typed_config:<br>                &#39;@type&#39;: type.googleapis.com/envoy.extensions.compression.gzip.compressor.v3.Gzip<br>            remove_accept_encoding_header: true</pre><h3>Statistics</h3><p>Every configured Compressor filter has statistics rooted at &lt;stat_prefix&gt;.compressor.&lt;compressor_library.name&gt;.&lt;compressor_library_stat_prefix&gt;.&lt;direction_prefix&gt;.* with the following:</p><h3>Result</h3><p>Before enabled gzip compression our average response size 100kB. It’s really high for network bandwidth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*CIG5uJUACvwvduMKnSr5qA.png" /></figure><p>After we enabled gzip compression our response size dramatically reduce at this time. %2 CPU usage increased.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*z3UqQ-r-TD0GHUptqvqvjg.png" /></figure><p><strong>References</strong>:</p><ul><li><a href="https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/compressor_filter">Compressor - envoy 1.19.0-dev-63307f documentation</a></li><li><a href="https://www.envoyproxy.io/docs/envoy/v1.14.5/configuration/http/http_filters/gzip_filter#config-http-filters-gzip">Gzip - envoy tag-v1.14.5 documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b75f20ea257" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Envoy Remote Access Log Collector]]></title>
            <link>https://gokhan-karadas1992.medium.com/envoy-remote-access-log-collector-84e4cde6375c?source=rss-c5b1e01bf082------2</link>
            <guid isPermaLink="false">https://medium.com/p/84e4cde6375c</guid>
            <category><![CDATA[als]]></category>
            <category><![CDATA[access-log]]></category>
            <category><![CDATA[istio]]></category>
            <category><![CDATA[envoy]]></category>
            <dc:creator><![CDATA[Gokhan Karadas]]></dc:creator>
            <pubDate>Sat, 17 Apr 2021 20:58:37 GMT</pubDate>
            <atom:updated>2021-04-17T20:58:37.137Z</atom:updated>
            <content:encoded><![CDATA[<p>Envoy proxy logs contain some information about our request that’s is useful for debugging and troubleshooting. Envoy proxies print access info to stdout.</p><h4>- Enable Envoy’s access logging with istio</h4><p>You can also choose between JSON and text by setting accessLogEncoding to JSON or TEXT.</p><p>You may also want to customize the <a href="https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#format-rules">format</a> of the access log by editing accessLogFormat.</p><pre>spec:<br>  meshConfig:<br>    accessLogFile: /dev/stdout<br>    accessLogEncoding: JSON</pre><h4>- Enable per workload access log</h4><p>Use EnvoyFilter to modify values for certain fields, add specific filters, or even add entirely new listeners, clusters, etc.</p><pre>apiVersion: networking.istio.io/v1alpha3<br>kind: EnvoyFilter<br>metadata:<br>  name: searchapi-access-log<br>spec:<br>  workloadSelector:<br>    labels:<br>      app: search-api<br>  configPatches:<br>    - applyTo: NETWORK_FILTER<br>      match:<br>        context: ANY<br>        listener:<br>          filterChain:<br>            filter:<br>              name: &quot;envoy.http_connection_manager&quot;<br>      patch:<br>        operation: MERGE<br>        value:<br>          typed_config:<br>            &quot;@type&quot;: &quot;type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager&quot;<br>            access_log:<br>              - name: envoy.file_access_log<br>                config:<br>                  path: /dev/stdout<br>                  jsonFormat:<br>                    authority: &quot;%REQ(:AUTHORITY)%&quot;<br>                    path: &quot;%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%&quot;<br>                    protocol: &quot;%PROTOCOL%&quot;<br>                    response_code: &quot;%RESPONSE_CODE%&quot;<br>                    response_flags: &quot;%RESPONSE_FLAGS%&quot;<br>                    route_name: &quot;%ROUTE_NAME%&quot;<br>                    upstream_host: &quot;%UPSTREAM_HOST%&quot;<br>                    user_agent: &quot;%REQ(USER-AGENT)%&quot;<br>                    x_agent_name: &quot;%REQ(X-AGENTNAME)%&quot;<br>                    x_forwarded_for: &quot;%REQ(X-FORWARDED-FOR)%&quot;</pre><p>How do we send to access log remote service?</p><p>We need to build a grpc server. with an endpoint that responds to AccessLogService_StreamAccessLogsServer. Envoy then will connect to it to send the logs. At his point<a href="https://github.com/envoyproxy/go-control-plane"> envoyproxy go-control-plane</a> help us to build our remote access log service.</p><p>Register our grpc server to Envoy. Envoy will connect and send StreamAccessLogsMessage messages forever. And transform HTTP or TCP logs to our current model.</p><pre>grpcServer := grpc.NewServer()<br>//Acl log<br>v2.RegisterAccessLogServiceServer(grpcServer, converter.New())</pre><p>We listen to grpc access log stream forever.</p><pre>func (s *server) StreamAccessLogs(stream v2.AccessLogService_StreamAccessLogsServer) error {<br>   for {<br>      in, err := stream.Recv()<br>      if err == io.EOF {<br>         return nil<br>      }<br>      if err != nil {<br>         return err<br>      }<br>      logEntries := transform(in.GetHttpLogs())<br>      for _, logEntry := range logEntries {<br>         var data []byte<br>         data, err = json.Marshal(logEntry)<br>         fmt.Println(string(data))<br>      }<br>   }<br>}</pre><p>We need to configure istio control plane for sending access log to our collector.</p><pre>data:<br>  mesh: |-<br>    accessLogEncoding: JSON<br>    accessLogFile: &quot;&quot;<br>    accessLogFormat: &quot;&quot;<br>    connectTimeout: 15s<br>    enableEnvoyAccessLogService: true<br>    defaultConfig:<br>      envoyAccessLogService:<br>        address: envoy-accesslog-collector.platform:9001</pre><p><strong>enableEnvoyAccessLogService</strong>: This flag enables Envoy’s gRPC Access Log Service.</p><p><strong>envoyAccessLogService.address: </strong>Address of the service to which access logs from Envoys should be sent.</p><pre>2021-04-17T09:29:51.252863378Z {&quot;timestamp&quot;:&quot;&quot;,&quot;traceId&quot;:&quot;6e3ead4b-3de3-4633-99ad-c961a00c74fa&quot;,&quot;method&quot;:&quot;GET&quot;,&quot;protocol&quot;:&quot;HTTP11&quot;,&quot;scheme&quot;:&quot;&quot;,&quot;statusCode&quot;:503,&quot;domain&quot;:&quot;search&quot;,&quot;path&quot;:&quot;/available-indexes&quot;,&quot;userAgent&quot;:&quot;Apache-HttpClient/4.5.10 (Java/1.8.0_222)&quot;,&quot;referer&quot;:&quot;&quot;,&quot;forwardedFor&quot;:&quot;x&quot;,&quot;upsteamFailure&quot;:&quot;&quot;,&quot;upstreamCluster&quot;:&quot;&quot;,&quot;downstreamDirectRemoteAddress&quot;:{&quot;address&quot;:&quot;x&quot;,&quot;port&quot;:21288},&quot;downstreamRemoteAddress&quot;:{&quot;address&quot;:&quot;x&quot;,&quot;port&quot;:21288},&quot;downstreamLocalAddress&quot;:{&quot;address&quot;:&quot;x&quot;,&quot;port&quot;:8080},&quot;upstreamRemoteAddress&quot;:{&quot;address&quot;:&quot;&quot;,&quot;port&quot;:0},&quot;upstreamLocalAddress&quot;:{&quot;address&quot;:&quot;&quot;,&quot;port&quot;:0},&quot;time_ms&quot;:0,&quot;request&quot;:{&quot;headersBytes&quot;:1498,&quot;bodyBytes&quot;:0,&quot;remoteIP&quot;:&quot;x&quot;},&quot;response&quot;:{&quot;details&quot;:&quot;no_healthy_upstream&quot;,&quot;headersBytes&quot;:113,&quot;bodyBytes&quot;:19}}</pre><p>See full code in <a href="https://github.com/previousdeveloper/als-collector">here</a>.</p><p><strong>References</strong>:</p><ul><li><a href="https://www.envoyproxy.io/">Envoy</a></li><li><a href="https://istio.io/latest/docs/reference/config/istio.mesh.v1alpha1/#RemoteService">https://istio.io/latest/docs/reference/config/istio.mesh.v1alpha1/#RemoteService</a></li><li><a href="https://github.com/envoyproxy/envoy/blob/main/api/envoy/data/accesslog/v2/accesslog.proto">https://github.com/envoyproxy/envoy/blob/main/api/envoy/data/accesslog/v2/accesslog.proto</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84e4cde6375c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wasm & Envoy for more functionality]]></title>
            <link>https://gokhan-karadas1992.medium.com/wasm-envoy-for-more-functionality-3f60a69c4423?source=rss-c5b1e01bf082------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f60a69c4423</guid>
            <category><![CDATA[assemblyscript]]></category>
            <category><![CDATA[wasm]]></category>
            <category><![CDATA[envoy]]></category>
            <dc:creator><![CDATA[Gokhan Karadas]]></dc:creator>
            <pubDate>Sun, 07 Feb 2021 15:20:52 GMT</pubDate>
            <atom:updated>2021-02-07T15:20:52.062Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AM4toqsLg00wov_Z3NjO3g.png" /><figcaption>Wasm with envoy</figcaption></figure><p><a href="https://www.envoyproxy.io/">Envoy</a> is a high performance, lb proxy that many service mesh implementations, such as <a href="https://istio.io/">Istio</a>, Consul Connect … At the core of Envoy’s connection and traffic management handling with network filters. You can control all the logging, monitoring with these filters. If you want to add new filters to extend Envoy’s current feature set with new functionalities. There are two ways to do that.</p><p>The <strong>first</strong> option to extend Envoy’s feature set is envoy filters require code changes to the <a href="https://www.envoyproxy.io/docs/envoy/latest/api-v2/config/filter/http/http">Envoy filters</a> require changes to its code and new binary set. This approach hard to manage all envoy version sync situations…</p><p>The <strong>second</strong> option is dynamically loading new filters using a Web Assembly (WASM) plugin. Web assembly has great advantages.</p><ul><li>Filters can load dynamically loaded into the running Envoy process.</li><li>Don’t need to know Envoy core language(C++).</li><li>When the WASM filter crashes it will not impact the Envoy process. (VM sandbox)</li><li>You can develop wasm filter more popular language Go, Rust…</li></ul><h3>Envoy Proxy WASM SDK</h3><p>Envoy Proxy runs WASM filters inside a stack-based virtual machine. All interactions between the embedding host (Envoy Proxy) and the WASM filter are realized through functions and callbacks provided by the Envoy Proxy WASM SDK. The Envoy Proxy WASM SDK has implementations in various programming languages like:</p><ul><li><a href="https://github.com/proxy-wasm/proxy-wasm-rust-sdk">Rust</a></li><li><a href="https://github.com/solo-io/proxy-runtime">AssemblyScript</a></li><li><a href="https://github.com/mathetake/proxy-wasm-go">Go</a></li></ul><p>In this post, we will build wasm using AssemblyScript and envoy.</p><p>First, you need to install Envoy:</p><pre>brew install envoy</pre><p><strong>AssemblyScript</strong></p><p>Create package.json for dependencies.</p><pre>{<br>  &quot;scripts&quot;: {<br>    &quot;asbuild:untouched&quot;: &quot;asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use abort=abort_proc_exit --sourceMap --debug&quot;,<br>    &quot;asbuild:optimized&quot;: &quot;asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat --use abort=abort_proc_exit --sourceMap --optimize&quot;,<br>    &quot;asbuild&quot;: &quot;npm run asbuild:untouched &amp;&amp; npm run asbuild:optimized&quot;,<br>    &quot;test&quot;: &quot;node tests&quot;<br>  },<br>  &quot;dependencies&quot;: {<br>    &quot;@assemblyscript/loader&quot;: &quot;^0.14.8&quot;,<br>    &quot;@solo-io/proxy-runtime&quot;: &quot;0.1.8&quot;<br>  },<br>  &quot;devDependencies&quot;: {<br>    &quot;assemblyscript&quot;: &quot;^0.14.8&quot;<br>  }<br>}</pre><h3>Code</h3><p>Copy this into assembly/index.ts:</p><pre>// @ts-ignore<br>export * from &quot;@solo-io/proxy-runtime/proxy&quot;; // this exports the required functions for the proxy to interact with us.<br>import { RootContext, Context, registerRootContext, FilterHeadersStatusValues, <strong><em>stream_context </em></strong>} from &quot;@solo-io/proxy-runtime&quot;;<br><br>class AddHeaderRoot extends RootContext {<br>    createContext(context_id: u32): Context {<br>        return new AddHeader(context_id, this);<br>    }<br>}<br><br>class AddHeader extends Context {<br>    constructor(context_id: u32, root_context: AddHeaderRoot) {<br>        super(context_id, root_context);<br>    }<br>    onResponseHeaders(a: u32, end_of_stream: bool): FilterHeadersStatusValues {<br>        <strong><em>stream_context</em></strong>.headers.response.add(&quot;hi&quot;, &quot;trendyol!&quot;);<br><br>        return FilterHeadersStatusValues.<em>Continue</em>;<br>    }<br>}<br><br>registerRootContext((context_id: u32) =&gt; { return new AddHeaderRoot(context_id); }, &quot;add_header&quot;);</pre><p>We declare a header class it extends from Context. You can implement which functionality you use. we override is onResponseHeaders which will add response header new value.</p><pre>onRequestHeaders(a: u32, end_of_stream: bool): FilterHeadersStatusValues { return FilterHeadersStatusValues.<em>Continue </em>}</pre><pre>onRequestMetadata(a: u32): FilterMetadataStatusValues { return FilterMetadataStatusValues.<em>Continue </em>}</pre><p><strong>RootContentxt</strong>: A root context represents a class of instance specific contexts. This is usually used to hold configuration that is used in the individual contexts.</p><p><strong>Context</strong>: Context class the base for a class for entities that are per-request or per-connection.</p><p><strong>RegisterRootContext</strong>: Register a root context and make it available to the runtime.<br>Params: root_context_factory — A function that creates a new root context.<br>name — The name of the root context. This should match the name configured in the proxy.</p><p>Let&#39;s build our wasm filter. If you remember we created package.json that has some build cmd.</p><p>To build, simply run:</p><pre>npm run asbuild</pre><p>build results will be in the build folder. optimized.wasm are the compiled file that we will use it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*hii2-ywDkWkTOuX1RF4gag.png" /></figure><p>Before running Envoy, we need to create a config file envoycfg.yaml. This configuration loads envoy with a WASM filter and then listens to port 8089 as a reverse-proxy to backend service that listens on localhost:8080</p><pre>static_resources:<br>  listeners:<br>    - name: listener_0<br>      address:<br>        socket_address: { address: 127.0.0.1, port_value: 8099 }<br>      filter_chains:<br>        - filters:<br>            - name: envoy.filters.network.http_connection_manager<br>              typed_config:<br>                &quot;<a href="http://twitter.com/type">@type</a>&quot;: type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager<br>                stat_prefix: ingress_http<br>                codec_type: AUTO<br>                route_config:<br>                  name: local_route<br>                  virtual_hosts:<br>                    - name: local_service<br>                      domains: [&quot;*&quot;]<br>                      routes:<br>                        - match: { prefix: &quot;/&quot; }<br>                          route: { cluster: svc_trendyol }<br>                http_filters:<br>                  - name: envoy.filters.http.wasm<br>                    typed_config:<br>                      &quot;<a href="http://twitter.com/type">@type</a>&quot;: type.googleapis.com/udpa.type.v1.TypedStruct<br>                      type_url: type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm<br>                      value:<br>                        config:<br>                          name: &quot;add_header&quot;<br>                          root_id: &quot;add_header&quot;<br>                          vm_config:<br>                            vm_id: &quot;my_vm_id&quot;<br>                            runtime: &quot;envoy.wasm.runtime.v8&quot;<br>                            code:<br>                              local:<br>                                filename: &quot;optimized.wasm&quot;<br>                            allow_precompiled: false<br>                  - name: envoy.filters.http.router<br>                    typed_config: {}</pre><pre>clusters:<br>    - name: svc_trendyol<br>      connect_timeout: 1.00s<br>      type: STATIC<br>      lb_policy: ROUND_ROBIN<br>      load_assignment:<br>        cluster_name: svc_trendyol<br>        endpoints:<br>          - lb_endpoints:<br>              - endpoint:<br>                  address:<br>                    socket_address:<br>                      address: 127.0.0.1<br>                      port_value: 8080</pre><p>Next, here’s our backend hello service which listens on port 8080 and responds to / which our Envoy proxy will redirect all the traffic to:</p><pre>var http = require(&#39;http&#39;);</pre><pre>//create a server object:<br>http.createServer(function (req, res) {<br>  res.write(&#39;Hello World!&#39;);<br>  res.end(); //end the response<br>}).listen(8080);<br>console.log(&quot;server started 8080&quot;);</pre><blockquote>After running the <strong>node</strong> service.</blockquote><pre>node demo-server.js</pre><pre>server started 8080</pre><p>Let’s run the Envoy proxy with our config file:</p><pre>$ envoy -c envoycfg.yaml -l debug</pre><p>Calling our service:</p><pre>$ curl localhost:8089</pre><p>should result with the following Envoy’s logs:</p><pre>&#39;:status&#39;, &#39;200&#39;<br>&#39;date&#39;, &#39;Sun, 07 Feb 2021 14:44:38 GMT&#39;<br>&#39;x-envoy-upstream-service-time&#39;, &#39;0&#39;<br>&#39;hi&#39;, &#39;trendyol!&#39;<br>&#39;server&#39;, &#39;envoy&#39;</pre><pre>[2021-02-07 17:44:38.959][1963853][debug][client] [source/common/http/codec_client.cc:112] [C9] response complete<br>[2021-02-07 17:44:38.960][1963853][debug][wasm] [source/extensions/common/wasm/context.cc:1168] wasm log: context id: 2: onLog()<br>[2021-02-07 17:44:38.960][1963853][debug][wasm] [source/extensions/common/wasm/context.cc:1168] wasm log: context id: 2: onDone()<br>[2021-02-07 17:44:38.960][1963853][debug][wasm] [source/extensions/common/wasm/context.cc:1168] wasm log: context id: 2: onDelete()</pre><p>See full code in <a href="https://github.com/previousdeveloper/proxy-assemblyscript-envoy">here</a>.</p><p>In the next part, we will cover go based web assembly and building on WebAssembly in Istio.</p><p><strong>References</strong>:</p><ul><li><a href="https://www.envoyproxy.io/">Envoy</a></li><li><a href="https://www.solo.io/blog/the-state-of-webassembly-in-envoy-proxy/">https://www.solo.io/blog/the-state-of-webassembly-in-envoy-proxy/</a></li><li><a href="https://banzaicloud.com/blog/envoy-wasm-filter/">https://banzaicloud.com/blog/envoy-wasm-filter/</a></li><li><a href="https://istio.io/latest/blog/2020/wasm-announce/">Redefining extensibility in proxies — introducing WebAssembly to Envoy and Istio</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f60a69c4423" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Service Mesh Journey At Trendyol — Part 2]]></title>
            <link>https://medium.com/trendyol-tech/service-mesh-journey-at-trendyol-part-2-9606f9953c1?source=rss-c5b1e01bf082------2</link>
            <guid isPermaLink="false">https://medium.com/p/9606f9953c1</guid>
            <category><![CDATA[service-mesh]]></category>
            <category><![CDATA[istio]]></category>
            <dc:creator><![CDATA[Gokhan Karadas]]></dc:creator>
            <pubDate>Tue, 28 Apr 2020 10:37:16 GMT</pubDate>
            <atom:updated>2020-04-28T19:31:06.339Z</atom:updated>
            <content:encoded><![CDATA[<h3>Service Mesh Journey At Trendyol — Part 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MgjNIAseyRT296kWJBJTsQ.png" /></figure><p>In <a href="https://medium.com/@gokhan.karadas1992/service-mesh-journey-at-trendyol-part-1-468033817d44">Part1</a> of this series, I talked about how we decided to use service mesh in Trendyol and some basic concept about Istio. In this part, we will talk about a more detailed Istio configuration and tuning for the production.</p><h3>The Istio Service Mesh Architecture</h3><ul><li>Istio service mesh is an intentionally designed abstraction that has both a control plane and a data plane.</li><li>Istio is a service mesh created by the combined efforts of IBM, Google, and Lyft. The sidecar patterns are enabled by the Envoy proxy and are based on containers.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-KjtBENLffUjIjvTH-g9_Q.jpeg" /><figcaption><a href="https://istio.io/docs/ops/deployment/architecture/">https://istio.io/docs/ops/deployment/architecture/</a></figcaption></figure><ul><li>A control plane that controls the overall network infrastructure and strengthens the policy and traffic rules.</li><li>A data plane that uses sidecars through the Envoy makeshift which is an open source edge proxy.</li></ul><h4>Getting started</h4><p>To install Istio we use Istio Operator. There is a lot of configuration profile which are default, demo, minimal, and remote... We use minimal configuration profile and we changed some of the behavior like envoy proxy CPU and memory limit. As well as the minimal configuration does not have an ingress gateway. We enabled it to get outside traffic in the cluster. We don’t need mTLS for the internal service now. Istio should be configured with mTLS as “PERMISSIVE” which allows non-TLS requests to enter the mesh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*niqsEWp-XX3QPvg942PquQ.png" /></figure><h4>Sidecar Injection Strategy</h4><p>In order to use Istio mesh, we need to enable envoy sidecar injection.</p><p>Istio works by injecting a sidecar proxy based on Envoy alongside your application which intercepts all inbound and outbound calls going to and from the pod. There are two ways of injecting the Istio sidecar into a pod which are manual sidecar injection and automation sidecar injection. We are using manual sidecar injection in the production environment.</p><p>You can disable auto injection in namespace and no automatic injection occurs here :</p><pre>kubectl label namespace trendyol-team istio-injection=disabled<br>kubectl get namespace -L istio-injection</pre><p>We were able to roll out Istio on an application by application basis by adding the following annotation to pods:</p><pre>sidecar.istio.io/inject: &quot;true&quot;</pre><p>Injection occurs at pod creation time. Kill the running pod and verify a new pod is created with the injected sidecar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/218/1*vNjEyL0k_gKv2M06jnvrUQ.png" /><figcaption>One pod two container example</figcaption></figure><p>The istio-init container sets up the pod network traffic redirection to/from the Istio sidecar proxy. Init containers execute before the sidecar proxy starts.</p><p><strong>Application Startup Fail With Sidecar</strong></p><p>In stage environment after enabling an application for Istio we realize that some pods don’t connect to outbound service. We investigate that this was occurring because the application container was starting before the Istio-proxy container was ready which then caused outbound requests to fail.</p><p>We solve this problem like disabling redirecting traffic to the specific outbound ports the init containers. We couldn’t find the best solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*OE6C9f94waSxwYyoZDoWVQ.png" /></figure><pre>&quot;traffic.sidecar.istio.io/excludeOutboundPorts&quot;: &quot;8091,11210&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*2PvwZwTMqX0BG0-JIiKwhA.png" /></figure><h4>Ingress Gateway</h4><p>In order to handle outside traffic to the cluster, we need to use <strong>Istio ingress gateway</strong>. If you remember we enabled with our configuration. We use a <a href="https://istio.io/docs/reference/config/networking/gateway/#Gateway">gateway</a> to manage inbound traffic. We deployed ingress gateway as a daemon set in the large Kubernetes cluster you need to separate it for each namespace deployments.</p><pre>kind: Gateway<br>apiVersion: networking.istio.io/v1beta1<br>metadata:<br>  name: browsing-gateway<br>  namespace: default<br>spec:<br>  servers:<br>    - hosts:<br>        - &#39;www.trendyol.com&#39;<br>      port:<br>        name: http<br>        number: 80<br>        protocol: HTTP<br>  selector:<br>    istio: ingressgateway</pre><p>In this configuration, we accept HTTP traffic from incoming <a href="http://www.trendyol.com./">www.trendyol.com</a> you can create multiple gateway definitions to manage your traffic. Maybe you want to block some IP blocks.</p><h4>Handle Too High Envoy Resource Overhead</h4><p>One of the core problems to be solved when Envoy was developed was the observability of services. Therefore, Envoy has embedded a large number of statistics from the very beginning to better observe services.</p><p>Envoy offers fine-grained statistics, even at the IP level of the entire cluster. each IP address carries different metadata under different services, and therefore the same IP addresses are independent under different services. As a result, Envoy consumes a huge amount of memory. To address this issue, we have added the stats toggle to Envoy to disable or enable IP-level statistics. Disabling IP-level statistics directly reduces memory usage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vXME3n5Tfo8Lb9kEj54qCg.png" /></figure><pre>source_workload: source.workload.name | &quot;unknown&quot;<br>      source_workload_namespace: source.workload.namespace | &quot;unknown&quot;<br>      source_principal: source.principal | &quot;unknown&quot;<br>      source_app: source.labels[&quot;app&quot;] | &quot;unknown&quot;<br>      source_version: source.labels[&quot;version&quot;] | &quot;unknown&quot;<br>      destination_workload: destination.workload.name | &quot;unknown&quot;<br>      destination_workload_namespace: destination.workload.namespace | &quot;unknown&quot;<br>      destination_principal: destination.principal | &quot;unknown&quot;<br>      destination_app: destination.labels[&quot;app&quot;] | &quot;unknown&quot;<br>      destination_version: destination.labels[&quot;version&quot;] | &quot;unknown&quot;<br>      destination_service: destination.service.host | conditional((destination.service.name | &quot;unknown&quot;) == &quot;unknown&quot;, &quot;unknown&quot;, request.host)<br>      destination_service_name: destination.service.name | &quot;unknown&quot;<br>      destination_service_namespace: destination.service.namespace | &quot;unknown&quot;<br>      request_protocol: api.protocol | context.protocol | &quot;unknown&quot;<br>      response_code: response.code | 200<br>      grpc_response_status: response.grpc_status | &quot;&quot;<br>      response_flags: context.proxy_error_code | &quot;-&quot;<br>      connection_security_policy: conditional((context.reporter.kind | &quot;inbound&quot;) == &quot;outbound&quot;, &quot;unknown&quot;, conditional(connection.mtls | false, &quot;mutual_tls&quot;, &quot;none&quot;))</pre><h4>Istio Pilot Tuning</h4><p>Pilot provides service discovery for the Envoy sidecars, traffic management capabilities for intelligent routing (e.g., A/B tests, canary deployments, etc.), and resiliency (timeouts, retries, circuit breakers, etc.). It converts high-level routing rules that control traffic behavior into Envoy-specific configurations and propagates them to the sidecars at runtime. Pilot abstracts platform-specific service discovery mechanisms and synthesizes them into a standard format consumable by any sidecar that conforms to the Envoy data plane APIs. When every new sidecar that’s means every scale your pod it adds more load to Istio control plane.</p><p>Pilot connects to every istio-proxy and every istio-proxy checks and reports metrics to telemetry v2. Before every namespace we migrated to Istio we monitored and tuned the control plane.</p><p><strong>Before tuning </strong>our control plane, when Istio-pilot sends it to push to sidecars, our service decreased at this moment. Our pilot CPU usage is almost 2 cores.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BOTB-KKWoQVbpObGH_qdbQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uMAWTowCvKdjue7E1y9ilA.png" /></figure><p>We have changed pilot push concurrent value. This is default 100. Limits the number of concurrent pushes allowed. We have added also some of the delays for Isto- pilot push.</p><pre>PILOT_PUSH_THROTTLE=1:</pre><pre>Limits the number of concurrent pushes allowed. On larger machines this can be increased for faster pushes</pre><pre>PILOT_DEBOUNCE_AFTER=10s:</pre><pre>The delay added to config/registry events for debouncing. This will delay the push by at least this internal. If no change is detected within this period, the push will happen, otherwise we&#39;ll keep delaying until things settle, up to a max of PILOT_DEBOUNCE_MAX.</pre><p><strong>After Tuning</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B7-2a4eaxE0YXoUYv6h6KA.png" /><figcaption>Cpu usage after 16:00</figcaption></figure><h4>Envoy Proxy Concurrency</h4><p>Envoy proxy concurrency means this parameter control to sidecar worker thread to reduce CPU utilization and also improve your application performance. The default value is 0 which means starting worker thread for each CPU core. You can find the best throughput to change this setting. Be aware each change is effect to memory and CPU usage of each sidecar process.</p><h4>Ingress &amp; Egress Gateway Gzip Filter</h4><p>You can enable gzip for ingress and egress gateway. Gzip Compression is useful in situations where large payloads need to be transmitted without compromising the response time.</p><p><a href="https://www.envoyproxy.io/docs/envoy/v1.8.0/configuration/http_filters/gzip_filter">Gzip - envoy tag-v1.8.0 documentation</a></p><pre>apiVersion: networking.istio.io/v1beta1<br>kind: EnvoyFilter<br>metadata:<br>  name: ingressgateway-gzip-ef<br>  namespace: istio-system<br>spec:<br>  workloadSelector:<br>    labels:<br>      istio: ingressgateway<br>  configPatches:<br>    - applyTo: HTTP_FILTER<br>      match:<br>        context: GATEWAY<br>        listener:<br>          filterChain:<br>            filter:<br>              name: &quot;envoy.http_connection_manager&quot;<br>              subFilter:<br>                name: &#39;envoy.router&#39;<br>      patch:<br>        operation: INSERT_BEFORE<br>        value:<br>          name: envoy.gzip<br>          config:<br>            remove_accept_encoding_header: true<br>            compression_level: BEST</pre><h3>Conclusion</h3><p>We had improved data plane and control plane in the production environment. I will publish the service and envoy proxy metrics. Share with us the best tuning option for low latency and max QPS.</p><p>In the next part, we will take a look at the Istio traffic management rules. Such as virtual service, service entries.</p><ul><li><a href="https://github.com/istio/istio/issues/20262">Istio Pilot consuming huge CPU resources · Issue #20262 · istio/istio</a></li><li><a href="https://github.com/istio/istio/issues/20647">High CPU usage of Pilot due to ServiceEntry prior to 1.5.0 · Issue #20647 · istio/istio</a></li><li><a href="https://www.envoyproxy.io/docs/envoy/latest/api-v2/config/filter/http/gzip/v2/gzip.proto">Gzip - envoy 1.15.0-dev-61d5aa documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9606f9953c1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trendyol-tech/service-mesh-journey-at-trendyol-part-2-9606f9953c1">Service Mesh Journey At Trendyol — Part 2</a> was originally published in <a href="https://medium.com/trendyol-tech">Trendyol Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Service Mesh Journey At Trendyol — Part 1]]></title>
            <link>https://medium.com/trendyol-tech/service-mesh-journey-at-trendyol-part-1-468033817d44?source=rss-c5b1e01bf082------2</link>
            <guid isPermaLink="false">https://medium.com/p/468033817d44</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[service-mesh]]></category>
            <category><![CDATA[istio]]></category>
            <dc:creator><![CDATA[Gokhan Karadas]]></dc:creator>
            <pubDate>Tue, 28 Apr 2020 10:36:59 GMT</pubDate>
            <atom:updated>2020-04-28T19:31:03.050Z</atom:updated>
            <content:encoded><![CDATA[<h3>Service Mesh Journey At Trendyol — Part 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MgjNIAseyRT296kWJBJTsQ.png" /></figure><p>We are a Tech company. Technology is the driver, e-commerce is the outcome. Trendyol Tech team enables us to grow faster by using technology. We have cross-functional autonomous teams that are organized around a line of business, learn continuously, and have various technical competencies. We are all working towards the same goal: to create an excellent experience for our customers at Trendyol.</p><p>Before talking about everything about service mesh in deeply I want to explain why we need a service mesh.</p><p>At Trendyol we run hundreds of microservices that do everything from the best customer experience. Running microservices at scale is not without its own challenges. When we compared to last year our microservice size is repeatedly increasing so it becomes increasingly difficult to understand the interactions between all these services. When a problem occurs in a microservice world, it can be really difficult to find where the problem is. Service mesh addresses these challenges where the implementation of these cross-cutting capabilities is configured as code. Like traffic management of microservice, monitoring, security, deployment strategy…</p><p>Maybe we can solve this problem to integrate client-side solutions. In many ways, libraries like Finagle, Stubby, and Hystrix were the first service meshes. While they were specific to the details of their surrounding environment and required the use of specific languages and frameworks.</p><p>Early in 2019, we started looking at ways to handle this problem and concluded that a service mesh. There are a lot of service mesh tools in the software world such as Istio, Linkerd 2, AWS App Mesh, Consul Connect, Kuma. Istio is the best option to use in production which has more reliable features and more community.</p><h4>What is Service Mesh?</h4><p>Service mesh manages all service-to-service communication within a microservice-based system. It accomplishes this typically via the use of “sidecar” proxies that are deployed alongside each service. It is useful for traffic management and monitorings some point here every useful thing has some tradeoff like complexity and runtime resource usage.</p><ol><li>Service 1 sends a request to service 2.</li><li>On exiting Service 1, the request is redirected in its sidecar.</li><li>Sidecar sends a request to service 2 mesh.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2dFoXFtV4JeNratGq18GQg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vqjmJyAV3Uz6P_Td-QoWRw.jpeg" /><figcaption>servicemesh.es</figcaption></figure><h4><strong>How did we decide Istio is the best option for us?</strong></h4><p>Before starting the service mesh implementation we analyze our requirement. In our use case, we strongly need Timeout Management, Circuit Breaking, Grpc Load Balancing, Rate Limiting, Performance, and Monitoring.</p><p>We made some of the benchmark tests to show latency between our microservices communication. Istio and other service mesh products are nearly the same. I think resource consumption is higher than in others.</p><h4>Poc Team</h4><p>We have more than thirty teams to solve some e-commerce problems in the Trendyol. Firstly we discovered which team is easy to integrate into an Istio mesh. We decided to start with Browsing team basically which is responsible give some personalization, and product detail data to other gateways.</p><h4>Istio Mesh</h4><p>Istio is a service mesh that is built around an Envoy proxy to manage and control the flow of traffic, secure services and see what’s happening between them. In addition, Istio works well with other common infrastructure and monitoring components such as <a href="https://www.jaegertracing.io/">Jaeger</a>, Grafana, <a href="https://kiali.io/">Kiali</a> and Prometheus.</p><ul><li>Load balancing for HTTP, gRPC.</li><li>Rich routing rules, retries, failovers, and fault injection.</li><li>Monitoring mesh services with more details.</li><li>Service to service authentication and authorization.</li></ul><p>We spent several months load testing and configuring Istio on our staging environment. First off all, we made some service to the service load test benchmark. We figure out something in our baseline test (without envoy proxy sidecar) more than handle rpm to envoy proxy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aDcN0NPXe1VmmR4NgB-8kQ.png" /></figure><p>First 75k rpm Baseline test. The second one is with the envoy proxy. We have changed some Istio configuration to find the best rpm for us. In the next parts, I will talk about deeply.</p><figure><img alt="Browsing Team Mesh Graph" src="https://cdn-images-1.medium.com/max/1024/1*Ko3F4RD-xEF_oAE1EhgRzg.png" /><figcaption>Browsing-Team Mesh Graph</figcaption></figure><h4>Which Istio feature primary for you?</h4><p>Istio has great features, connectivity, observability, security, and traffic control. It’s very hard to implement all features at first. We have decided to improve our service resilience and monitoring. For service resilience, we enabled retry policy, timeouts, and circuit breaking features. Some team has different requirements like an end to end authentication, jwt policy enforcement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*72Gqmhd-SvinrNnpZLAZ5Q.png" /></figure><h4>The Hidden Cost Data Plane</h4><p>Be aware and scale your cluster for the extra envoy proxy CPU and memory consumption. Why? Because it’s adding another sidecar (<a href="https://www.envoyproxy.io/">Envoy</a> proxy), running on <strong>all the pods in your clusters</strong>. So the question is — how much it is going to cost? This really depends on how much resources Istio consumes. How much traffic received from your envoy proxy?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vu7RT_DUuqDjVK-XlaEVyg.png" /></figure><pre>global:<br>  proxy:<br>    resources:<br>      requests:<br>        cpu: 10m<br>        memory: 128Mi<br>      limit:<br>        cpu: 2000m<br>        memory: 2024Mi<br></pre><p>Change the proxy resource limit, if you need more than 1 CPU.</p><pre>data:<br>  mesh: &gt;-<br>    # Set enableTracing to false to disable request tracing.</pre><pre>enableTracing: false<br># which makes pilot generates tracing sampling config for envoy</pre><p>If you want to use globally distributed tracing you should disable it. Envoy doesn&#39;t send tracing information directly to tracing backends.</p><h4>Check Control Plane</h4><p>What happens if your control plane goes down? The Control plane pilot is responsible for the traffic management feature of Istio, and it also is responsible for updating all sidecars with the very latest mesh configuration. Pilot automatically detects a change in the mesh (it monitors Kubernetes resources in etcd), it pushes the new configuration to sidecars via this gRPC connection. All these changes live in sidecar proxy memory. When Pilot goes down traffic is not affected because the last configuration saved by envoy proxy.</p><h4>Nginx 426 Upgrade Problem</h4><p>When ingress gateway enabled our Nginx is getting upgrade required error. We have enabled Istio ingress gateway 1.0 support.</p><pre>&gt; GET / HTTP/1.0<br>&gt; Host: kiali.istio-system.svc.cluster.local:20001<br>&gt; Accept: */*<br>&gt; <br>&lt; HTTP/1.1 426 Upgrade Required<br>&lt; server: envoy<br>&lt; content-length: 0</pre><p>Support ingress gateway 1.0 Http traffic.</p><pre>gateways:<br>  istio-ingressgateway:<br>    env:<br>      ISTIO_META_HTTP10: &#39;&quot;1&quot;&#39;</pre><h3>Conclusion</h3><p>Service mesh is a very critical component of the large system. It provides us security, traffic management, and observability to be taken out of developers’ hands. On the other hand, every benefit comes with some learning curve, cost, and management complexities. In the <a href="https://medium.com/@gokhan.karadas1992/service-mesh-journey-at-trendyol-part-2-9606f9953c1"><strong>next part</strong></a>, we will talk more detail about Istio.</p><h4><strong>References</strong>:</h4><ul><li><a href="https://istio.io/docs/concepts/traffic-management/">Traffic Management</a></li><li><a href="https://servicemesh.es/">servicemesh.es</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=468033817d44" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trendyol-tech/service-mesh-journey-at-trendyol-part-1-468033817d44">Service Mesh Journey At Trendyol — Part 1</a> was originally published in <a href="https://medium.com/trendyol-tech">Trendyol Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[REMOTE JITSERVER TECHNOLOGY]]></title>
            <link>https://medium.com/trendyol-tech/remote-jitserver-technology-d62302c85747?source=rss-c5b1e01bf082------2</link>
            <guid isPermaLink="false">https://medium.com/p/d62302c85747</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[openj9]]></category>
            <category><![CDATA[jit]]></category>
            <dc:creator><![CDATA[Gokhan Karadas]]></dc:creator>
            <pubDate>Mon, 20 Apr 2020 07:51:22 GMT</pubDate>
            <atom:updated>2020-04-21T14:20:18.082Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MgjNIAseyRT296kWJBJTsQ.png" /></figure><h4>JIT COMPILER</h4><p>The (JIT) compiler is a component of the runtime environment that improves the performance of Java applications by compiling bytecodes to native machine code at run time.</p><p>Java programs consist of classes, which contain platform-neutral bytecodes that can be interpreted by a JVM on many different computer architectures. At run time, the JVM loads the class files determine the semantics of each individual bytecode, metadata processing, and profiling, another processing. The additional processor and memory usage during interpretation mean that a Java application performs more slowly than a native application. You can find more detail about<a href="https://mstoodle.github.io/EclipseOpenJ9JitVerboseLogs/"> <strong>JIT process</strong></a>.</p><h4>JIT SERVER TECHNOLOGY PREVIEW</h4><p>JIT server technology decouples the JIT compiler from the VM. JIT runs own process remotely. This provides us with low memory and low CPU spiky when the application startup. The process can run either locally or on a remote machine.</p><p>Recommendation way to use this technology</p><ul><li>Your Java application is required to compile many methods using JIT in a relatively short time.</li><li>The application is running in an environment with limited CPU or memory.</li></ul><h4>Traditional JIT Arch</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wy0QXa_X2AGulHhGukkHSQ.png" /></figure><h4>REMOTE JIT SERVER</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hkxex8x7GpPHrIuVnp9cGQ.png" /></figure><h3>How does it works?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/0*ZlW3lZUDDcw6dH3u" /></figure><p>When the client VM wants to compile a method, it sends a request to the server. Server compiles it, and sends compiled code back to the client. Once the client receives the compiled code, it relocates and installs it in the code cache.</p><p>The main benefits: smaller memory footprint and CPU consumption on the client, without sacrificing throughput for small docker environment.</p><p>Reference:<a href="https://blog.openj9.org/2019/05/01/openj9-internship-making-jit-a-cloud-service/">https://blog.openj9.org/2019/05/01/openj9-internship-making-jit-a-cloud-service/</a></p><h4><strong>SETUP REMOTE JIT SERVER</strong></h4><p>It’s currently available for OpenJDK 8 and OpenJDK 11 running on Linux on x86–64.</p><h3>Run OpenJ9 in server mode</h3><p>It listens for incoming compilation requests default port 38400.</p><pre>FROM  adoptopenjdk/openjdk11-openj9<br>ENTRYPOINT jitserver -Xjit:verbose</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*3xlK_vjhuXsaTDSpbZJeCw.png" /></figure><h3>Run OpenJ9 JITSERVER in client mode</h3><p>Virtual Machine sends compilation requests to an available JITServer. If no available JITSERVER it automatically uses local jit.</p><pre>java  -jar -XX:+UseJITServer -XX:JITServerAddress=&quot;172.17.0.2&quot;</pre><p>When the application started there is no CPU and memory spiky. Because all processes handled with remote JITSEREVER.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3qzwMzIe78Tt0Gx1hvpXBA.png" /></figure><p>You can see remote server Jit verbose log</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8v8Yb1-EyRUeMWBOywUnHQ.gif" /></figure><p>In this case, the remote jit server started before our application. After that, we started our application. You can see that our application CPU consumption is %1 CPU. <a href="https://github.com/previousdeveloper/remote-jit-sample"><strong>Source Code</strong></a></p><h3><strong>Conclusion</strong></h3><ul><li>This prevents unnecessary CPU spiky.</li><li>The JIT compiler no longer steals CPU cycles from the application.</li><li>JITServer is currently a technology preview.</li><li>Performance depends on the docker environment CPU and memory limit.</li></ul><p>You can find more detail below about the implementation of JITserver and performance benchmarks.</p><ul><li><a href="https://blog.openj9.org/2020/02/11/a-glimpse-into-performance-of-jitserver-technology/">A glimpse into performance of JITServer technology</a></li><li><a href="https://blog.openj9.org/2020/01/09/free-your-jvm-from-the-jit-with-jitserver-technology/">Free your JVM from the JIT with JITServer technology</a></li><li><a href="https://www.eclipse.org/openj9/docs/jitserver/">JITServer (tech. preview) -</a></li><li><a href="https://github.com/previousdeveloper/remote-jit-sample">previousdeveloper/remote-jit-sample</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d62302c85747" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trendyol-tech/remote-jitserver-technology-d62302c85747">REMOTE JITSERVER TECHNOLOGY</a> was originally published in <a href="https://medium.com/trendyol-tech">Trendyol Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>