<?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 Chao Zhang on Medium]]></title>
        <description><![CDATA[Stories by Chao Zhang on Medium]]></description>
        <link>https://medium.com/@tokers?source=rss-f574c62feabd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*CmekpFHi5lvjp3_o.jpg</url>
            <title>Stories by Chao Zhang on Medium</title>
            <link>https://medium.com/@tokers?source=rss-f574c62feabd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 08:26:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tokers/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[Simple Traefik Toturial]]></title>
            <link>https://medium.com/@tokers/simple-traefik-toturial-9fe07fa81a77?source=rss-f574c62feabd------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fe07fa81a77</guid>
            <category><![CDATA[api-gateway]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[traefik]]></category>
            <dc:creator><![CDATA[Chao Zhang]]></dc:creator>
            <pubDate>Thu, 24 Aug 2023 11:44:05 GMT</pubDate>
            <atom:updated>2023-08-24T11:44:05.353Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, I started to use <a href="https://traefik.io/traefik/">Traefik</a>, a cloud-native application proxy. In this article, I’ll share something about Traefik, and if you’re also researching or learning Treafik, hopefully, this article can help you to a certain extent.</p><p><strong>Please note that everything in this article is about the community edition of Traefik. There is nothing about the Traefik Enterprise or Traefik Hub.</strong></p><p>Indeed, I’m a <a href="https://www.apache.org/dev/pmc.html">PMC</a> member of <a href="https://apisix.apache.org/">Apache APISIX</a>, which is another famous API gateway. I give up using Apache APISIX because it relies on the <a href="https://etcd.io/">ETCD</a> tightly (although it has a so-called standalone mode, it’s not so powerful). ETCD is popular, but not all companies use it, and it’s always irresistible for introducing unfamiliar software stacks.</p><h3>Configuration Discovery</h3><p>On the contrary, Traefik doesn’t rely on a single configuration center; instead, it provides a lot of “providers” for discovering configurations, e.g., files, Kubernetes Ingress resources, and HTTP servers. You can choose a provider according to the actual situation.</p><p>For various reasons, I decided to use Redis as Traefik’s provider., I saw the docs but didn’t find a way to write configurations to Redis. Fortunately, The docs show the key value formats for almost all configuration items. So, I wrote a tiny tool to sync configurations to Redis, which drives Traefik to run successfully. Anyway, KV-type providers are not the best way to control Traefik.</p><p>PS, you may deliberate carefully before you select a configuration provider. Not all providers are mature enough.</p><h3>Entrypoints</h3><p>The <a href="https://doc.traefik.io/traefik/routing/entrypoints/">entrypoint</a>, like its name, is the entry for requests to reach Traefik. It is just like the <a href="https://www.envoyproxy.io/docs/envoy/latest/configuration/listeners/listeners">Listener</a> in Envoy. You need to configure a listening address for an entrypoint.</p><pre>entryPoints:<br>  web:<br>    address: :8080</pre><h3>Services</h3><p><a href="https://doc.traefik.io/traefik/routing/services/">Service</a> is one of the Cornerstones for Traefik. It’s the definition for the backend services. Service tells Traefik where are the addresses of the backend services. Other features provided by the service are:</p><ul><li>Load Balancing, which decides the endpoints picking strategy. Currently, only Weighed Round Robin and Cookie-based stick sessions are supported. Choices are fewer when comparing Traefik with Kong, Apache APISIX, and Envoy.</li><li>Health Check, which lets Traefik filter some unhealthy endpoints.</li><li>Timeout control.</li><li>mTLS and peering certificate verification settings.</li></ul><pre>http:<br>  services:<br>    httpbin:<br>      loadBalancer:<br>        passHostHeader: true<br>        servers:<br>        - url: https://httpbin.org</pre><h3>Routers</h3><p>The <a href="https://doc.traefik.io/traefik/routing/routers/">router</a> guides how Traefik will match and forward requests. It’s composed of:</p><ul><li>Rule, which defines requests’ characteristics for matching the router</li><li>Service, which is the destination service for these requests.</li><li>Entrypoints, which are optional. Only requests from specific entrypoints will be matched with this router.</li><li>Middlewares, a series of middlewares for transforming requests, e.g., adding headers, rewriting URL path.</li></ul><pre>http:<br>  routers:<br>    httpbin:<br>      rule: Host(`httpbin.org`) &amp;&amp; PathPrefix(`/v1`)<br>      middlewares:<br>      - rewrite<br>      service: httpbin</pre><h3>Deploy Traefik</h3><p>You can deploy Traefik on bare metal (thanks to Golang, only a simple binary), Docker (via the Traefik docker image), and Kubernetes (via Helm). The deployment of Traefik is refined constantly. So I think this process will be smooth.</p><h3>Summary</h3><p>Concepts in Traefik are few, so it’s easy to start using it. It would be a good solution if you need simple and efficient proxy software, and it won’t take more effort to deploy and maintain it. That’s the most exciting part for me because Traefik is simple.</p><p>Of course, this article only shows parts of the Traefik; other things, like HTTPS &amp; TLS, additional providers, and supporting middleware, must be covered if you want to get more Traefik power. But I hope this article can be a simple tutorial to learn what Traefik is.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fe07fa81a77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rate Limiting strategies you should know]]></title>
            <link>https://medium.com/@tokers/rate-limiting-strategies-you-should-know-fabe179e7cb9?source=rss-f574c62feabd------2</link>
            <guid isPermaLink="false">https://medium.com/p/fabe179e7cb9</guid>
            <category><![CDATA[fixed-windows]]></category>
            <category><![CDATA[rate-limiting]]></category>
            <category><![CDATA[token-buckets]]></category>
            <category><![CDATA[api-gateway]]></category>
            <category><![CDATA[leaky-bucket]]></category>
            <dc:creator><![CDATA[Chao Zhang]]></dc:creator>
            <pubDate>Tue, 07 Feb 2023 12:02:51 GMT</pubDate>
            <atom:updated>2023-02-07T12:02:51.941Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>In <a href="https://en.wikipedia.org/wiki/Computer_network">computer networks</a>, <strong>rate limiting</strong> is used to control the rate of requests sent or received by a <a href="https://en.wikipedia.org/wiki/Network_interface_controller">network interface controller</a>. It can be used to prevent <a href="https://en.wikipedia.org/wiki/Denial-of-service_attack">DoS attacks</a><a href="https://en.wikipedia.org/wiki/Rate_limiting#cite_note-cisco-1">[1]</a> and limit <a href="https://en.wikipedia.org/wiki/Web_scraping">web scraping</a>.<a href="https://en.wikipedia.org/wiki/Rate_limiting#cite_note-2">[2]</a></blockquote><p>As Wikipedia says, rate limiting prevents services from being attacked and overloaded. It’s used widely in the <a href="https://api7.ai/blog/what-is-an-api-gateway">API Gateway</a> pattern, as API Gateway is almost the first server-side component for processing requests from clients responsible for protecting the backend services.</p><p>In this article, I will share some common rate-limiting strategies <strong>used in API Gateway</strong>. Please note I won’t mention any implementation details. This article is a high-level introduction to these rate-limiting strategies.</p><h3>Fixed window</h3><p>The fixed window algorithm limits the number of requests/connections at the given period. For example, the API gateway might be configured as only 200 HTTP requests can be forwarded in a minute, then the 201st request will be rejected by the API gateway (maybe with a 429 status code). The counter will be reset once the period ends.</p><p>The fixed window algorithm is simple, but it’s not perfect. In the above case, 200 HTTP requests arrive in the last second of the current period, and 200 HTTP requests come in the first second of the next period. The API Gateway will forward 400 HTTP requests in only two seconds! Which violates the constraint that only 200 requests can be sent in a minute!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GzqZ6IBZ9aNl-2mTEMBR6Q.png" /></figure><p>Malicious attackers can leverage this flaw, and the rate-limiting strategy might be ineffective, and thus your services might burst. So choose a reasonable threshold when you use it!</p><h3>Leaky Bucket</h3><p>The fixed window algorithm doesn’t care when requests come in and how dense they are. While the leaky bucket algorithm restricts requests in another way, it divides the time window into time slices one by one and limits the number of requests in the single time slice. For instance, an API Gateway only allows ten requests can be forwarded in a second. In the leaky bucket scene, at most, one request can be sent per 100 milliseconds. This means if you only have two requests arrive in a second but are too close, the second will still be rejected (although the threshold is 10)!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*lnN7Vmik4NaE4rO99W0qdw.png" /></figure><p>The leaky bucket algorithm is appropriate for that backend service cannot bear too many requests at one moment (maybe the operations are slow). Some implementations (e.g., Nginx) support the burst so that the API Gateway can process the sudden peak (these requests can be delayed or rejected directly).</p><h3>Token Bucket</h3><p>Here we have another rate-limiting algorithm called the token bucket algorithm. Let’s imagine we have a big bucket and some tokens in it. Every time a request comes in, it takes a token from the bucket. If the bucket is empty, this request will be rejected (or delayed until it takes a token). On the other hand, several tokens will be generated and added to the bucket at regular intervals. Of course, the capacity of the bucket is not infinite, so that excess tokens will be dropped.</p><p>Let’s say we have a token bucket whose capacity is 10 (and initially, it’s full), five tokens will be added per minute. So in the first minute, ten requests can be forwarded at most. In the next few minutes, we will have extra five tokens added to the bucket in each minute so that we may have 5~10 requests can be delivered. The rest tokens in the bucket decide the specific request numbers that can be forwarded in each minute.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2nSjJ5veXU2WVJqSN2Y9Cg.png" /></figure><p>You can treat the fixed-window algorithm as a particular case of the token bucket algorithm, in case the token bucket capacity equals the rate tickets can be added.</p><h3>Summary</h3><p>Rate limiting is vital in API Gateway. It protects the backend services to a certain extent. However, different rate-limiting algorithm has different effects. None is the silver bullet, so picking the most appropriate one is the best choice.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fabe179e7cb9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Eight habits prepared for you to be an efficient remote developer]]></title>
            <link>https://medium.com/@tokers/eight-habits-prepared-for-you-to-be-an-efficient-remote-developer-2b8ec9756848?source=rss-f574c62feabd------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b8ec9756848</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[collaboration]]></category>
            <category><![CDATA[habits]]></category>
            <category><![CDATA[remote-working]]></category>
            <dc:creator><![CDATA[Chao Zhang]]></dc:creator>
            <pubDate>Sun, 15 Jan 2023 08:33:44 GMT</pubDate>
            <atom:updated>2023-01-15T08:33:44.480Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IStpDnsPAvwPwjgN" /><figcaption>Photo by <a href="https://unsplash.com/@lucabravo?utm_source=medium&amp;utm_medium=referral">Luca Bravo</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Some developers may yearn to work remotely as they believe they will get more freedom, avoid the annoyance of commuting, and have flexible work time (do what they want to do at present) But the fact is, remote developers feel it’s more difficult to push things forward than when they work in the office. In terms of coding, it doesn’t affect whether you’re working remotely or not. While besides coding, several steps (e.g., proposal review, test cases review) need tight collaboration with your teammates. However, collaboration is inefficient when people don’t sit together.</p><p>Things were similar for me when I joined <a href="https://api7.ai/">API7.ai</a> as an engineer, a company that commits to providing API management services. People in this company work remotely and don’t see others often. I felt powerless in the early days. All the time, I try to make myself work efficiently, and now I have developed eight habits after two years of effort. I wrote them here and want to share them with you.</p><p>Please note all the habits I wrote here are related to collaboration. I described them from a developer’s point of view, but some are still appropriate even if you’re not a developer but still work remotely. Hopefully, they’re helpful.</p><h3>Use public channels</h3><p>When sending messages to your teammates, use the public channels (a Slack channel or a Lark group). Your other teammates won’t know the context if you send direct messages. You won’t like to send the same message over and over again. So please send them to a public channel and let all the stakeholders know about them. This is useful for maintaining <a href="https://en.wiktionary.org/wiki/information_symmetry#:~:text=Noun,same%20position%20to%20share%20information.">information symmetry</a>.</p><p>Please be careful about using the “@all” functionality, as it annoys other guys who are not interested in these messages. What’s more, for further talking about these messages, use a sub-channel (a thread in Slack or a topic in Lark) instead of sending them directly to the main channel.</p><h3>Host a meeting if necessary</h3><p>Communication via IM (instant messaging) tools are not reliable enough as it depends on the correctness of your expression. Sometimes peers may need more communication with you to understand your intent, and things will worsen if they don’t (you think they understand you, while actually, they don’t). Thus, when it’s tough to let others get your mean quickly, stop chatting on IM and host an online meeting. It will be more efficient.</p><p>Before you invite peers to a meeting, check their schedule and ask them politely: “Are you free for a ten-minute meeting right now? Let’s talk about this stuff.”. When attending a meeting, open your network camera as far as possible, let others see your face, and get your emotion.</p><h3>Use calendar</h3><p>Using a calendar to manage your schedule will make collaboration easier. Your teammates don’t have to consult you if you have free hours. Instead, they can check out your calendar and book your time quickly. Then you make a consensus once accepting the invitation or reject the schedule if you have other arrangements.</p><p>Work won’t be more accessible if only you or a few people in your organization use a calendar. It should become an organizational culture. If you agree with this way and want to change the collaboration habit in your company, try to book a one-one meeting with your direct leader, skip-level leader, or even a C-level.</p><p>People like me have more than one calendar (in fact, I have three: Google calendar, Apple calendar, and Lark calendar). Try to synchronize events on these calendars. Otherwise, you may suffer from schedule conflicts.</p><h3>Write proposals</h3><p>No matter whether you work remotely, writing proposals before you start to develop some features is a good habit. A good proposal tells people three significant parts (aka the <a href="https://www.smartinsights.com/digital-marketing-strategy/online-value-proposition/start-with-why-creating-a-value-proposition-with-the-golden-circle-model/">golden circle model</a>):</p><ul><li>Why: Why do we need this? Do we face some tricky problems right now? Once we implement it, what benefits can we get? We also call the “why” part our strategy.</li><li>How: How can we achieve the “why” part? It’s the tactics.</li><li>What: A couple of tasks that teams can do. It’s the execution of tactics.</li></ul><p>I won’t explain a lot about the golden circle model here. What I want to express is that a good proposal can reduce the chance of misunderstanding and promote a consistent goal, especially in remote working, as information is always inclined to be asymmetric. Thus a proposal is reasonably necessary for recording your thoughts and design.</p><p>It’s better to send the proposal to all stakeholders first (leave some time for them to read it), then book a meeting to discuss it, collect feedback, refine it, and finally pass the review (or reject it for some reasons).</p><p>Of course, a lousy proposal may make things worse, but don’t hesitate if you think you cannot write a good proposal. The more proposals you write, the better they are.</p><h3>Run your work in small steps</h3><p>As a developer, you will start to write codes after your proposal is accepted. While for a complicated feature, the workload will be significant. Let’s take the code review as an example. If you submit a PR (pull request) with massive changes, it’s not friendly for code review from your peers. Moreover, the quality of code reviews will be poor, as people are strict for 100+ lines of changes but will be loose for 1000+. Therefore, please always run your work in small steps, for this example, splitting your pull requests into a reasonable size.</p><p>On the other hand, running the work in small steps also helps to see the project’s progress and potential delay risks as it’s easy to assess the workload for a small job while difficult for a large one.</p><p>Usually, I will write technical proposals before coding, and I know all the sub-tasks from the proposal. These sub-tasks will be native steps for implementing the feature (sometimes, I will split them further if they’re not so small).</p><h3>Code Review before you get off work</h3><p>Code review is one of the most important collaborations between developers. Your teammates will request your review often. For urgent ones, you may have to stop things in your hands and review their changes immediately. For those not so emergent, you can focus on your business, but don’t forget to check them before you get off work. Your teammates’ jobs might be stuck if lacks the code review. This is not favorable for the team.</p><p>I clear my GitHub notifications at 5:00 pm every day. I’ll review all pull requests and leave comments, so my teammates can see them when they turn on their computers the following day.</p><h3>Write weekly report</h3><p>Your colleagues (or your boss) won’t know what you did in the past few days if they don’t collaborate with you closely, especially when you are in different time zones. Write a weekly report that can let them know what you did this week. Please remember writing reports is by no means of prevaricating your leader. Instead, it’s a way to build a transparent team culture and let others as the “reviewers” for checking if you’re off the right track toward the team’s goals.</p><p>You don’t have to write every detail you did this week. Instead, focus on the following parts:</p><ul><li>Achievement of goals. e.g., “The goal of implementing the multiple cluster management was 50% done.”</li><li>Difficulties you suffered this week. e.g., “I spent about 8 hours troubleshooting a weird bug, which causes me to delay my jobs a day.”</li><li>Plan for the next week. e.g., “Next week, I will focus on integrating our SaaS product with Stripe.”.</li></ul><p>It’s my understanding that the frequency of a report is not essential. You can write a daily report if you want. The key is what you and your team get from the report.</p><h3>Avoid cross-teams collaboration</h3><p>I have cross-team collaboration experience in API7.ai, and the feeling is terrible. Cross-team collaboration is inefficient and error-prone.</p><p>On the one hand, people in different teams have their own goals, things you think are important, maybe less in their mind. There is no guarantee they will spend enough time on your project. That’d make a nightmare for the project management. On the other hand, people in different teams have different backgrounds, skills, viewpoints, and methodologies. Letting them understand the project designs and reach an agreement is tough.</p><p>Unfortunately, cross-team collaboration cannot be eliminated thoroughly. If you have to work with people in different teams for a project. Synchronize the context in detail, spend much time on discussions, and ensure everyone involved in this project knows the goals. What’s more, be patient for answering questions.</p><h3>Summary</h3><p>Every coin has two sides. The same goes for working remotely. Nowadays, software development is a collaborative process. Working remotely causes certain obstacles. We need some thumb of rules to make us efficient. This article introduces eight habits for better collaboration when working remotely, which were concluded from my experience. I hope they can be helpful for you if you’re also working remotely. But always avoid copying directly. You may need to work around it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b8ec9756848" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>