<?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 Cem Akan on Medium]]></title>
        <description><![CDATA[Stories by Cem Akan on Medium]]></description>
        <link>https://medium.com/@cemakan?source=rss-a57043ed214a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qGG5ErOwl2EwtIlbX5dorQ.jpeg</url>
            <title>Stories by Cem Akan on Medium</title>
            <link>https://medium.com/@cemakan?source=rss-a57043ed214a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 11:55:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cemakan/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[Sahnede Fikrini Nasıl Satarsın?]]></title>
            <link>https://medium.com/@cemakan/sahnede-fikrini-nas%C4%B1l-satars%C4%B1n-4b1b9cf814ee?source=rss-a57043ed214a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b1b9cf814ee</guid>
            <category><![CDATA[sunum]]></category>
            <category><![CDATA[yarışma]]></category>
            <category><![CDATA[sahne-yönetimi]]></category>
            <category><![CDATA[ödül]]></category>
            <category><![CDATA[ar-projects]]></category>
            <dc:creator><![CDATA[Cem Akan]]></dc:creator>
            <pubDate>Sun, 20 Sep 2026 12:08:20 GMT</pubDate>
            <atom:updated>2026-09-20T15:23:17.731Z</atom:updated>
            <content:encoded><![CDATA[<h3>Harika Bir Proje Sahnede Neden Patlar?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e44n8-4Az4-8y_qiFPkdWg.png" /></figure><p>Kabul edelim, biz geliştiriciler ve tasarımcılar olarak işin mutfak kısmına aşığız. Günlerce ekrana bakıp o backend mimarisini kusursuz kurgulamak, UI/UX tasarımlarında piksel hesabı yapmak veya iş planını Excel’de ilmek ilmek işlemek bizim konfor alanımız.</p><p>Ama iş o ürünü alıp, projeden zerre anlamayan bir jüriye, melek yatırımcıya veya 200 kişilik bir salona anlatmaya geldiğinde birçoğumuzun eli ayağına dolaşıyor.</p><p>Piyasadaki en acı gerçek şudur: <strong>Fikriniz veya yazdığınız kod ne kadar efsanevi olursa olsun, onu sahnede doğru kitleye, doğru şekilde satamadığınız sürece o bilgisayarın içinde çürümeye mahkumdur.</strong> Harika projeler, berbat sunumların kurbanı olur.</p><p>Bu yazıda size kitaplardan fırlama, derin nefes alın ve gülümseyin, tarzı içi boş kişisel gelişim tavsiyeleri vermeyeceğim. Bilgisayar mühendisliği öğrencisi olarak, sadece bir otobüs camında gördüğüm afişle yola çıkıp; Adana’da yerel basının, belediye başkanlarının ve dev bir jürinin karşısında projemi nasıl sattığımı ve 20.000 TL’lik ödülü nasıl kazandığımı detaylarıyla anlatacağım.</p><p>Gelin, projenizin sahnede çöp olmasını nasıl engellersiniz, slaytları nasıl bir avantaja çevirirsiniz ve o sahne stresini nasıl yönetirsinize adım adım bakalım.</p><h3>1. Sorunu Kanatın ( iyi anlamda :) )</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DLej4hXiePyFMY9hHO2R3A.png" /></figure><p>Sahnede çuvallamanın ilk sebebi, sahneye çıkmadan önceki kafa yapısıdır. Teknik geçmişten gelen biri sunum hazırlarken sürekli ürünün <em>özelliklerini </em>anlatmaya meillidir. Bunu React ile yazdık, backend’de şu yapıyı kullandık, saniyede şu kadar veri işliyor…</p><p>Durun. Jürinin veya yatırımcının umrunda olan ilk şey bu değil. İnsanlar <strong>bu ürün benim hangi yaramı sarıyor?</strong>, sorusunun cevabını arar. Fikrinizi sunarken önce problemi kanatmanız, sonra merhemi sürmeniz gerekir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FBo__Zt0MdKL2s-blS6LKg.jpeg" /></figure><h4><strong>Vaka Analizi: Adana Geçmişten Geleceğe AR Projesi</strong></h4><p>Sıradan bir günde Adana Turizm Birliği’nin Fikir ve Proje Yarışması, afişini gördüm. Projem basitti: <em>Adana Geçmişten Geleceğe Artırılmış Gerçeklik (AR).</em></p><p>Sahneye çıkıp jüriye sadece, tarihi eserleri AR ile gösterelim, uygulaması da çok kolay, deseydim muhtemelen elenirdim. Bunun yerine sorunu onların yüzüne vurdum: <em>tarihi mekanlarımız zamanla tahribata uğruyor, diktiğiniz o demir bilgilendirme tabelaları inanılmaz sıkıcı ve en kötüsü, yeni neslin bu mekanlara zerre ilgisi yok.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P5eKFBh3zCNALigepaRR6w.jpeg" /></figure><p>Çözüm belliydi: Gençlerin dilinden anlayan, onlara interaktif bir oyunlaştırma sunan mobil bir AR deneyimi. Sahnede sadece uygulamanın nasıl çalışacağını değil; mali sürdürülebilirliğini, premium içerik satışlarını, yerel esnafla entegre sponsorlukları ve basılı broşürleri yok ederek karbon ayak izini nasıl düşüreceğimizi anlattım. Projenin altı tamamen doluydu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bHLpXotrASPOnMwSYO5xSA.jpeg" /></figure><h3>2. Paragraf Döşeme (lütfen)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZMtU2B1gVGh5MoAtJxcs0A.png" /></figure><p>Sektörde gördüğüm en büyük sunum cinayeti: Söyleyecekleri her cümleyi, anlatacakları her detayı slayta yazmak.</p><p>İnsan beyni aynı anda hem karmaşık bir metni okuyup hem de konuşan birini dinleyemez. Ekrana madde madde paragraflar dayarsanız, dinleyici sizi dinlemeyi bırakır ve okumaya başlar. O saniyeden sonra sizin sesiniz, arkada çalan rahatsız edici bir radyo frekansından farksızdır. Ekranda yazanı okuyacaksanız, bizi o salona toplamayın, bir PDF atın okuyalım.</p><h4><strong>Gerçek Bir Pitch Deck Nasıl Olmalı?</strong></h4><ul><li><strong>Metinleri Yok Edin:</strong> Ekranda cümleler değil, sadece anahtar kelimeler veya tek bir dev istatistik olmalı.</li><li><strong>Mock-up Gücü:</strong> İnsanlar sonucu hayal edemez, görmek isterler. Uygulamanızın bitmiş halinin veya mimarinin temiz bir görselini koyun.</li><li><strong>Veriyi Estetikleştirin:</strong> Benim projemin finansal sürdürülebilirliği için tam 5.490.000 TL’lik çok detaylı bir bütçe tablosu hazırlamıştım. Ama bunu ekrana iğrenç bir Excel tablosu olarak yansıtmadım.</li></ul><p>Seyirci sahnede yorulmamalı. Minimal, temiz ve odaklanmış bir tasarım kullanmalısınız.</p><h3>3. Titreyen Ses Sendromu</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sZXcVjDGJcoUPjezNzNStA.jpeg" /></figure><p>Her şeyi hazırladınız. İsminiz anons edildi. İçeride yerel basın, kameralar, kravatlı yetkililer ve size bakan abartısız 200 çift göz var. O anonsla kürsüye yürürken kalbinizin atışını kulaklarınızda duyarsınız, avuç içleriniz terler. O adrenali yönetemezseniz proje sahnede erir.</p><p>İşte o an sahneyi domine etmenin 3 kuralı:</p><ul><li><strong>İlk 10 Saniye Kuralı:</strong> Sahneye çıkar çıkmaz paldır küldür konuşmaya başlamak amatörlüktür. Panik halidir. Kürsüye geçin (arkasına saklanmayın), derin bir nefes alın ve 3–4 saniye boyunca salonu sessizce süzün. O sessizlik, uğultuyu keser ve dikkatleri mıknatıs gibi size çeker. <em>Kontrol bende,</em> mesajını böyle verirsiniz.</li><li><strong>Göz Teması (Z-Kuralı):</strong> Konuşurken boşluğa veya en öndeki jürinin kel kafasına bakmayın. Salonu 3&#39;e bölün. Sol ön, sağ arka ve orta. Buralarda size kafa sallayarak onay veren 3 dost yüz bulun. Bir cümleyi sağdaki adamın gözüne bakarak bitirin, diğerine soldakine bakarak başlayın. 200 kişi de sadece benimle konuşuyor hissine kapılır.</li><li><strong>Özellik Değil, Vizyon Satın:</strong> <em>Uygulamamız iOS ve Android uyumlu çalışmaktadır</em>, cümlesi leş gibi sıkıcıdır. Onun yerine sesinizi yükselterek şunu deyin: <em>Adana’ya gelen bir lise öğrencisi telefonunu Büyüksaat’e tuttuğunda; geçmişte o sokakta yürüyen insanları, o tarihi dokuyu anında kendi ekranında canlı canlı yaşayacak</em></li></ul><p>Heyecanınızı onlara bulaştırın :)</p><h3>4. Aslında Yapabiliyormuşuz</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RBc7fCF687tbusbOWymlGA.jpeg" /></figure><p>Süreci bu şekilde kurguladığınızda, geriye sadece o tatlı sonuçları toplamak kalır. İyi bir sunum, orta halli bir projenin bile değerini 10 ile çarpar.</p><p>Adana Turizm Birliği Müdürü ve Büyükşehir Belediyesi Daire Başkanı’nın konuşmalarının ardından sonuçlar açıklanmaya başlandı. Adım okundu: <strong>İkincilik ödülü, Cem Akan.</strong></p><p>Seyhan Belediye Başkan Yardımcısı Sayın İnci Makal’ın elinden 20.000 TL’lik ödül çekini alırken hissettiğim şey sadece maddi bir tatmin değildi. Sadece bir otobüs camında gördüğüm afişle başlayan fikir; ertesi gün Adana Toros Gazetesi, Referans Türk ve İlk Haber gibi gazetelerin manşetlerindeydi. Fikrimi o bilgisayarın içinden çıkarmış ve gerçek dünyaya satabilmiştim.</p><h3>Sonuç Olarak: Konfor Alanınızdan Çıkın ❤</h3><p>Teknolojiye, yazılıma, tasarıma ilgi duyan meslektaşlarıma tavsiyemdir:</p><p>Sürekli “arka planda” kalmak güvenli hissettirir. Karanlık temada sabahlara kadar kod yazmak bizim konfor alanımız. Ancak o alandan çıkıp projenizi doğru bir paketle sunmayı öğrenmediğiniz sürece, insanların gözünün içine bakarak o hikayeyi tutkuyla anlatmadığınız sürece fikirleriniz hiçbir zaman hak ettiği değeri görmeyecek.</p><p>Kendinize ve fikrinize güvenin. O sahneye çıkın, o mikrofonu elinize alın ve projenizi savunun. Çünkü sizin günlerce uykusuz kalarak yarattığınız hikayeyi, kimse sizin kadar iyi anlatamaz.</p><p>Başarılar ❤</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/0*BtjVL5AZm4vXTSIj.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b1b9cf814ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tayvan Huayu Bursu (HES) Rehberi: Ankara’daki Mülakat Masasından Tainan’ın Sokaklarına]]></title>
            <link>https://medium.com/@cemakan/tayvan-huayu-bursu-hes-rehberi-ankaradaki-m%C3%BClakat-masas%C4%B1ndan-tainan-%C4%B1n-sokaklar%C4%B1na-e52e8b5d3a5f?source=rss-a57043ed214a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e52e8b5d3a5f</guid>
            <category><![CDATA[tayvan]]></category>
            <category><![CDATA[mandarin]]></category>
            <category><![CDATA[yurtdışı-eğitim]]></category>
            <category><![CDATA[taiwan]]></category>
            <category><![CDATA[yu-hua]]></category>
            <dc:creator><![CDATA[Cem Akan]]></dc:creator>
            <pubDate>Fri, 14 Aug 2026 14:52:05 GMT</pubDate>
            <atom:updated>2026-10-11T06:55:51.216Z</atom:updated>
            <content:encoded><![CDATA[<h3>Tayvan Huayu Bursu (HES) Rehberi</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sidGiB56L49aQtWdQ2tHdA.jpeg" /></figure><p>Eğer bu satırları okuyorsan, muhtemelen sen de Tayvan’da dil öğrenme hayalleri kuran, geceleri rüyasında Çince karakterler gören ya da o Ankara’dan gelecek resmi e-postayı beklerken stresten tırnaklarını yiyen birisin. İnternette Tayvan bursları hakkında bir sürü standart, resmi bilgi var. Hangi evraklar lazım, form nereye yollanacak… Bunları zaten <a href="https://www.roc-taiwan.org/tr_tr/index.html">Taipei Ekonomi ve Kültür Misyonu’nun resmi sitesinde</a> bulabilirsin.</p><p>Ama kimse sana mülakat odasındaki o gergin havayı, komiteye yapacağın ufak bir şakanın o havayı nasıl yumuşatacağını, sağlık raporundaki yorucu bürokratik engelleri ya da Eğitim Bakanlığı’nın arka planda işleyen bütçe mantığını anlatmaz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*TjdT-g6Ta0mQQUsjb8u57A.gif" /></figure><p>Ben Cem. Tarihin en yoğun başvuru senelerinden birinde, o bekleme salonundaki onlarca rakibi geride bırakıp Asil Listede 2. Sıraya yerleştim. Bu yazı; benim mülakat masasından, Tayvan’ın teknoloji devlerinden biri olan NCKU’ya (National Cheng Kung University) uzanan filtresiz ve tamamen gerçek hikayem. Süreci nasıl yönettiğimi, hangi detaylara dikkat ettiğimi en ince ayrıntısına kadar anlatıyorum.</p><p>O zamannn çayını , kahveni kap, başlıyoruz.</p><h3>1. Evrak Dağı ve Niyet Mektubu:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EKZGVCN97S6C6lBcBGEfbg.jpeg" /></figure><p>Her şey bahar aylarında o başvuru formunun açılmasıyla başlıyor. Senden pasaport fotokopisi, güncel İngilizce öğrenci belgesi, İngilizce transkript ve hocalardan alınmış 2 tane akademik referans mektubu istiyorlar. Bunlar işin standart ama yorucu evrak kısmı.</p><p>Asıl olay <strong>Niyet Mektubu (Statement of Purpose)</strong>.</p><p>Bakın, niyet mektubuna “Ben oranın kültürünü çok seviyorum, tapınakları gezip boba tea içeceğim” yazarsanız anında elenirsiniz. Devlet size turistik bir Asya turu yapın diye ayda 28.000 NTD (Tayvan Doları) bağlamıyor. Oraya teknik, rasyonel ve sağlam bir vizyon koymanız şart.</p><p>Ben ne mi yazdım? Bir yazılımcı olarak; Golang mimarilerinden, gRPC sunucularından ve geliştirdiğim projelerimden bahsettim. Tayvan’ın bir donanım/yazılım adası olduğunu, benim bu vizyonumun Tayvan’ın çip ve teknoloji ekosistemiyle nasıl entegre olacağını kanıtladım. “Ben sadece dil öğrenmeye değil, Tayvan’ın teknoloji sektörüne entegre olmaya geliyorum” mesajını verdim.</p><h4>Hayat Kurtaran Taktik: Erken Kabul Mektubu</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gx0Elh1LNGgfSyhQhQ8l-A.jpeg" /></figure><p>Çoğu adayın yaptığı inanılmaz bir strateji hatası vardır: <em>“Hele bir burs çıksın, Tayvan’daki okula sonra başvururuz.”</em> <strong>Sakın yapmayın.</strong> Ben mülakata gitmeden aylar önce (9 Mart’ta) Tayvan’daki NCKU Dil Merkezi’nin online portalına girdim. Pasaportumu, okulumdan aldığım İngilizce öğrenci belgemi ve hesabımda eğitimimi karşılayacak kadar bakiye olduğunu gösteren banka referans mektubunu sisteme yükledim. Okula <em>“Ben devlet bursu sonucumu bekliyorum, kayıt ücretini şimdilik bekletir misiniz?”</em> diyerek başvurumu yaptım ve resmi <strong>Kabul Mektubumu (Admission Letter)</strong> mülakattan çok önce almıştım. <em>Mülakat esnasında komiteye hedeflerinizi anlatırken “Ben dil okulu başvurumu çoktan yaptım ve NCKU’dan kabul mektubumu bile aldım” diyerek bu durumdan bahsetmeniz ve belgenizi sunmanız, diplomatların gözünde sizin bu işi ne kadar ciddiye aldığınızı kanıtlar ve diğer adayların anında önüne geçmenizi sağlar.</em></p><h3>2. Ankara Mülakatı</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*slqlOiUiJQNMhk2GgkX41w.jpeg" /></figure><p>Nisan ayında Ankara Reşit Galip Caddesi’ndeki büyükelçilik binasına gittiğinizde, bekleme salonunda çok iyi hazırlanmış, Çince (Sinoloji) okuyan, aylardır HSK çalışan rakipler göreceksiniz. Hiç panik yapmayın. Odaya girdiğinizde olayı lehinize çevirecek detaylar şunlar:</p><ul><li><strong>Buzu Kırmak:</strong> İçeri girip robot gibi gergin bir şekilde beklemek yerine, ben komiteye samimi bir baklava ikramı yaptım ve saate bakıp “İyi günlerr” diyerek odaya girdim. Sizin o anki stresi yönetebilen, iletişime açık bir mühendis olduğunuzu görmeleri lazım.</li><li><strong>Kültür Şoku Sorusu:</strong> Size kesinlikle <em>“Farklı bir coğrafyaya, yalnız başına gidiyorsun, orada zorlanmayacak mısın?”</em> diyecekler. Varsa yurtdışı tecrübenizi hemen anlatın. Ben Budapeşte’deki (BME) Erasmus tecrübemi örnek gösterdim. <em>“Mobile Communication Networks dersimin kredi transferlerindeki uyuşmazlıkları, evrak işlerini bile kendim koşturarak çözdüm, Tayvan’da da bürokratik adaptasyon sorunu yaşamam”</em> diyerek o kapıyı anında kapattım.</li><li><strong>Neden O Şehir? Sorusu:</strong> Tainan gibi güneyde, nemi ve sıcağı meşhur bir şehri seçtiğim için bana “Oranın ikliminde zorlanmaz mısın?” diye sordular. Orada harika bir lokal bağ kurdum: <em>“Ben Adanalıyım, o iklime native (yerli) olarak ayarlıyım.”</em> Odadaki hava bir anda inanılmaz samimi bir hale döndü.</li></ul><h3>3. İşin Resmiyet Kazandığı An: Sertifika Töreni ve Oryantasyon</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Ye3UjZDft5AnvAR1kYizw.jpeg" /></figure><p>Mülakatı geçip asil listede yerinizi aldıktan sonra iş sadece maille bitmiyor. Temmuz ayında Ankara’daki Taipei Ekonomi ve Kültür Misyonu’nda (TECO) düzenlenen resmi Tayvan Bursları Sertifika Töreni ve Oryantasyonuna davet ediliyorsunuz.</p><p>Büyükelçi Volkan Chih-Yang Huang’ın elinden o sertifikayı almak, benim için çok güzel bir anıydı. Ayrıca bu törende Tzu-ching KAO tarafından Tayvan’da yaşama dair çok değerli bir oryantasyon sunumu yapılıyor ve diğer bursiyerlerle tanışma fırsatı buluyorsunuz. Elinizdeki belgeleri teslim edip vize başvurunuzu da o gün aradan çıkarabiliyorsunuz.</p><h3>4. Sürelerin Belirlenmesi:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sxAfXEmwDIjlkkTIsvF50A.jpeg" /></figure><p>Mayıs ayında sonuç maili geldiğinde asil listede 2. sıradaydım. Ancak listelerde genel bir değişiklik vardı. Önceki yıllarda 12 ay (tam yıl) burs alanlar varken, bu sene asil listedeki zirve de dahil olmak üzere en yüksek süre 9 aydı.</p><p>Başta “Hakkım mı yendi?” diye isyan edebilirsiniz. Ama işin arka planındaki Eğitim Bakanlığı (MOE) bütçe planlamasını anlayınca her şey mantığa oturuyor. Bu sene tarihin en yüksek başvuru yığılması olmuştu. Devlet, üniversitelerin ders olmadığı o 3 aylık yaz tatili dönemini fondan çıkarıp, süreyi tam bir akademik yıl olan 9 aya (Güz + Bahar dönemi) çekti. Böylece 10 kişi yerine 15 kaliteli gence Tayvan kapılarını açtılar. Yani 9 ay aldıysanız hiç canınızı sıkmayın; bu, devletin daha çok yeteneğe şans vermek için belirlediği o yılki maksimum limittir.</p><h3>5. Hangi Şehir, Hangi Üniversite?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-mCZviC_L4epZPF4OCmwUg.png" /></figure><p>Tayvan’ı ve okulları şu özetle netleştirelim ki kafanızda soru işareti kalmasın:</p><ul><li><strong>Taipei:</strong> Ülkenin başkenti, en kalabalık ve en pahalı şehri. Genelde sosyal bilimciler ve Sinoloji okuyanların ilk tercihidir.</li><li><strong>Tainan:</strong> Tayvan’ın eski başkenti, çip ve donanım devlerinin üretim üslerinin bulunduğu harika bir mühendislik ve teknoloji şehridir. İklimi Taipei’ye göre çok daha sıcaktır.</li></ul><p>Benim gibi yazılımcıysanız, Tainan ve NCKU sizin akademik ve profesyonel kariyeriniz için Tayvan’daki en büyük kalkış rampasıdır.</p><h3>6. Belgeler, Kargolar ve Kabul Belgesi Teslimi</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sWn8KZ03c824tcEXNpW_0A.jpeg" /></figure><p>Tebrik mailini aldınız. Duyuruda sizden istenen çok net bir eylem var: Haziran bitmeden önce okuldan aldığınız Kabul Mektubunu yetkililere yollamak ve ardından vize ve sağlık raporu maratonuna başlamak.</p><h4>Bu süreç oldukça yorucu olabilir, adım adım inceleyelim:</h4><h4><strong>1- Vize Belgeleri ve Akıl Almaz Sağlık Raporu Tasdik Zinciri:</strong></h4><p>Tayvan vizesi almak sıradan bir Schengen vizesi almaya benzemez. Elçilik sizden standart belgelerin (en az 6 ay geçerli pasaport, 2 adet normal vesikalık fotoğraf, NCKU kabul mektubu, pasaport fotokopisi) yanı sıra hesabınızda en az <strong>2.000 ABD Doları</strong> olduğunu gösteren bir banka dökümü ister.</p><h4><strong>İşin Asıl Çetrefilli Kısmı: Sağlık Raporu</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wo0GqxswO0NcTPwlnUeREw.jpeg" /></figure><p>Tayvan’da 6 aydan fazla kalacağınız için elçilik size bir sağlık formu linki gönderecek. Bu forma işaretleme yapmayın sizden sadece<strong> A, C ve D testlerini (Frengi, Kızamıkçık, Akciğer Röntgeni vb.)</strong> yaptırmanız istenecek.</p><ul><li><strong>Hayat (ve Para) Kurtaran İpucu:</strong> Hastaneye gittiğinizde A, C ve D testlerinin sonuçlarını 3 ayrı rapor/kağıt olarak değil, doktorunuzdan rica edip <strong>tek bir birleştirilmiş rapor</strong> halinde almaya çalışın. Eğer 3 ayrı kağıt alırsanız, bir sonraki adımdaki yeminli tercümana ve notere 3 kez ayrı ayrı dudak uçuklatan ücretler ödemek zorunda kalırsınız. Tek rapor demek, tek sayfa çeviri ve tek noter ücreti demektir.</li></ul><h4><strong>Tasdik Zinciri ve Her Sene Değişen Kurallar:</strong></h4><p>Hastaneden o raporu alıp çıkmakla iş bitmiyor :(( Bu belgenin Tayvan makamlarınca kabul edilmesi ve vizenizin onaylanması için aşağıdaki tasdik zincirinden geçmesi gerekiyor:</p><ol><li>Alınan raporlar önce Yeminli Tercümana İngilizceye çevrilecek.</li><li>Ardından Noter’e onaylatılacak.</li><li>Sonra Çankaya Kaymakamlığında tasdik edilecek. (<strong>Kritik Uyarı:</strong> Kesinlikle “Apostil” yapılmayacak. Sadece normal tasdik edilecek. Tayvan apostil kabul etmiyor.)</li><li>En son Türk Dışişleri Bakanlığı Tasdik Birimine götürülüp nihai onay alınacak.</li></ol><ul><li><strong><em>Dışişleri Bakanlığı İçin Hayati İpucu:</em></strong><em> Buraya kesinlikle randevusuz gitmeyin, içerisi inanılmaz kalabalık oluyor. Gitmeden önce mutlaka </em><a href="https://tasdik.mfa.gov.tr/"><em>tasdik.mfa.gov.tr</em></a><em> adresinden randevunuzu alın. İçeride belge başına bir tasdik ücreti alınıyor (örneğin 2026 yılı için belge başı 895 küsur TL’ydi ve bu rakam her yıl değişiyor). </em><strong><em>İşin en can alıcı kısmı şu:</em></strong><em> Ödemeler SADECE NAKİT kabul ediliyor ve binanın çevresinde para çekebileceğiniz bir ATM yok. Veznede kalakalmamak için oraya gitmeden önce yanınızda mutlaka yeterli nakit parayı hazır edin.</em></li></ul><p><strong>Altın Değerinde Bir Uyarı:</strong> Yukarıda saydığım bu zincir, elçiliğin genel prosedürüdür. Ancak elçilik kuralları ve sıralamayı her an değiştirebilir. Örneğin benim senemde prosedüre aniden <strong>İl Sağlık Müdürlüğü Mührü </strong>eklendi. Çoğu kişi eski yazılara güvenip elçiliğin attığı e-postayı dikkatli okumadığı için bu adımı atladı. Sonuç? Onlarca kişinin sağlık belgesi geç kaldı, vizeleri gecikti ve büyük bir stres yaşandı. Bu yüzden, elçiliğin size attığı o yılki güncel bilgilendirme e-postasını adeta bir kutsal metin gibi kelimesi kelimesine takip edin. Asla eski ezberlerle hareket etmeyin.</p><p><strong><em>Unutmayın, bu sağlık raporu keyfi bir evrak değil, doğrudan VİZE alabilmeniz için şarttır. Bu raporu elçiliğe teslim etmeden vizeniz onaylanmaz. Vizeniz onaylanmadan da uçak bileti almanın hiçbir mantığı yoktur. Önce rapor, sonra vize, en son bilet.</em></strong></p><h4>2- Vize Sürecindeki İki Büyük Yanılgı:</h4><ul><li><strong>E-Vize Yasağı:</strong> Sakın ola “Ben vizeyle uğraşmayayım, internetten E-Vize alıp gireyim” demeyin. Eğitim Bakanlığı kurallarına göre bursiyerlerin Tayvan’a Vizesiz Geçiş, E-Vize veya Kapı Vizesi ile girmeleri KESİNLİKLE yasaktır. Yaparsanız bursunuz anında iptal olur.</li><li><strong>Single Entry (Tek Girişli) Vize Paniği:</strong> Büyükelçilikten “Resident Visa (Oturum Vizesi)” aldığınızda üzerinde “Single” (Tek Girişli) yazdığını göreceksiniz. “Eyvah ben Tayvan’dan hiç çıkamayacak mıyım?” diye korkmayın. Tayvan yasalarına göre ilk defa Oturum Vizesi alanlara vize zorunlu olarak “Single” basılır. Ülkeye girip göçmenlik ofisinden ARC (Oturum Kimliği) kartınızı aldığınız saniye, o kimlik sizin “Çok Girişli (Multiple)” vizeniz haline gelir ve özgürce ülkeye gir-çık yapabilirsiniz.</li><li><strong>Ancak unutmayın: </strong>Tayvan’a ayak bastığınız günden itibaren ilk 30 gün içinde Göçmenlik Ofisi’nin (NIA) sisteminden online olarak ARC (Oturum) başvurunuzu yapmak zorundasınız. Bu süreyi kaçırırsanız yasal olarak sıkıntı yaşarsınız.</li></ul><h4><strong>3- Uçak Bileti Tüyosu (Malezya Aktarması):</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yc18f3hfndWG3OoyiaptRw.jpeg" /></figure><p>Vizenizi cebinize koydunuz ve sıra bilete geldi. Bilet bakarken ilk işiniz <strong>Google Flights</strong> üzerinden rotanızı belirleyip fiyat alarmlarını kurmak olsun. Ancak bazı Körfez havayollarının astronomik fiyatlı rotalarına boşuna devasa paralar dökmeyin. Cebinizi yormayacak en mantıklı fiyat/performans rotası, Malezya (Kuala Lumpur) üzerinden aktarmalı uçmaktır. Hatta hazır o kadar yol gitmişken, aktarma sürenizi bilerek birkaç gün uzun tutup Tayvan öncesi vizesiz Malezya’da harika bir mini tatil bile yapabilirsiniz.</p><p><strong>İşin asıl can alıcı (<em>sizi valiz eziyetinden kurtaracak</em>) noktası ise şu:</strong> Herkes Tayvan denilince otomatik olarak başkent Taipei’ye (Taoyuan Havalimanı) bilet alır. Eğer benim gibi Tainan’da (NCKU) okuyacaksanız, Taipei’ye inmek yapacağınız en büyük hata olur. Taipei adanın en kuzeyinde, Tainan ise güneyindedir. Uzun bir uçuştan sonra o ağır valizlerle Taipei’den Hızlı Trene (HSR) aktarma yapıp güneye inmeye çalışmak hem ciddi bir ekstra masraf hem de büyük bir eziyettir.</p><p>Bunun yerine, Kuala Lumpur’dan Taipei’ye değil, Tainan’ın hemen dibindeki <strong>Kaohsiung (KHH)</strong> havalimanına bilet alın. Kaohsiung’a indiğinizde yerel bir trenle sadece 40 dakika içinde, hiç yorulmadan Tainan’ın merkezinde, okulunuzun kampüsünde olacaksınız. Cüzdanınız bu tavsiye için size teşekkür edecek :)</p><h3>7. Sigorta, Maaş ve Katı Kurallar</h3><p>Oraya gittiniz, her şey harika. Ancak Tayvan devleti parayı verirken karşılığında inanılmaz sıkı bir disiplin bekliyor. Bilmeniz gereken hayat kurtarıcı gerçekler şunlar:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oPmn7Cjwuz9eiYCRCoR_oA.jpeg" /></figure><h4>Kimsenin Söylemediği Sağlık Sigortası ve “92 Gün” Tuzağı:</h4><p>Tayvan’a gittiğiniz ilk 6 ay boyunca Tayvan’ın meşhur Ulusal Sağlık Sigortasına (NHI) kayıt olamazsınız. Bu sürede kendi başınızasınız ve Türkiye’den özel seyahat sağlık sigortası yaptırıp gitmeniz zorunludur. İnternetten en ucuz “1 Yıllık Yurt Dışı Seyahat Sigortası”nı alıp geçmeyin. Çünkü o standart turistik poliçelerin içine gizlenmiş bir <strong>“92 Gün Sınırı”</strong> vardır. Yani 93. gün Tayvan’da hastaneye giderseniz sigortanız bir kuruş bile ödemez.</p><p><strong><em>Çözüm</em></strong><em>:</em> Sigorta şirketlerinden <strong>“Yurt Dışı Eğitim / Öğrenci Seyahat Sağlık Sigortası”</strong> isteyeceksiniz. Sadece öğrenci paketlerinde bu 92 gün sınırı yoktur ve 7 ay boyunca kesintisiz teminat sağlarlar.</p><ul><li><strong>Ayrıca çok kritik bir detay:</strong> Tayvan’da devlet sigortasına (NHI) geçebilmeniz için gereken o 6 aylık bekleme süresinde, Tayvan dışına yapacağınız seyahatlerin tek seferde 30 günü <strong>AŞMAMASI</strong> gerekir. Aşarsa 6 aylık sayacınız sıfırlanır ve sigorta hakkınız yanar.</li></ul><h4>Maaşlar Bankaya Değil, Postaneye Yatıyor</h4><p>Tayvan’a gittiğinizde devlet size bursu normal bir banka hesabına değil, Postane (Post Office) hesabına yatırır. Okulun ilk haftası göçmenlik bürosundan UI (Kimlik) numaranızı alıp, 100 NTD ile postaneye giderek o yeşil hesap cüzdanını çıkartmanız gerekecek. <em>Kritik Uyarı:</em> Sisteme kayıt, hesap açılışı ve evrak işleri derken ilk bursunuzun hesabınıza yatması 1 ile 1.5 ayı bulabilir. Bu yüzden Tayvan’a giderken yanınızda sizi en az 1.5 ay rahat ettirecek kadar nakit parayla gitmeyi sakın unutmayın.</p><h4>Bursunuzu Yaktıracak 3 Ölümcül Hata</h4><ol><li><strong>12 Saat Kuralı:</strong> Bir takvim ayında toplam 12 saat (seçmeli ve ana dersler dahil) devamsızlık yaparsanız, o ayki 28.000 NTD bursunuz anında kesilir. Hasta olursanız kuru kuruya izin yetmez, mutlaka resmi bir “Medical Certificate” (Sağlık Raporu) almak zorundasınız.</li><li><strong>80 Barajı:</strong> Çeyrek dönem sonu notunuz 80&#39;in altında kalırsa, bir sonraki ay bursunuz dondurulur. Üst üste iki dönem 80 altında kalırsanız bursunuz tamamen iptal edilir.</li><li><strong>TOCFL (Çince Yeterlilik) Sınavı:</strong> Eğer 9 aylık uzun dönem bursiyeriyseniz, burs süreniz bitmeden en geç 1 ay önce resmi TOCFL sınavına girmek ve sonuç belgesini ofise teslim etmek zorundasınız.</li></ol><h3>8. Yüksek Lisans, Tam Zamanlı Kariyer ve Master</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xb-QS8qH2cwTPvAmWG1_bA.jpeg" /></figure><p>Birçok kişi Tayvan’a o 9 aylık dil okuluna gidip sonra Türkiye’ye döneceğini sanır. Benim gibi bir planı olanlar içinse dil okulu sadece birinci fazdır.</p><p>Öncelikle bilmeniz gereken en kritik yasal gerçek şu: HES bursu ile dil okulu vizesindeyken yasal part-time çalışma izniniz KESİNLİKLE YOKTUR. O 9 ay boyunca sadece devletin verdiği 28.000 NTD ile yaşarsınız. Ama asıl hikaye, dil kursunuzun ortalarında başlar. Hedef, Tayvan’da kalıcı olmak, Master yapmak ve mühendis olarak çalışmak.</p><ul><li><strong>İçeriden Başvuru Gücü:</strong> Dil kursunuz devam ederken, Tayvan Bursu’na (Yüksek lisans için olan MOE Taiwan Scholarship) veya doğrudan üniversitenin kendi uluslararası burslarına başvuracaksınız. Türkiye’deki rakipleriniz bu mülakatlara Ankara’dan online girmeye çalışırken, siz o mülakata NCKU’nun kendi kütüphanesinden bağlanacaksınız. Hatta mülakattan önce çalışmak istediğiniz hocalarla laboratuvarlarında bizzat yüz yüze görüşmüş olacaksınız. O kabulü içeriden çok daha rahat alacaksınız.</li><li><strong>Küçük Bir İpucu: IELTS/TOEFL Masrafından Kurtulmak:</strong> Master programları sizden sıkı bir İngilizce yeterliliği bekler. Eğer lisans okuduğunuz bölüm %100 İngilizce ise, binlerce lira verip IELTS veya TOEFL almanıza gerek yok. Okulunuzun öğrenci işlerinden alacağınız, üzerinde <em>“Bu öğrencinin programı %100 İngilizce olarak işlenmektedir”</em> yazan ıslak imzalı ve mühürlü tek bir A4 kağıdı, komite ve çoğu üniversite tarafından resmi dil belgesi olarak kabul ediliyor.</li><li><strong>Yüksek Lisans ve Yasal Çalışma İzni:</strong> NCKU’da yüksek lisansa (Master) başladığınız an işin rengi değişir. Öğrenci statünüz güncellenir ve haftada 20 saatlik yasal çalışma izni (Work Permit) hakkı kazanırsınız. Bu sayede profesörlerin laboratuvarlarında asistanlık yaparak harika ek bütçeler kazanabilirsiniz.</li><li><strong>Yeni Yasa (Taiwan Talent Act) ve Tam Zamanlı Kariyer:</strong> Tayvan devletinin yürürlüğe soktuğu yeni yetenek yasasına göre işler artık çok daha kolay. Eskiden bir yabancının Tayvan’da tam zamanlı bir mühendis olarak çalışma izni alabilmesi için “kendi ülkesinde en az 2 yıl mesleki tecrübeye sahip olması” gibi çok katı bir şart vardı. Ancak NCKU gibi bir Tayvan üniversitesinden Master derecesi aldığınız an, bu 2 yıllık tecrübe şartı tamamen ortadan kalkıyor. Mezun olduğunuz gün diplomanızla doğrudan TSMC, MediaTek, ASUS veya diğer donanım devlerinde tam zamanlı profesyonel çalışma izninizi anında alabiliyorsunuz.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_h7XHrjVXGk9nxr_DNkRWg.png" /></figure><p>Tayvan HES bursu, sadece Mandarin karakterler yazdığınız bir gezi programı değildir. Eğer sistemi doğru okursanız; donanım, yazılım ve teknoloji dünyasının merkez üssüne sağlam bir adım atmak ve orada devasa bir kariyere başlamak için devletin size sunduğu kusursuz bir Bootcamp sürecidir.</p><p>Eğer siz de mülakat odasında hedefinizi net anlattıysanız, o akademik yılı bütçeden garantilediyseniz ve süreci zekice yönettiyseniz; valizinizi hazırlamanın vakti geldi demektir.</p><p>Adada görüşmek üzere ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e52e8b5d3a5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a Chaos Engineering Engine That Goes Where No Tool Has Gone Before]]></title>
            <link>https://medium.com/@cemakan/i-built-a-chaos-engineering-engine-that-goes-where-no-tool-has-gone-before-65d88fb141f3?source=rss-a57043ed214a------2</link>
            <guid isPermaLink="false">https://medium.com/p/65d88fb141f3</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[chaos-engineering]]></category>
            <category><![CDATA[aiops]]></category>
            <dc:creator><![CDATA[Cem Akan]]></dc:creator>
            <pubDate>Thu, 28 May 2026 23:42:52 GMT</pubDate>
            <atom:updated>2026-06-06T12:49:52.378Z</atom:updated>
            <content:encoded><![CDATA[<h2>I Built a Chaos Engine That Goes Where No Tool Has Gone Before</h2><p><strong>No team. No budget. Just Go. This is the engineering deep dive behind pastaay, a chaos engine that breaks everything from HTTP headers to physical memory.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*0-Q6jxKZKnF5kIqNF_abhA.gif" /><figcaption>I‘ve asked God for a sign of forgiveness. A specific one, a white tulip ~ Dr. Bishop</figcaption></figure><h2>1. Why This Exists</h2><p>I started this project with a simple question: why do all chaos engineering tools stop at the network?</p><p>Netflix’s Chaos Monkey kills instances. That’s useful if your failure mode is “pod died.” Gremlin adds CPU spikes. Litmus runs pod level experiments in Kubernetes. They’re all valuable tools. But none of them let you walk into a single Go binary and say: “intercept this gRPC bidirectional stream, drop every third Kafka message, corrupt this MongoDB aggregation pipeline, and while you’re at it, eat 2GB of RAM and burn 4 CPU cores for 30 seconds.” None of them give you one YAML file that defines destruction across seven different protocols plus the OS itself, then deploys that destruction through a CLI with a dead man’s switch, a Kubernetes operator managing CRDs, or an AI that reads your live Prometheus metrics and writes the attack plan for you.</p><p>This is the gap pastaay fills. It’s not a wrapper around existing tools. It’s not a YAML generator for litmus experiments. Every interceptor, every operator controller, every JavaScript panel, every line of Go is built from scratch.</p><p>The name comes from paSta’ay, a ritual of Taiwan’s Saisiyat people honoring the Da’ai, a tribe of diminutive but uncommonly powerful spirits. Chaos, remembrance, and things that punch above their weight. Seemed fitting.</p><p>Let me walk you through how each piece works, with real code, real architecture diagrams, and the real engineering decisions behind them.</p><h2>2. System Architecture</h2><p>Before we dive into individual components, here’s how the entire system fits together:</p><figure><img alt="Pastaay system architecture: Control Plane (CLI, Web Console, K8s Operator) feeds Config Manager (atomic.Pointer + file watcher + policy engine), which dispatches to 8 interceptors (HTTP, gRPC, Kafka, RabbitMQ, Redis, MongoDB, SQL, CPU/RAM). All interceptors route to Prometheus, OpenTelemetry, and the log bus." src="https://cdn-images-1.medium.com/max/1024/1*I75V3O9L2BRzO3qoxJWlSA.png" /><figcaption>Three entry points. One config manager with atomic pointer dispatch. Eight interceptors. Three observability backends.</figcaption></figure><p>The engine has three entry points, web console, CLI, and Kubernetes operator, all feeding into the same Config Manager. The Manager holds the source of truth: an atomic pointer to the current configuration. Every interceptor reads from this pointer on every request. The file watcher updates this pointer when the YAML changes on disk. The telemetry bus collects events from every layer and feeds them to the web console, Prometheus, and OpenTelemetry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WSZbCpm6LV__7jAmH8JmYQ.png" /><figcaption>Main dashboard: live telemetry grid, fault velocity, system journal</figcaption></figure><h2>3. The Policy Engine</h2><h3>3.1 O(1) Lookup Without a Single Heap Allocation</h3><p>This is the most important performance decision in the entire project. On every HTTP request, literally every request your application serves, pastaay needs to check: “is there an active policy that targets this path?” If that check allocates memory, and you’re serving 50,000 requests per second, you’re creating 50,000 heap allocations per second. The garbage collector will eat you alive.</p><p>The solution is a type-indexed cache behind an atomic pointer. <strong>T</strong>hanks to Go 1.19’s atomic.Pointer, we can do this safely and cleanly without interface{} type assertions:</p><pre>type Manager struct {<br>    mu            sync.Mutex<br>    cfg           atomic.Pointer[PastaayConfig]<br>    typedPolicies atomic.Pointer[map[string][]Policy]<br>    startTime     time.Time<br>    sensorStatus  sync.Map<br>}<br>func (m *Manager) GetActivePolicies(policyType string) []Policy {<br>    ptr := m.typedPolicies.Load()<br>    cfg := m.cfg.Load()<br>    if ptr == nil || (cfg != nil &amp;&amp; time.Since(m.startTime) &lt; cfg.WarmupDuration) {<br>        return nil<br>    }<br>    return (*ptr)[policyType]<br>}</pre><p>When the configuration is updated (by file watcher, webhook, or operator), the Manager takes a write lock once, rebuilds the type-indexed map, and atomically swaps the pointer. Every subsequent read, and there are potentially millions of reads per second, is just an atomic load followed by a map lookup. Zero allocation. Zero lock contention.</p><p>The warmup check at the top prevents chaos from triggering during the initial configuration load. If your application starts and chaos policies fire before the server is ready, you get a false-positive outage. The warmup period (default 10 seconds) gives everything time to stabilize.</p><h3>3.2 Stable Hashing for Policy Identity</h3><p>Every policy gets a deterministic FNV-1a hash computed from all its fields:</p><pre>func generateStableHash(p *Policy) uint64 {<br>    // FNV-1a: a non-cryptographic hash that distributes well<br>    // and is deterministic, same input always produces same output.<br>    var h uint64 = 14695981039346656037 // FNV offset basis<br>    const fnvPrime uint64 = 1099511628211<br><br>    // Hash string fields with field separators to prevent<br>    // &quot;ab&quot; + &quot;c&quot; from colliding with &quot;a&quot; + &quot;bc&quot;.<br>    sep := func() { h ^= 0; h *= fnvPrime }<br><br>    for _, s := range []string{p.Name, p.Target, p.Type, p.ErrorBody, p.StreamRollMode} {<br>        for i := 0; i &lt; len(s); i++ {<br>            h ^= uint64(s[i])<br>            h *= fnvPrime<br>        }<br>        sep()<br>    }<br>    // ... numeric fields, match headers ...<br>    return h<br>}</pre><p>Why does this matter? The resource sabotage daemon uses policy hashes for deduplication. If you change a policy’s RAM chunk from 256MB to 512MB, the hash changes, and the daemon kills the old RAM leaker and spawns a new one. If nothing changed, the daemon does nothing. This prevents the classic “restart all goroutines on every config reload” problem.</p><h3>3.3 SQL Command Normalization</h3><p>SQL interception has a unique challenge: the same logical query can have different textual representations. SELECT * FROM users and select * from users and SELECT * FROM users are the same query. The CleanSQLCommand function normalizes SQL text by stripping comments, collapsing whitespace, and uppercasing:</p><pre>func CleanSQLCommand(cmd string) string {<br>    var result strings.Builder<br>    inString := false<br>    var stringChar byte<br>    for i := 0; i &lt; len(cmd); i++ {<br>        char := cmd[i]<br>        if char == &#39;\&#39;&#39; || char == &#39;&quot;&#39; {<br>            // Handle escaped quotes<br>            isEscaped := false<br>            for j := i - 1; j &gt;= 0 &amp;&amp; cmd[j] == &#39;\\&#39;; j-- {<br>                isEscaped = !isEscaped<br>            }<br>            if !isEscaped {<br>                if inString &amp;&amp; char == stringChar {<br>                    inString = false<br>                } else if !inString {<br>                    inString = true<br>                    stringChar = char<br>                }<br>            }<br>        }<br>        if !inString {<br>            if char == &#39;-&#39; &amp;&amp; i+1 &lt; len(cmd) &amp;&amp; cmd[i+1] == &#39;-&#39; {<br>                // Skip SQL line comment<br>                for i &lt; len(cmd) &amp;&amp; cmd[i] != &#39;\n&#39; {<br>                    i++<br>                }<br>                result.WriteByte(&#39; &#39;)<br>                continue<br>            }<br>        }<br>        result.WriteByte(char)<br>    }<br>    return strings.ToUpper(strings.Trim(result.String(), &quot; \r\n\t;()&quot;))<br>}</pre><p>This is one of those functions that looks simple but took three iterations to get right. The string aware comment stripping (so inside a SQL string literal doesn&#39;t get treated as a comment) was the hardest part. Version 1 used a regex. Version 2 used a simple loop but broke on escaped quotes. Version 3 (this one) is the first that handles all edge cases correctly.</p><h2>4. The Config Manager</h2><h3>4.1 Atomic Pointer Swap: How Policy Updates Don’t Block Requests</h3><p>The Manager’s Update method is the only write path. It&#39;s protected by a mutex, but that mutex is never contended during normal operation because updates happen rarely (once per config file change). Here&#39;s the full method:</p><pre>func (m *Manager) Update(newCfg *PastaayConfig) {<br>    m.mu.Lock()<br>    defer m.mu.Unlock()<br>    if newCfg != nil {<br>        // Pre-compute all policy metadata<br>        for i := range newCfg.Policies {<br>            p := &amp;newCfg.Policies[i]<br>            // Generate metric tag (type:target, truncated to 64 chars)<br>            tag := p.Type + &quot;:&quot; + p.Target<br>            if len(tag) &gt; 64 {<br>                tag = tag[:61] + &quot;...&quot;<br>            }<br>            p.MetricTag = tag<br>            // SQL regex compilation<br>            if strings.EqualFold(p.Type, &quot;sql&quot;) {<br>                // ... compile regex for SQL target matching ...<br>            }<br>            // Compute stable FNV-1a hash<br>            p.PolicyHash = generateStableHash(p)<br>        }<br>        m.cfg.Store(newCfg)<br>    }<br>    // Rebuild type-indexed cache<br>    cache := make(map[string][]Policy)<br>    if newCfg != nil {<br>        for _, p := range newCfg.Policies {<br>            cache[p.Type] = append(cache[p.Type], p)<br>        }<br>    }<br>    m.typedPolicies.Store(&amp;cache)<br>}</pre><p>The critical design choice here: the metadata pre-computation happens under the write lock, not on the hot path. Every interceptor calls GetActivePolicies which does nothing but an atomic load and a map lookup. The regex compilation, hash computation, and metric tag generation all happen once during the update, not millions of times during request processing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_9JJ-d7fg9nf3d_7FYWArg.png" /><figcaption>File watcher detects YAML change, debounces 300ms, loads config, pushes to Config Manager which atomically swaps the policy cache. Runtime path shows zero-allocation policy lookup on every request.</figcaption></figure><h2>5. The Hot Reload Watcher</h2><h3>5.1 Why File Watching Is Harder Than You Think</h3><p>The naive approach to watching a configuration file:</p><pre>watcher, _ := fsnotify.NewWatcher()<br>watcher.Add(&quot;pastaay.yaml&quot;)<br>for event := range watcher.Events {<br>    if event.Has(fsnotify.Write) {<br>        reload()<br>    }<br>}</pre><p>This breaks in production. Here’s why:</p><ol><li><strong>Vim writes</strong> use a temp file then rename. The watcher sees a RENAME event, not WRITE.</li><li><strong>Kubernetes ConfigMaps</strong> create a symlink swap. The old inode is deleted, a new one appears.</li><li><strong>Atomic editors</strong> (like sed -i) create a new file and rename it over the old one.</li><li><strong>Multiple write events</strong> fire for a single logical change. Without debouncing, you reload the config 4 times in 10 milliseconds.</li></ol><p>Pastaay’s watcher handles all of these:</p><pre>const debounceWindow = 300 * time.Millisecond<br><br>func WatchConfig(filePath string, reloadCallback func(*PastaayConfig)) (cancel func(), err error) {<br>    ctx, cancelCtx := context.WithCancel(context.Background())<br>    watcher, werr := fsnotify.NewWatcher()<br>    if werr != nil {<br>        cancelCtx()<br>        return nil, werr<br>    }<br>    if aerr := watcher.Add(filePath); aerr != nil {<br>        _ = watcher.Close()<br>        cancelCtx()<br>        return nil, aerr<br>    }<br><br>    var (<br>        timer    *time.Timer<br>        timerMu  sync.Mutex<br>        fireWG   sync.WaitGroup // tracks in-flight reloads so cancel() waits for them<br>        stopFlag = make(chan struct{})<br>    )<br><br>    // scheduleReload is the single entry point for ALL file events.<br>    // Remove, Rename, Chmod (inode changes), Write, Create, and even<br>    // watcher errors all go through here. This eliminates the race<br>    // condition that existed when Remove and Write had separate paths.<br>    scheduleReload := func(reason string) {<br>        timerMu.Lock()<br>        defer timerMu.Unlock()<br><br>        // If stopFlag is closed, cancel() has been called.<br>        // Don&#39;t schedule anything new.<br>        select {<br>        case &lt;-stopFlag:<br>            return<br>        default:<br>        }<br><br>        // Reset the debounce timer. Every new event pushes the reload<br>        // 300ms into the future. This prevents 4 rapid reloads when an<br>        // editor saves a file.<br>        if timer != nil {<br>            timer.Stop()<br>        }<br>        timer = time.AfterFunc(debounceWindow, func() {<br>            // Register BEFORE doing any work so cancel() can track us.<br>            fireWG.Add(1)<br>            defer fireWG.Done()<br><br>            // Re-check: if cancel() was called during the 300ms wait,<br>            // bail out immediately.<br>            select {<br>            case &lt;-stopFlag:<br>                return<br>            default:<br>            }<br><br>            // Reattach: remove the old inode, then retry Add.<br>            // vim writes a temp file then renames. sed -i creates a<br>            // new file. K8s ConfigMaps swap symlink targets. All of<br>            // these are handled by Remove + Add.<br>            _ = watcher.Remove(filePath)<br>            for attempt := 0; attempt &lt; 10; attempt++ {<br>                if err := watcher.Add(filePath); err == nil {<br>                    break<br>                }<br>                select {<br>                case &lt;-stopFlag:<br>                    return<br>                case &lt;-time.After(50 * time.Millisecond):<br>                }<br>            }<br><br>            newCfg, loadErr := LoadConfig(filePath)<br>            if loadErr != nil {<br>                log.Printf(&quot;[Pastaay-Config] reload skipped (%s): %v&quot;, reason, loadErr)<br>                return<br>            }<br>            // Validate rejects broken YAML. Engine keeps the last valid config.<br>            if vErr := newCfg.Validate(); vErr != nil {<br>                log.Printf(&quot;[Pastaay-Config] reload rejected (%s): %v&quot;, reason, vErr)<br>                return<br>            }<br><br>            // Final gate: if cancel() was called during LoadConfig or<br>            // Validate, do NOT invoke the callback. The caller has<br>            // already torn down and a stale config push would be a bug.<br>            select {<br>            case &lt;-stopFlag:<br>                return<br>            default:<br>            }<br>            reloadCallback(newCfg)<br>        })<br>    }<br><br>    var loopWG sync.WaitGroup<br>    loopWG.Add(1)<br>    go func() {<br>        defer loopWG.Done()<br>        defer watcher.Close()<br>        for {<br>            select {<br>            case &lt;-ctx.Done():<br>                return<br>            case event, ok := &lt;-watcher.Events:<br>                if !ok { return }<br>                // All event types go to the same debounced path.<br>                // No more separate CAS reattach goroutine.<br>                if event.Has(fsnotify.Write) || event.Has(fsnotify.Create) ||<br>                    event.Has(fsnotify.Remove) || event.Has(fsnotify.Rename) ||<br>                    event.Has(fsnotify.Chmod) {<br>                    scheduleReload(event.Op.String())<br>                }<br>            case errEv, ok := &lt;-watcher.Errors:<br>                if !ok { return }<br>                log.Printf(&quot;[Pastaay-Config] watcher error (forcing reattach): %v&quot;, errEv)<br>                scheduleReload(&quot;watcher-error&quot;)<br>            }<br>        }<br>    }()<br><br>    cancel = func() {<br>        close(stopFlag)       // signal all goroutines to stop<br>        cancelCtx()           // cancel the root context<br>        timerMu.Lock()<br>        if timer != nil {<br>            timer.Stop()      // stop any pending debounce timer<br>        }<br>        timerMu.Unlock()<br>        loopWG.Wait()         // wait for the event loop goroutine<br>        fireWG.Wait()         // wait for any in-flight reload callback<br>    }<br>    return cancel, nil<br>}</pre><p>All file events; Write, Create, Remove, Rename, Chmod, and watcher<br>errors, go through a single scheduleReload path. A 300ms debounce<br>prevents burst reloads. Inside the callback, watcher.Remove + Add<br>handles inode changes from vim, sed -i, and Kubernetes ConfigMap<br>symlink swaps. If LoadConfig fails or Validate rejects, the engine<br>keeps running with the last valid config.</p><p>The critical detail: fireWG.Add(1) happens inside the AfterFunc body<br>but BEFORE the I/O work. cancel() closes stopFlag, stops the timer,<br>then calls loopWG.Wait() then fireWG.Wait(). Any callback past the<br>stopFlag gate completes before Wait returns. Any callback still in<br>the debounce window sees stopFlag closed and bails. Zero use-after-cancel.</p><p>Invalid configurations are rejected. If you write broken YAML, the engine keeps running with the last valid configuration. The error is logged. No crash, no rollback, no surprise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*njQ3JsFYzkz6i9tTSaNtKA.gif" /><figcaption>Hot-reload in action: edit pastaay.yaml, watcher picks it up, config swaps atomically</figcaption></figure><h2>6. The Interceptor Pattern</h2><h3>6.1 HTTP: The Reference Implementation</h3><p>Every protocol interceptor in pastaay follows the same skeleton. Here’s the HTTP middleware in full:</p><pre>func Middleware(mgr *config.Manager) func(http.Handler) http.Handler {<br>    return func(next http.Handler) http.Handler {<br>        return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {<br>            // Step 1: Check if this path is protected (whitelist)<br>            if mgr.IsCommandIgnored(&quot;http&quot;, r.URL.Path) {<br>                next.ServeHTTP(w, r)<br>                return<br>            }<br>            // Step 2: Get active policies for this protocol (zero alloc atomic load)<br>            policies := mgr.GetActivePolicies(&quot;http&quot;)<br>            // Step 3: Iterate policies, match path and headers<br>            for i := range policies {<br>                p := &amp;policies[i]<br>                if !matchPath(r.URL.Path, p) || !matchHeaders(r, p.MatchHeaders) {<br>                    continue<br>                }<br>                // Step 4a: Latency injection with context cancellation support<br>                if p.LatencyChance &gt; 0 &amp;&amp; rand.Float64() &lt; p.LatencyChance {<br>                    metrics.InjectedFaultsTotal.WithLabelValues(metricTag, &quot;latency&quot;).Inc()<br>                    ctx, span := tracing.StartChaosSpan(r.Context(),<br>                        &quot;pastaay.http.latency&quot;, p.Target, &quot;latency&quot;)<br>                    timer := time.NewTimer(p.LatencyDuration)<br>                    select {<br>                    case &lt;-timer.C:<br>                        span.End()<br>                    case &lt;-ctx.Done():<br>                        timer.Stop()<br>                        span.End()<br>                        w.WriteHeader(499) // 499: Nginx standard for Client Closed Request<br>                        return<br>                    }<br>                }<br>                // Step 4b: Error injection<br>                if p.ErrorChance &gt; 0 &amp;&amp; rand.Float64() &lt; p.ErrorChance {<br>                    metrics.InjectedFaultsTotal.WithLabelValues(metricTag, &quot;error&quot;).Inc()<br>                    _, span := tracing.StartChaosSpan(r.Context(),<br>                        &quot;pastaay.http.error&quot;, p.Target, &quot;error&quot;)<br>                    defer span.End()<br>                    status := p.ErrorCode<br>                    if status == 0 { status = http.StatusInternalServerError }<br>                    w.Header().Set(&quot;Content-Type&quot;, &quot;application/json&quot;)<br>                    w.WriteHeader(status)<br>                    if p.ErrorBody != &quot;&quot; {<br>                        io.WriteString(w, p.ErrorBody)<br>                    }<br>                    return // Stop chain, don&#39;t call next handler<br>                }<br>            }<br>            // Step 5: No matching policy with active probability, pass through<br>            next.ServeHTTP(w, r)<br>        })<br>    }<br>}</pre><h3>6.2 The Wildcard Matching Problem</h3><p>Path matching isn’t as simple as strings.HasPrefix. Consider:</p><pre>Policy target: /api/users/*<br>Request path:  /api/users/123     ✓ Match<br>Request path:  /api/usersettings  ✗ Should NOT match</pre><p>The solution requires checking that the character immediately after the prefix is either / or end of string:</p><pre>func matchPath(reqPath string, p *config.Policy) bool {<br>    // Exact match or wildcard &quot;all&quot; catches everything.<br>    if strings.EqualFold(p.Target, &quot;all&quot;) || strings.EqualFold(reqPath, p.Target) {<br>        return true<br>    }<br>    if p.IsWildcard {<br>        reqPathUpper := strings.ToUpper(reqPath)<br>        if strings.HasPrefix(reqPathUpper, p.WildcardPrefix) {<br>            remaining := reqPathUpper[len(p.WildcardPrefix):]<br>            // The character AFTER the prefix must be &#39;/&#39; or end-of-string.<br>            // This prevents /api/users* from matching /api/usersettings.<br>            if strings.HasSuffix(p.WildcardPrefix, &quot;/&quot;) ||<br>               len(remaining) == 0 ||<br>               remaining[0] == &#39;/&#39; {<br>                return true<br>            }<br>        }<br>    }<br>    return false<br>}</pre><p>The third condition (remaining[0] == &#39;/&#39;) is the key: after stripping the wildcard prefix, the next character must be a path separator. This prevents /api/users* from matching /api/usersettings.</p><h3>6.3 gRPC: Streaming vs Unary</h3><p>gRPC interception is more complex than HTTP because of bidirectional streaming. A unary RPC that fails returns an error code to the client immediately. A streaming RPC that fails mid-stream leaves the client hanging unless the server actively closes the stream.</p><p>The gRPC interceptor handles this by distinguishing between unary and streaming contexts. For streaming, the interceptor wraps the server stream to inject faults on individual messages rather than the entire stream. This allows you to drop message #3 in a stream of 100 messages without affecting the rest, a far more realistic failure mode than killing the entire connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*YOC5GAypk94Wn5N2lFFeyw.png" /><figcaption>Unary RPC returns an error immediately. Streaming drops individual messages silently.</figcaption></figure><h2>7. The SQL Driver Wrapper</h2><h3>7.1 Intercepting database/sql at the Driver Level</h3><p>SQL interception is fundamentally different from HTTP interception. With HTTP, you wrap a handler. With SQL, you wrap the database driver itself, at the database/sql/driver interface level.</p><pre>type WrapperDriver struct {<br>    original   driver.Driver      // the real driver (pgx, sqlite3, mysql, etc.)<br>    cfgManager *config.Manager<br>}<br><br>type WrapperConnector struct {<br>    original   driver.Connector   // Go 1.10+ connector interface<br>    cfgManager *config.Manager<br>}<br><br>func (d *WrapperDriver) Open(name string) (driver.Conn, error) {<br>    // Apply chaos BEFORE opening: can drop connections entirely<br>    // or add latency before the handshake.<br>    if err := applyConnectionChaos(context.Background(), d.cfgManager); err != nil {<br>        return nil, err<br>    }<br>    conn, err := d.original.Open(name)<br>    if err != nil {<br>        return nil, err<br>    }<br>    // Wrap the real connection so every Query/Exec/Begin gets intercepted.<br>    return &amp;WrapperConn{originalConn: conn, cfgManager: d.cfgManager}, nil<br>}</pre><p>Every connection that passes through the wrapper gets a WrapperConn that intercepts Prepare, Exec, Query, Begin, and Commit. Each of these methods checks the policy engine before passing through to the real connection.</p><p>The OpenConnector method handles Go 1.10+ driver connector interface, which is what modern database drivers use internally:</p><pre>func (d *WrapperDriver) OpenConnector(name string) (driver.Connector, error) {<br>    // Go 1.10+ database/sql uses connectors internally.<br>    // We must wrap the connector too, or the driver bypasses our interceptor.<br>    if dc, ok := d.original.(driver.DriverContext); ok {<br>        connector, err := dc.OpenConnector(name)<br>        if err != nil {<br>            return nil, err<br>        }<br>        return &amp;WrapperConnector{original: connector, cfgManager: d.cfgManager}, nil<br>    }<br>    // Fallback for older drivers that don&#39;t implement DriverContext.<br>    return &amp;fallbackConnector{driver: d, name: name}, nil<br>}</pre><h3>7.2 The “Don’t Break Transactions” Rule</h3><p>SQL chaos has a critical safety constraint: never inject faults inside an active transaction’s lifecycle. Breaking a COMMIT is the worst thing you can do to a database, it leaves locks held, connections stuck, and the application in an undefined state.</p><p>SQL chaos checks are applied at connection open and statement execution<br>points. BEGIN also receives a chaos check, but Commit and Rollback are<br>passed through without interception. You can still introduce latency (the transaction takes longer), but you can&#39;t drop the connection or inject query errors during the transaction body.</p><p>This is the kind of constraint that only comes from production experience. Version 1 of the SQL driver didn’t have this protection, and it corrupted test data. Version 2 added it after a very long debugging session.</p><h2>8. OS Resource Sabotage</h2><p>This is the feature that makes people do a double take. Most chaos tools stop at the network layer. Pastaay eats your CPU and RAM.</p><h3>8.1 CPU Starvation: Beating the Compiler Optimizer</h3><pre>func BurnCPU(ctx context.Context, cores int, threshold int) {<br>    if cores &lt;= 0 {<br>        cores = runtime.NumCPU() // saturate all cores by default<br>    }<br>    if threshold &lt;= 0 {<br>        threshold = 100000 // empirically ~95% CPU on a single core<br>    }<br>    var wg sync.WaitGroup<br>    for i := 0; i &lt; cores; i++ {<br>        wg.Add(1)<br>        go func() {<br>            defer wg.Done()<br>            payload := []byte(&quot;pastaay-cpu-vector&quot;)<br>            var localSink [32]byte // compiler can&#39;t optimize this away<br>            for {<br>                for j := 0; j &lt; threshold; j++ {<br>                    // SHA-256 is in assembly (crypto/sha256).<br>                    // The compiler cannot elide it as dead code.<br>                    localSink = sha256.Sum256(payload)<br>                }<br>                // runtime.KeepAlive tells the compiler &quot;localSink is still<br>                // live&quot;, prevents the entire loop from being optimized out.<br>                runtime.KeepAlive(localSink)<br>                select {<br>                case &lt;-ctx.Done(): // clean exit when TTL expires or HALT is pressed<br>                    return<br>                default:<br>                    continue<br>                }<br>            }<br>        }()<br>    }<br>    wg.Wait()<br>}</pre><p>The Go compiler is smart. If it detects that your computation has no observable side effects, it eliminates the entire loop. The empty for {} burns CPU in debug builds but vanishes in optimized builds. So we use SHA-256 hashing, a cryptographic operation the compiler cannot elide because it&#39;s implemented in assembly via the crypto/sha256 package.</p><p>Two subtleties here:</p><p><strong>runtime.KeepAlive(localSink)</strong>, Without this, the compiler might notice that localSink is never read after the loop and eliminate the assignment. KeepAlive is a compiler directive that says &quot;this variable is still live.&quot; It&#39;s a no op at runtime but prevents dead code elimination.</p><p><strong>select with </strong><strong>ctx.Done()</strong>, This is the clean escape hatch. The default branch keeps the loop spinning. When the context is cancelled (experiment TTL expires, halt button pressed, policy removed), the goroutine exits immediately. No leaks, no orphans.</p><p>The threshold parameter controls intensity through iteration count. Empirically:</p><ul><li>10,000 iterations = ~30% CPU on a single core</li><li>100,000 iterations = ~95% CPU</li><li>500,000 iterations = effectively 100%</li></ul><h3>8.2 Memory Exhaustion: Page Forcing and Global Ceilings</h3><pre>func LeakRAM(ctx context.Context, chunkMB int, interval time.Duration) {<br>    if interval &lt;= 0 { interval = 1 * time.Second }<br>    if chunkMB &lt;= 0 { return }<br>    ticker := time.NewTicker(interval)<br>    defer ticker.Stop()<br>    chunkSize := chunkMB * 1024 * 1024<br>    var pool [][]byte<br>    defer func() {<br>        atomic.AddInt64(&amp;currentPoolMB, -int64(len(pool)*chunkMB))<br>        pool = nil<br>        runtime.GC()<br>    }()<br>    allocate := func() bool {<br>        if atomic.LoadInt64(&amp;currentPoolMB)+int64(chunkMB) &gt; maxRAMPoolMB {<br>            log.Printf(&quot;[Pastaay-Resource] RAM ceiling %dMB reached, refusing new chunk (%dMB)&quot;,<br>                maxRAMPoolMB, chunkMB)<br>            return false<br>        }<br>        chunk := make([]byte, chunkSize)<br>        // Page forcing: touch every 4096th byte<br>        for i := 0; i &lt; chunkSize; i += 4096 {<br>            chunk[i] = 1<br>        }<br>        pool = append(pool, chunk)<br>        atomic.AddInt64(&amp;currentPoolMB, int64(chunkMB))<br>        return true<br>    }<br>    allocate()<br>    for {<br>        select {<br>        case &lt;-ctx.Done():<br>            return<br>        case &lt;-ticker.C:<br>            allocate()<br>        }<br>    }<br>}</pre><p>This function embodies three engineering principles I consider non negotiable for any chaos tool:</p><p><strong>1. Page forcing.</strong> make([]byte, chunkSize) allocates virtual memory but doesn&#39;t commit physical pages. The OS uses demand paging, physical RAM is only assigned when a page is actually touched. By writing to every 4096th byte (the standard page size on both x86 and ARM64), we force the kernel to commit real, physical memory. Without this, your /proc/meminfo looks scary but the kernel hasn&#39;t actually allocated anything meaningful.</p><p><strong>2. Global ceiling.</strong> maxRAMPoolMB is hard coded at 4096MB. I hardcoded this to 4GB because it’s a safe upper bound that prevents catastrophic node eviction (OOMKill) on standard 8GB/16GB cloud worker nodes, while still being devastating enough for any application-level test. No matter what the YAML says, the engine will never allocate more than 4GB across all RAM leaking policies combined. The check is an atomic load compare at the allocation site, if you&#39;re already at 3.9GB and request another 256MB chunk, the allocation is refused and logged. The guard module catches unrealistic values at validation time, but the runtime ceiling is the absolute last line of defense.</p><p><strong>3. Guaranteed cleanup, the Amnesia Protocol.</strong> The defer block zeros the pool slice, subtracts the atomic counter, and triggers runtime.GC(). When the context is cancelled (because the experiment&#39;s TTL expired, you clicked the HALT button, or the policy was removed from the YAML), all memory returns to the OS. No restart required. No dangling allocations. The name &quot;Amnesia Protocol&quot; comes from the idea that the engine should forget it ever held that memory, complete, verifiable amnesia.</p><p>The resource sabotage daemon MonitorAndTrigger polls policies every 2 seconds, comparing policy hashes to detect changes. This is a state machine with exactly two states: running (with a cancel function) and idle:</p><pre>func MonitorAndTrigger(ctx context.Context, mgr *config.Manager) {<br>    ticker := time.NewTicker(2 * time.Second)<br>    defer ticker.Stop()<br><br>    var lastResourceHash uint64      // tracks policy identity across reloads<br>    var activeCancel context.CancelFunc<br><br>    for {<br>        select {<br>        case &lt;-ctx.Done():<br>            if activeCancel != nil {<br>                activeCancel()       // kill any running sabotage goroutines<br>            }<br>            return<br><br>        case &lt;-ticker.C:<br>            policies := mgr.GetActivePolicies(&quot;resource&quot;)<br><br>            // Kill-switch: if all resource policies are removed from YAML,<br>            // immediately stop sabotage and release all memory.<br>            if len(policies) == 0 {<br>                if activeCancel != nil {<br>                    activeCancel()<br>                    activeCancel = nil<br>                    lastResourceHash = 0<br>                }<br>                continue<br>            }<br><br>            // Compute combined hash of all active resource policies.<br>            // Only restart sabotage if policies actually changed.<br>            var combinedHash uint64<br>            for _, p := range policies {<br>                combinedHash = (combinedHash&lt;&lt;1 | combinedHash&gt;&gt;63) ^ p.PolicyHash<br>            }<br>            if combinedHash != lastResourceHash {<br>                if activeCancel != nil {<br>                    activeCancel()   // kill old sabotage before starting new<br>                }<br>                lastResourceHash = combinedHash<br>                var chaosCtx context.Context<br>                chaosCtx, activeCancel = context.WithCancel(ctx)<br>                for _, p := range policies {<br>                    TriggerResourceSabotage(chaosCtx, buildResourcePolicy(p))<br>                }<br>            }<br>        }<br>    }<br>}</pre><h2>9. The Blast Radius Guard</h2><p>The guard is not a gatekeeper, it doesn’t stop you from deploying dangerous policies. It’s an analysis tool that tells you exactly how dangerous your policies are before you deploy them.</p><pre>func Analyze(cfg *config.PastaayConfig) PlanResult {<br>    res := PlanResult{Issues: make([]string, 0)}<br>    if cfg == nil || len(cfg.Policies) == 0 {<br>        return PlanResult{Status: &quot;SAFE&quot;, Score: 0, TotalRisk: 0.0, Issues: []string{}}<br>    }<br><br>    systemSurvival := 1.0 // multiplicative survival probability<br><br>    // Core guard: disabled default-ignored = 15% flat risk penalty<br>    if !cfg.EnableDefaultIgnored {<br>        res.Issues = append(res.Issues,<br>            &quot;CORE GUARD DISABLED: System base vulnerability increased.&quot;)<br>        systemSurvival *= 0.85<br>    }<br><br>    targets := make(map[string]string) // detect overlapping policies<br><br>    for _, p := range cfg.Policies {<br>        // Skip no-op policies (all probabilities zero, no resource effects)<br>        if p.LatencyChance == 0 &amp;&amp; p.ErrorChance == 0 &amp;&amp;<br>           !p.DropConnection &amp;&amp; p.RAMChunkMB == 0 &amp;&amp; p.ThrottleThreshold == 0 {<br>            continue<br>        }<br><br>        // Factor 1: Scope — how much of the system does this hit?<br>        // 0.4 = targeted endpoint, 1.0 = entire protocol layer<br>        scopeWeight := 0.4<br>        if p.Target == &quot;all&quot; || p.Target == &quot;database&quot; || p.Target == &quot;*&quot; || p.Target == &quot;&quot; {<br>            scopeWeight = 1.0<br>            res.Issues = append(res.Issues,<br>                fmt.Sprintf(&quot;[%s] Global Target: Exposes entire &#39;%s&#39; infrastructure layer.&quot;,<br>                    p.Name, p.Type))<br>        }<br><br>        // Factor 2: Collision — two policies hitting the same target<br>        // compound. Each overlap adds +0.2 to scope weight.<br>        key := p.Type + &quot;:&quot; + p.Target<br>        if orig, exists := targets[key]; exists {<br>            res.Issues = append(res.Issues,<br>                fmt.Sprintf(&quot;[%s] Collision: Overlaps with &#39;%s&#39;. Cascading failure probability increased.&quot;,<br>                    p.Name, orig))<br>            scopeWeight = min(1.0, scopeWeight+0.2)<br>        }<br>        targets[key] = p.Name<br><br>        // Factor 3: Fault severity — the worst single effect this policy can cause<br>        maxSeverity := 0.0<br><br>        if p.DropConnection {<br>            maxSeverity = 1.0 // hard TCP drop = maximum severity<br>            res.Issues = append(res.Issues,<br>                fmt.Sprintf(&quot;[%s] Hard TCP Drop: Triggers immediate network circuit-breakers.&quot;, p.Name))<br>        }<br>        if p.ErrorChance &gt; 0 {<br>            maxSeverity = max(maxSeverity, p.ErrorChance)<br>        }<br>        if p.LatencyChance &gt; 0 {<br>            latMultiplier := 0.3<br>            if p.LatencyDuration &gt;= 5*time.Second {<br>                latMultiplier = 1.0 // thread pool exhaustion territory<br>                res.Issues = append(res.Issues,<br>                    fmt.Sprintf(&quot;[%s] 5s+ Timeout: Causes severe thread pool exhaustion.&quot;, p.Name))<br>            } else if p.LatencyDuration &gt;= 1*time.Second {<br>                latMultiplier = 0.6<br>            }<br>            maxSeverity = max(maxSeverity, p.LatencyChance*latMultiplier)<br>        }<br>        if p.Type == &quot;resource&quot; {<br>            resSeverity := 0.0<br>            if p.RAMChunkMB &gt;= 1024 {<br>                resSeverity = 0.9 // OOM territory<br>            } else if p.RAMChunkMB &gt;= 256 {<br>                resSeverity = 0.5<br>            } else if p.RAMChunkMB &gt; 0 {<br>                resSeverity = 0.2<br>            }<br>            if p.ThrottleThreshold &gt;= 100000 {<br>                resSeverity = max(resSeverity, 0.8) // near-100% CPU lock<br>            }<br>            maxSeverity = max(maxSeverity, resSeverity)<br>        }<br><br>        // Policy risk = severity × scope. Multiplicative survival model.<br>        policyRisk := maxSeverity * scopeWeight<br>        systemSurvival *= (1.0 - policyRisk)<br>    }<br><br>    finalRisk := 1.0 - systemSurvival<br>    res.TotalRisk = finalRisk<br>    res.Score = int(finalRisk * 100.0)<br><br>    switch {<br>    case res.Score &gt;= 75: res.Status = &quot;CRITICAL&quot;<br>    case res.Score &gt;= 50: res.Status = &quot;HIGH&quot;<br>    case res.Score &gt;= 25: res.Status = &quot;ELEVATED&quot;<br>    default:              res.Status = &quot;SAFE&quot;<br>    }<br>    return res<br>}</pre><p>The scoring model is multiplicative survival analysis: each policy reduces the “survival probability” of the system by maxSeverity × scopeWeight. Policies with global scope and high severity compound dramatically. Two CRITICAL policies don&#39;t add, they multiply.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gQj4D3zwN3qQd_bAeP573Q.png" /><figcaption>Policy builder: drag-and-drop policy editor with blast radius guard</figcaption></figure><h2>10. The Telemetry Bus</h2><p>The telemetry system uses a lock-free circular buffer that can handle concurrent writes from multiple goroutines (one per protocol) and concurrent reads from the web console polling endpoint:</p><pre>type LogEntry struct {<br>    Pod     string `json:&quot;pod&quot;`<br>    Source  string `json:&quot;source&quot;`<br>    Name    string `json:&quot;name&quot;`<br>    Message string `json:&quot;msg&quot;`<br>    Ts      int64  `json:&quot;ts&quot;`<br>}<br>var (<br>    mu       sync.RWMutex<br>    buf      [256]LogEntry<br>    head     int<br>    size     int<br>    nodeName string<br>)<br>func Emit(source, name, msg string) {<br>    mu.Lock()<br>    defer mu.Unlock()<br>    buf[head] = LogEntry{<br>        Source: source, Name: name, Pod: source + &quot;/&quot; + name,<br>        Message: msg, Ts: time.Now().UnixMilli(),<br>    }<br>    head = (head + 1) % 256<br>    if size &lt; 256 { size++ }<br>}<br>func Snapshot() []LogEntry {<br>    mu.RLock()<br>    defer mu.RUnlock()<br>    out := make([]LogEntry, size)<br>    start := (head - size + 256) % 256<br>    for i := 0; i &lt; size; i++ {<br>        out[i] = buf[(start+i)%256]<br>    }<br>    return out<br>}</pre><p>The ring buffer holds 256 entries. When it fills, older entries are silently overwritten. This is intentional, the telemetry bus is not a persistence layer. If you need long term storage, pipe the logs to your existing observability stack via OpenTelemetry or scrape the Prometheus metrics.</p><p>The EmitError and EmitInfo helpers automatically attach OpenTelemetry trace and span IDs when available, creating a direct link between chaos events in the log and spans in your tracing backend:</p><pre>func EmitError(protocol, target, msg, payload string, span trace.Span) {<br>    logData := map[string]interface{}{<br>        &quot;level&quot;: &quot;ERROR&quot;, &quot;protocol&quot;: protocol, &quot;target&quot;: target,<br>        &quot;message&quot;: msg, &quot;payload&quot;: payload,<br>    }<br>    if span != nil &amp;&amp; span.SpanContext().IsValid() {<br>        logData[&quot;trace_id&quot;] = span.SpanContext().TraceID().String()<br>        logData[&quot;span_id&quot;] = span.SpanContext().SpanID().String()<br>    }<br>    jsonLog, _ := json.Marshal(logData)<br>    Emit(nodeName, protocol, string(jsonLog))<br>}</pre><p>This trace correlation was one of the best decisions I made. When you see “Kafka message dropped” in the web console journal, you can copy the trace ID, paste it into Jaeger, and see the entire request journey, which services it touched, where the fault was injected, and what the downstream effects were.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*6MJU0uMU1doZphsNxoz1TQ.png" /><figcaption>System Output Journal: log entries with trace correlation to Jaeger</figcaption></figure><h2>11. The Oracle</h2><h3>11.1 Teaching an LLM to Write Valid Chaos Engineering YAML</h3><p>The Oracle is the feature that gets the most attention, so let me explain exactly how it works.</p><p>The problem: designing good chaos engineering policies requires SRE expertise. Most developers don’t know what failure modes to test, what probability thresholds make sense, or how to combine faults into realistic scenarios. An experienced SRE might spend hours designing a multi vector attack. Most teams never do it at all.</p><p>The solution: give an LLM structured context about your running system and let it figure out the attack plan.</p><p>But LLMs hallucinate. They invent YAML fields. They use range durations like 5s-15s which are syntactically valid YAML but semantically meaningless. They output error_chance: 0 instead of omitting the field. They generate single policy tests when you need multi vector attacks.</p><p>The system prompt for the Oracle is 40 lines of engineering specification that exist to constrain the LLM into producing only valid, deployable output.</p><p>The actual system prompt, constructed in Go and sent to the LLM, looks like this:</p><pre>You are Pastaay Oracle, a Senior Site Reliability Engineering (SRE) AI.<br>Analyze the provided telemetry and system configuration matrices.<br>Your ONLY output must be a highly complex, devastating, multi layered<br>Chaos Engineering blueprint in valid Pastaay V1 YAML wrapped in a markdown<br>yaml block.<br><br>CRITICAL DIRECTIVES:<br>1. Output ONLY valid Pastaay V1 YAML wrapped in a markdown yaml block<br>   (using triple backticks and yaml specifier). NO conversational text.<br>2. DO NOT write single policy basic tests. Generate a Multi Vector Attack<br>   containing at least 3 concurrent policies.<br>3. INTENSITY LEVEL HIGH: Use severe probabilities (0.7-0.9), extreme latency<br>   (3s-8s), and enable drop_connection where appropriate.<br>4. STRICT SCHEMA RULES:<br>   - NEVER use ranges for durations (e.g., &#39;5s-15s&#39; is ILLEGAL.<br>     Use exactly &#39;5s&#39; or &#39;15s&#39;).<br>   - NEVER invent types like &#39;multi&#39;. Stick EXACTLY to the provided schema.<br>   - FATAL GUARD: For &#39;resource&#39; policies, NEVER exceed ram_chunk_mb: 512.<br>   - CLEAN YAML RULE: NEVER output error_chance: 0 or latency_chance: 0.<br>     If a probability is 0, completely OMIT the field from the YAML.<br>   - RESOURCE TYPE RULE: For &#39;resource&#39; policies, completely OMIT<br>     error_chance, error_code, latency_chance, and drop_connection.<br>     They are invalid for OS level sabotage.</pre><p>Notice the style: imperative, negative constraints, all caps enforcement words (NEVER, ILLEGAL, FATAL GUARD, STRICT, ONLY). I went through four iterations of this prompt. Version 1 was conversational and polite. It produced garbage YAML. Version 2 added schema rules but was too permissive. Version 3 added negative constraints but still allowed ranges. Version 4 (this one) works reliably across all four LLM providers.</p><p>I learned something important about prompt engineering: LLMs are not creative collaborators. They are literal instruction followers. If you leave room for interpretation, they will interpret, usually incorrectly. If you say “don’t use ranges,” they might still use them. If you say “NEVER use ranges, this is ILLEGAL,” they comply. The difference in output quality between “avoid X” and “NEVER do X. X is ILLEGAL” is dramatic.</p><h3>11.2 Live Telemetry Context Injection</h3><p>The Oracle doesn’t operate in a vacuum. Before calling the LLM, the engine constructs a telemetry matrix from live Prometheus data:</p><pre>finalPrompt := fmt.Sprintf(<br>    &quot;User Request: %s\n\n--- LIVE TELEMETRY MATRIX ---\n%s&quot;,<br>    userPrompt, sysContext,<br>)</pre><p>The sysContext contains:</p><ul><li>Active policy count and types</li><li>Prometheus counter values for pastaay_injected_faults_total by target and fault type</li><li>Currently targeted services</li><li>Sensor health status</li></ul><p>This means if you type “stress the payment service,” the Oracle sees that payments is already receiving latency faults but not errors, and generates an attack plan that introduces error injection to the payment endpoints while adding latency to the notification service for a multi vector scenario. It’s not guessing, it’s making data informed decisions.</p><h3>11.3 Multi Model Architecture</h3><p>The Oracle supports four providers through a unified interface. OpenAI and DeepSeek share a code path because both use OpenAI compatible APIs:</p><pre>func callLLM(ctx context.Context, apiKey, model, url, sysPrompt, userPrompt, provider string) (string, error) {<br>    // OpenAI and DeepSeek share the same API shape: Chat Completions.<br>    payload := map[string]interface{}{<br>        &quot;model&quot;: model,<br>        &quot;messages&quot;: []map[string]string{<br>            {&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: sysPrompt},<br>            {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: userPrompt},<br>        },<br>        &quot;temperature&quot;: 0.5,<br>    }<br>    req, err := buildJSONRequest(ctx, http.MethodPost, url, payload)<br>    if err != nil {<br>        return &quot;&quot;, err<br>    }<br>    req.Header.Set(&quot;Authorization&quot;, &quot;Bearer &quot;+apiKey) // standard OpenAI-style auth<br>    return executeRequest(req, provider, func(b []byte) (string, error) {<br>        var res struct {<br>            Choices []struct {<br>                Message struct {<br>                    Content string `json:&quot;content&quot;`<br>                } `json:&quot;message&quot;`<br>            } `json:&quot;choices&quot;`<br>        }<br>        if err := json.Unmarshal(b, &amp;res); err != nil {<br>            return &quot;&quot;, fmt.Errorf(&quot;%s decode: %w&quot;, provider, err)<br>        }<br>        if len(res.Choices) == 0 {<br>            return &quot;&quot;, fmt.Errorf(&quot;%s: no choices&quot;, provider)<br>        }<br>        return res.Choices[0].Message.Content, nil<br>    })<br>}</pre><p>Gemini uses a fundamentally different API:</p><pre>func callGemini(ctx context.Context, apiKey, model, sysPrompt, userPrompt string) (string, error) {<br>    // Gemini uses a different API shape than OpenAI/Anthropic.<br>    // The key goes into a header, NOT the URL query string.<br>    // Query params leak into proxy logs and OTel spans.<br>    url := &quot;https://generativelanguage.googleapis.com/v1beta/models/&quot; +<br>        model + &quot;:generateContent&quot;<br><br>    // Gemini&#39;s system instruction is a top-level field, not a message role.<br>    payload := map[string]interface{}{<br>        &quot;system_instruction&quot;: map[string]interface{}{<br>            &quot;parts&quot;: map[string]string{&quot;text&quot;: sysPrompt},<br>        },<br>        &quot;contents&quot;: []map[string]interface{}{<br>            {&quot;parts&quot;: []map[string]string{{&quot;text&quot;: userPrompt}}},<br>        },<br>        &quot;generationConfig&quot;: map[string]interface{}{&quot;temperature&quot;: 0.5},<br>    }<br><br>    req, err := buildJSONRequest(ctx, http.MethodPost, url, payload)<br>    if err != nil {<br>        return &quot;&quot;, err<br>    }<br>    req.Header.Set(&quot;x-goog-api-key&quot;, apiKey) // NOT ?key= in URL<br><br>    return executeRequest(req, &quot;gemini&quot;, func(b []byte) (string, error) {<br>        var res struct {<br>            Candidates []struct {<br>                Content struct {<br>                    Parts []struct{ Text string `json:&quot;text&quot;` } `json:&quot;parts&quot;`<br>                } `json:&quot;content&quot;`<br>            } `json:&quot;candidates&quot;`<br>        }<br>        if err := json.Unmarshal(b, &amp;res); err != nil {<br>            return &quot;&quot;, fmt.Errorf(&quot;gemini decode: %w&quot;, err)<br>        }<br>        // Gemini wraps responses deeper than OpenAI.<br>        // Guard against empty responses from rate limits or safety filters.<br>        if len(res.Candidates) == 0 || len(res.Candidates[0].Content.Parts) == 0 {<br>            return &quot;&quot;, fmt.Errorf(&quot;gemini: no candidates&quot;)<br>        }<br>        return res.Candidates[0].Content.Parts[0].Text, nil<br>    })<br>}</pre><p>Anthropic uses yet another format:</p><pre>func callAnthropic(ctx context.Context, apiKey, model, sysPrompt, userPrompt string) (string, error) {<br>    // Anthropic uses its own Messages API, different from both<br>    // OpenAI and Gemini. System prompt is a top-level field.<br>    payload := map[string]interface{}{<br>        &quot;model&quot;:      model,<br>        &quot;max_tokens&quot;: 4096,<br>        &quot;system&quot;:     sysPrompt,<br>        &quot;messages&quot;:   []map[string]string{{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: userPrompt}},<br>    }<br>    req, err := buildJSONRequest(ctx, http.MethodPost,<br>        &quot;https://api.anthropic.com/v1/messages&quot;, payload)<br>    if err != nil {<br>        return &quot;&quot;, err<br>    }<br>    req.Header.Set(&quot;x-api-key&quot;, apiKey)<br>    req.Header.Set(&quot;anthropic-version&quot;, &quot;2023-06-01&quot;)<br>    return executeRequest(req, &quot;anthropic&quot;, func(b []byte) (string, error) {<br>        var res struct {<br>            Content []struct{ Text string `json:&quot;text&quot;` } `json:&quot;content&quot;`<br>        }<br>        if err := json.Unmarshal(b, &amp;res); err != nil {<br>            return &quot;&quot;, fmt.Errorf(&quot;anthropic decode: %w&quot;, err)<br>        }<br>        if len(res.Content) == 0 {<br>            return &quot;&quot;, fmt.Errorf(&quot;anthropic: no content&quot;)<br>        }<br>        return res.Content[0].Text, nil<br>    })<br>}</pre><p>Each model has a carefully chosen default: DeepSeek R1 (deepseek-reasoner) for the Oracle&#39;s reasoning heavy workload, GPT-4o-mini for cost efficiency, Gemini 2.5 Flash for speed, and Claude Sonnet for Anthropic&#39;s ecosystem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*-l_5BCbYlAfZkkWHUqGzuw.png" /><figcaption>Oracle panel: LLM generates attack YAML, guard validates it before deployment</figcaption></figure><h2>12. The Web Console</h2><h3>12.1 Vanilla Everything</h3><p>There is no React. No Node.js. No npm. No webpack. No build step. The entire frontend is embedded in the Go binary:</p><pre>//go:embed templates/*<br>var TemplatesFS embed.FS<br>//go:embed static/*<br>var StaticFS embed.FS</pre><p>When pastaay starts, it registers routes that serve these embedded files directly from memory:</p><pre>func RegisterHandlers(mux *http.ServeMux, mgr *config.Manager) {<br>    tmpl := template.Must(template.ParseFS(TemplatesFS, &quot;templates/*.html&quot;))<br>    mux.Handle(&quot;/static/&quot;, http.FileServer(http.FS(StaticFS)))<br>    mux.Handle(&quot;/console/docs/raw/&quot;,<br>        http.StripPrefix(&quot;/console/docs/raw/&quot;, http.FileServer(http.FS(docs.FS))))<br>    mux.HandleFunc(&quot;/console&quot;, func(w http.ResponseWriter, r *http.Request) {<br>        renderHTML(tmpl, w, &quot;dashboard&quot;)<br>    })<br>    mux.HandleFunc(&quot;/console/docs&quot;, func(w http.ResponseWriter, r *http.Request) {<br>        renderHTML(tmpl, w, &quot;docs&quot;)<br>    })<br>    mux.HandleFunc(&quot;/console/builder&quot;, func(w http.ResponseWriter, r *http.Request) {<br>        renderHTML(tmpl, w, &quot;builder&quot;)<br>    })<br>    mux.HandleFunc(&quot;/console/api/state&quot;, requireConsoleToken(adminToken, handleState(mgr)))<br>    mux.HandleFunc(&quot;/console/api/oracle&quot;, requireConsoleToken(adminToken, handleOracle))<br>    mux.HandleFunc(&quot;/console/api/plan&quot;, requireConsoleToken(adminToken, handlePlan))<br>    mux.HandleFunc(&quot;/console/api/rollback&quot;, requireConsoleToken(adminToken, handleRollback(mgr)))<br>    mux.HandleFunc(&quot;/console/api/probe&quot;, requireConsoleToken(adminToken, handleProbe))<br>    mux.HandleFunc(&quot;/console/api/metrics&quot;, handleMetrics)<br>    mux.HandleFunc(&quot;/console/api/discover&quot;, requireConsoleToken(adminToken, handleDiscover))<br>}</pre><p>The authentication middleware uses constant time comparison to prevent timing attacks on the API token. If PASTAAY_WEBHOOK_TOKEN is set as an environment variable, every API call requires it in the X-Pastaay-Token header. If it&#39;s empty, the console is open access, which is fine for local development but should be configured in production.</p><h3>12.2 The Widget System</h3><p>The dashboard grid is a proper drag and drop implementation. Each panel is a self contained widget that manages its own data fetching, rendering, and lifecycle. The layout persists in localStorage:</p><pre>// From widget.js, layout persistence<br>saveLayout() {<br>    const order = [];<br>    this.grid.querySelectorAll(&#39;[data-widget-id]&#39;).forEach(el =&gt; {<br>        order.push(el.dataset.widgetId);<br>    });<br>    localStorage.setItem(&#39;pastaay_layout&#39;, JSON.stringify(order));<br>}<br>loadLayout() {<br>    const saved = localStorage.getItem(&#39;pastaay_layout&#39;);<br>    if (!saved) return;<br>    const order = JSON.parse(saved);<br>    order.forEach(id =&gt; {<br>        const el = this.grid.querySelector(`[data-widget-id=&quot;${id}&quot;]`);<br>        if (el) this.grid.appendChild(el);<br>    });<br>}</pre><p>Widgets communicate with the engine through a REST API served by the same Go process. The state endpoint returns the current policy state, telemetry snapshot, and sensor health in a single JSON response. Widgets poll this endpoint at configurable intervals and update themselves. There’s no WebSocket, no Server Sent Events, no complex state management, just HTTP polling that works through any firewall.</p><p>A closer look at two of the panels. The Global Fault Velocity chart tracks the total fault injection rate across all targets in real time:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*pt4y7RIxyXHs73x9zLlySQ.png" /><figcaption>Global Fault Velocity: real-time fault injection rate across all targets</figcaption></figure><p>The Blast Radius Matrix breaks down errors, latency spikes, and dropped connections across the most targeted services:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*TwvAHR2WEdPy9HqXhvZ6-g.png" /><figcaption>Blast Radius Matrix: errors, latency spikes, and dropped connections by service</figcaption></figure><h3>12.3 The Resilience Probe</h3><p>The resilience probe uses Apdex scoring. Apdex (Application Performance Index) classifies response times into three buckets relative to a configurable threshold T:</p><ul><li><strong>Satisfied:</strong> response ≤ T</li><li><strong>Tolerating:</strong> T &lt; response ≤ 4T</li><li><strong>Frustrated:</strong> response &gt; 4T or error</li></ul><p>The Apdex score = (Satisfied + Tolerating/2) / Total. A score of 0.94+ means the target is healthy. Below 0.70 means it’s degrading. Below 0.50 means it’s failing.</p><p>The probe sends HTTP requests through a server side proxy to bypass browser CORS restrictions:</p><pre>func handleProbe(w http.ResponseWriter, r *http.Request) {<br>    var req struct{ URL string `json:&quot;url&quot;` }<br>    json.NewDecoder(r.Body).Decode(&amp;req)<br><br>    start := time.Now()<br>    // Server-side proxy, bypasses browser CORS restrictions.<br>    // The probe targets services the browser can&#39;t reach directly.<br>    client := &amp;http.Client{Timeout: 10 * time.Second}<br>    resp, err := client.Get(req.URL)<br>    elapsed := time.Since(start).Milliseconds()<br><br>    result := map[string]interface{}{&quot;elapsed_ms&quot;: elapsed}<br>    if err != nil {<br>        result[&quot;status&quot;] = 0<br>        result[&quot;error&quot;] = err.Error()<br>    } else {<br>        defer resp.Body.Close()<br>        result[&quot;status&quot;] = resp.StatusCode<br>    }<br>    json.NewEncoder(w).Encode(result)<br>}</pre><p>The probe supports multi target round robin probing, EMA smoothed scoring, and clickable diagnostic popovers that explain each field in plain English.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*2xoKdFP8wOSEM3nL4677XQ.png" /><figcaption>Resilience Probe: Apdex scoring with server-side proxy probing</figcaption></figure><h3>12.4 Kubernetes Log Streaming</h3><p>The web console can stream pod logs in real time. The backend uses the Kubernetes Watch API to detect new pods and attach log streams:</p><pre>// Watch for new pods and stream their logs in real time.<br>w, err := clientset.CoreV1().Pods(namespace).Watch(ctx, metav1.ListOptions{})<br>for event := range w.ResultChan() {<br>    pod, ok := event.Object.(*corev1.Pod)<br>    if !ok { continue }<br><br>    switch event.Type {<br>    case watch.Added, watch.Modified:<br>        // Only attach to Running pods, pending/terminating pods ignored.<br>        if pod.Status.Phase == corev1.PodRunning {<br>            streamCtx, cancel := context.WithCancel(ctx)<br>            activeStreams[pod.Name] = cancel // store cancel for cleanup<br>            go startKubeLogStreamer(streamCtx, clientset, namespace, pod.Name)<br>        }<br><br>    case watch.Deleted:<br>        // Pod removed — cancel its log stream to free resources.<br>        if cancel, exists := activeStreams[pod.Name]; exists {<br>            cancel()<br>            delete(activeStreams, pod.Name)<br>        }<br>    }<br>}</pre><p>Log streams use the Kubernetes Pod Log API with Follow: true. Each line is emitted to the telemetry bus, which feeds the System Output Journal panel in the web console. The journal supports hierarchical filtering (Pod → Protocol → Method), text search, live/pause toggle, and clic -to decrypt payload tracing.</p><p>The watch loop reconnects on failure with exponential backoff, capping at 30 seconds. If the watch channel closes (which happens periodically), the loop restarts the watch and reattaches to any running pods.</p><p>Here is the full console in action:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_RlICCQl9xcRnN4kEEZGAg.gif" /><figcaption>Full web console walkthrough</figcaption></figure><h2>13. The Kubernetes Operator</h2><p>The pastaay Kubernetes operator manages chaos policies as Custom Resources. When you apply a ChaosPolicy CRD to your cluster, the operator detects it, translates it into the engine&#39;s configuration format, and pushes it to the target pods through the webhook API:</p><pre>apiVersion: chaos.pastaay.io/v1<br>kind: ChaosPolicy<br>metadata:<br>  name: payment-service-stress<br>spec:<br>  policies:<br>    - name: http-latency-spike<br>      type: http<br>      target: /api/payments/*<br>      latency_chance: 0.8<br>      latency_duration: 3s<br>    - name: db-connection-drop<br>      type: sql<br>      target: database<br>      drop_connection: true<br>      error_chance: 0.3</pre><p>The operator controller watches for CRD changes and reconciles the desired state against the engine. It also handles the RBAC necessary for the log streaming feature, a separate ClusterRole that grants pod log read access.</p><p>[IMAGE: docs/assets/operator_header.png, the operator architecture header]</p><h2>14. Zero Allocation</h2><h3>14.1 The Performance Guarantee</h3><p>Every policy lookup in pastaay is zero allocation.</p><p><strong>1. Atomic pointers for configuration.</strong> The policy cache is behind an atomic.Pointer. Reading it requires no lock. The pointer swap during updates takes microseconds and doesn&#39;t block readers.</p><p><strong>2. Type indexed slice cache.</strong> Instead of iterating all policies on every request, policies are pre grouped by protocol type. An HTTP request only checks HTTP policies. A Kafka message only checks Kafka policies. The map lookup is O(1).</p><p><strong>3. Lock free PCG random number generator.</strong> Go’s math/rand/v2 uses the PCG (Permuted Congruential Generator) algorithm, which is lock free and allocation free. Comparing rand.Float64() &lt; p.ErrorChance is a single atomic operation.</p><p><strong>4. No intermediate allocations.</strong> The policy struct is stack allocated. The path matching uses only stack variables. The context based delay uses time.NewTimer which pre allocates its internal structures. No fmt.Sprintf, no strings.Builder, no temporary slices.</p><p><strong>5. OpenTelemetry BatchSpanProcessor.</strong> Spans are batched and flushed asynchronously. If your tracing backend is slow or offline, chaos spans queue up in memory and flush later. The critical path (injecting the fault) never blocks on span export.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sFy-r0qwRgzc_w5V8HQYdw.png" /><figcaption>Zero allocation benchmark: 0 B/op, 0 allocs/op verified with Go testing</figcaption></figure><h2>15. What I Learned</h2><p>This section is the part you won’t find in the README or the documentation. These are the things that cost me days of debugging, rewrites, and staring at stack traces at 2 AM.</p><h3>Filesystem watchers will betray you</h3><p>I spent three days debugging why the watcher stopped working after a Kubernetes ConfigMap update. The ConfigMap gets mounted as a symlink to a directory containing the file. When the ConfigMap changes, Kubernetes replaces the symlink target, which means the old file’s inode is deleted and a new one appears. fsnotify sees this as RENAME followed by nothing, because the watcher was attached to the old inode. The fix took an hour to code and three days to discover was necessary.</p><p>I learned more about Linux filesystems from this one bug than from any course or book. Actual knowledge: fsnotify watches inodes, not paths. Vim writes to a temp file and renames. sed -i does the same. Kubernetes ConfigMaps create symlink forests. Your watcher needs to handle all of these, or your tool silently stops working.</p><h3>LLMs need negative constraints, not positive guidance</h3><p>My first Oracle prompt was friendly. “Please generate a chaos engineering YAML configuration.” The output: a single HTTP policy with error_chance: 0 and a conversational preamble thanking me for the opportunity.</p><p>I tried making it more specific. “Generate a multi vector attack with at least 3 policies.” The output: three policies, but one had type multi (not a valid type), one used latency_duration: 5s-15s (range, not a valid duration), and one had ram_chunk_mb: 2048 which the guard would reject.</p><p>The working prompt is imperatives and prohibitions. “NEVER use ranges. NEVER invent types. output_chance: 0 is ILLEGAL. OMIT the field entirely.” The difference in output quality between “please avoid” and “NEVER do X” is the difference between a working tool and a demo that crashes.</p><p>This is general advice for anyone building LLM powered tools: don’t be polite. Be precise. Negative constraints are more powerful than positive ones. Tell the model what NOT to do, and exactly why it’s wrong.</p><h3>Zero allocation is a mindset, not a technique</h3><p>The first version of the policy engine used sync.Map and allocated a new slice on every lookup. It worked. At 100 requests per second, nobody noticed. At 10,000 requests per second, the garbage collector woke up every 50 milliseconds and ate 30% of CPU.</p><p>Rewriting to use atomic.Pointer and type indexed slices took two weeks. The first week was figuring out what to change. The second week was discovering all the places that implicitly allocated, a fmt.Sprintf here, a strings.Join there, a temporary map created for header matching.</p><p>The lesson: design for zero allocation from the start. Adding it later is refactoring your entire hot path. The success rate of that kind of refactoring is low. Mine worked because pastaay was small enough at that point. For a larger codebase, it would have been impossible.</p><h3>Trace correlation closes the observability gap</h3><p>I almost cut the OpenTelemetry integration from scope. It seemed like a “nice to have” that would add weeks of work for marginal benefit. I was wrong. The first time I traced a single HTTP request through latency injection, to a Kafka consumer that dropped the message, to a Redis hook that returned a timeout, all visible in a single Jaeger trace tree, the entire value proposition of distributed tracing clicked.</p><p>Chaos engineering without tracing is guesswork. You inject a fault and observe the outcome, but you don’t know the causal chain. Did the payment service fail because of the latency, or because the notification service dropped a message that the payment service was waiting for? Without tracing, you can’t tell. With trace correlation, every chaos event has a span ID that links it to the specific request journey it affected.</p><h2>16. What’s Next</h2><p>Pastaay is not finished. Here’s what’s on the roadmap:</p><p><strong>CEL Driven Rule Engine.</strong> Google’s Common Expression Language compiles expression strings to ASTs and evaluates them with zero allocation overhead. Imagine writing policies like:</p><pre>policies:<br>  - name: conditional-latency<br>    type: http<br>    target: /api/*<br>    condition: &quot;request.header(&#39;X-Priority&#39;) == &#39;low&#39; &amp;&amp; error_chance &gt; 0.5&quot;<br>    latency_duration: 5s</pre><p>The condition is compiled once at policy load time and evaluated on every request inline with the existing interceptor. This turns pastaay from a probability based chaos tool into a truly programmable chaos platform.</p><p><strong>Trace Aware Injection.</strong> Using OpenTelemetry Baggage to propagate chaos decisions across service boundaries. If a request enters your system with a specific baggage header, pastaay can inject faults based on the complete distributed request journey, targeting specific end to end transaction flows rather than individual services.</p><p><strong>Community Interceptors.</strong> The interceptor pattern is designed to be extensible. Adding a new protocol requires implementing a single interface. I’d like to see community contributed interceptors for Cassandra, Elasticsearch, S3, and whatever else people are running.</p><p>If you’ve read this far, you now understand pastaay better than most people who will ever use it. This article is my attempt to document not just what the code does, but why it does it that way, the constraints, the failed approaches, the late night realizations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kYYKhkdnGYmrT_Xkf9heCg.jpeg" /></figure><p>Pastaay is at <a href="https://github.com/CemAkan/pastaay">github.com/CemAkan/pastaay</a>. It’s a single Go binary. It has no external runtime dependencies. It works on macOS, Linux, and anywhere Go compiles. Everything in this article is backed by real, working, tested code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*spqMMCqHBq8my0c7-Mz8iQ.gif" /></figure><p>I built this alone, from scratch, during my senior year. If you try it and something breaks, open an issue. If you build an interceptor for a protocol I haven’t covered, open a PR. If you use it to find a bug in production before your users do, that’s exactly why it exists.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65d88fb141f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Falafel is my love language (send help or more tahini)]]></title>
            <link>https://medium.com/@cemakan/falafel-is-my-love-language-send-help-or-more-tahini-6ab3e3130aba?source=rss-a57043ed214a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ab3e3130aba</guid>
            <category><![CDATA[street-food]]></category>
            <category><![CDATA[middle-east]]></category>
            <category><![CDATA[vegan]]></category>
            <category><![CDATA[falafel]]></category>
            <dc:creator><![CDATA[Cem Akan]]></dc:creator>
            <pubDate>Sun, 24 May 2026 17:43:08 GMT</pubDate>
            <atom:updated>2026-05-25T10:42:06.218Z</atom:updated>
            <content:encoded><![CDATA[<p>If you usually read my posts here, you are probably expecting something about design patterns, cloud infrastructure, or configuring development environments. I spend most of my days staring at lines of text on a dark screen, trying to figure out why a piece of code isn’t running the way it should. But let’s be real, no matter how much you love building things behind a screen, you have to look up and actually touch grass once in a while.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AcVwhcd_ptEWs60UeiuTbQ.png" /></figure><p>Lately, if there is one thing I have been obsessing over even more than tech stacks, it is my absolute hunt for the best street food. I figured it was time to step away from the keyboard and talk about something just as complex and rich in history, but way more comforting: the glorious, humble falafel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eR_VwpBDTEUPKOKB7vqC8A.gif" /></figure><p>Picture this: It is late, you are doom-scrolling through three different delivery apps, and absolutely nothing looks good. You want that perfect crunch, but you don’t want to feel heavy. You want deep spices, but you don’t want it swimming in grease. You are stuck in that classic late-night food loop. And then, out of nowhere, you just know what you need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y15OAHtJwNBIEz2jjbVNOQ.jpeg" /></figure><p>Let’s be honest. Sometimes you don’t even choose the falafel; it just finds you. It gets into your subconscious, and once that craving kicks in, you are done. You can try to fight it, you can look at pizza or burgers, but you are going to lose. Your body already made up its mind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*9y-Wx_voqthvmPC4s50FfQ.gif" /></figure><p>Yeah, that is me right there :D I know I look like I am holding that wrap like it is some ancient, holy relic with the secrets of the universe, but honestly, it feels exactly like that. There is something crazy about holding a warm, heavy pita stuffed to the absolute maximum. You feel the heat coming right through the paper wrap, and you know exactly what kind of loud, satisfying crunch is waiting for you on that first bite.</p><p>We all have our default fast-food habits. When you are too tired to think, you just order whatever is closest. But we really need to break free from the absolute monopoly of the greasy burger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g51rH76Oz8tH3Rl5gniSKA.png" /></figure><p>Look, classic beef patty, we had a good run. But there comes a point where you realize a heavy, grease-soaked burger just cannot compete with the fresh, deeply spiced world of this Middle Eastern legend. It is just a massive upgrade. After a heavy burger, you immediately need a nap. After a great falafel wrap, you actually feel energized and ready to go. I don’t feel bad about making the switch at all, and you shouldn’t either.</p><h3>A Quick Trip Back in Time: Where Did This Come From?</h3><p>Before we talk about the taste, we have to look at how this dish actually started. It didn’t just pop up in a modern kitchen; it survived centuries of history.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YOiBFgKG-BAfQQzHDj2yEA.png" /></figure><p>Most food historians agree that the roots of falafel go back to ancient Egypt. Back then, people weren’t using chickpeas at all. Copts needed something seriously hearty and filling during long periods of fasting and Lent when meat was completely off the table. They used fava beans, mashing them up with local green herbs and leeks, and frying them into light, fluffy cakes called <em>ta’ameya</em>. If you visit Alexandria or Cairo today, this fava-bean version is still the absolute king of breakfast.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X2DhrhAyGLBgbUsYySL-Ow.gif" /></figure><p>But when the recipe traveled out of Egypt and moved into the Levant, through Palestine, Lebanon, Syria, and Jordan, it hit a geographical roadblock. Fava beans weren’t as easy to grow in those soils, so the locals swapped them out for chickpeas. That one change altered the texture forever. It made the balls way crispier on the outside and gave them a nuttier, heavier base. Over the last century, it went from a simple local staple to the absolute king of global street food.</p><h3>The Anatomy of a Perfect Falafel</h3><p>So what is the actual secret here? Why is it so addictive? If you have never had a properly made one, you might look at it and think it is just some fried bean ball. Trust me, you have no idea what you are missing out on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kjKwynRukC-eOs5MdVFrMg.jpeg" /></figure><p>Let’s forget the dry definitions on those slides. Eating high-quality falafel is a full-on experience. The real trick is using raw chickpeas that have been soaked overnight, never boiled, and absolutely never from a can. If you use canned chickpeas, the whole thing turns into mushy baby food the second it hits the oil.</p><p>You grind the raw chickpeas down with tons of fresh flat-leaf parsley, cilantro, plenty of onions, and garlic until it feels like green sand. Then you throw in the spice blend: plenty of cumin for digestion, toasted coriander seeds for a nice citrus snap, and a touch of cardamom or black pepper.</p><p>When that green mix hits the boiling oil, the exterior turns into a deep, rough brown, creating a seriously crunchy shell. But when you crack it open, you get a steaming, vibrant, emerald-green inside that is incredibly light, fluffy, and smells amazing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-zQ0fbVbPYl4ah0mDvcalw.png" /></figure><p>It is also one of the few foods out there that works like a total peace treaty. It brings strict vegans, gluten-free dieters, and hardcore meat-eaters to the exact same table with zero complaints. Plus, with the way prices are going up everywhere, this thing stays the absolute champion of budget-friendly, elite street food.</p><h3>Global Mapping: How Different Cultures Changed the Recipe</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4fRmUci_-X2Eag7-Gs6jbQ.gif" /></figure><p>Traveling through different cities and trying this across Europe and the Middle East taught me that falafel changes completely depending on who is behind the fryer. Everyone took the core idea and added their own local flavor.</p><h4>The Lebanese Standard:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V-gb5XCK7RoeNphzkPBkAg.jpeg" /></figure><p>Lebanon treats falafel with pure respect. Their chickpea balls are incredibly airy, and they usually use these special brass molds with a hole right in the middle so they cook perfectly even. They don’t drown their wraps in chaotic sauces either. They keep it clean: warm flatbread, fresh mint leaves, sharp radishes, tomatoes, and pickled pink turnips. Then comes a heavy pour of <em>tarator</em>, a silky sauce made of pure tahini, fresh garlic, and lots of lemon juice. It tastes incredibly sharp and balanced.</p><h4>The Syrian Tradition:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*agjdGSAdRbhlCSr1BjzxVA.jpeg" /></figure><p>If you get your wrap from a Syrian place, you are going to see a wild twist: <strong>Labneh</strong>. They take thick, cool, tangy strained yogurt and spread it generously along the inside of the bread before throwing in the hot falafels. At first, it sounds weird to put cold dairy right against hot fried food. But the second you bite into it, it clicks. The cold, creamy labneh completely cuts through the richness of the fried chickpeas, making the whole wrap incredibly smooth and easy to finish.</p><h4>The European Style:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0DpLOMVfQWvJUyCbUugRFw.jpeg" /></figure><p>When I was traveling around Europe, especially when I was living in Budapest, I spent a lot of time exploring local falafel joints. The European approach is way more experimental. Because they are feeding a massive, mixed crowd of international students and backpackers, they step away from the strict traditions. You will find shops throwing in sweet mango chutneys, avocado creams, or wild hot sauces that have nothing to do with the original Middle Eastern flavors, but it still makes for an awesome meal when you are walking home late at night.</p><h4>The Saudi Arabian &amp; Gulf Style:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*72U29vMWPjbGov-TPxYfvg.jpeg" /></figure><p>Street food in Saudi Arabia and the Gulf is an absolute sport. They don’t do light snacks; they want a full meal in one wrap. You order a standard falafel sandwich there, and they treat the bread like an open canvas. Along with the smashed falafel, they will stuff it with thick french fries, deep-fried eggplants, fried cauliflower, a big spoonful of spicy <em>shatta</em> chili paste, and a mix of tahini and garlic mayo. It is heavy, rich, and guaranteed to keep you full for the next 12 hours. Beautiful chaos.</p><h3>Breaking the Rules: The Most Unique Toppings</h3><p>Forget the basic lettuce and tomato. Let’s look at the actual, surprising ingredients local shops around the world slide into their wraps. Some sound wild, but they work:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_G-5XoYdKDzJBUfPD484Tg.jpeg" /></figure><ul><li><strong>Pickled Turnips &amp; Beetroot Juice:</strong> Those bright pink, sour sticks you see in traditional shops. They are marinated with wild turnip and beet juice, bringing a sharp, vinegary punch that cuts right through the oil.</li><li><strong>The Hard-Boiled Egg:</strong> This is totally real. In a lot of traditional spots, slicing a warm, hard-boiled egg right into the middle of a falafel wrap is a classic option. It adds a dense texture and tons of extra protein.</li><li><strong>The Fried Veggie Layer:</strong> Deep-fried slices of eggplant, zucchini, or cauliflower right next to the falafel. The sweet, caramelized flavor of the fried eggplant mixed with the savory spices of the chickpea is legendary.</li><li><strong>Labneh:</strong> Like I said before, the ultimate cool, creamy Syrian trick that changes the entire texture of the wrap.</li></ul><h3>Wrap Formats: How Do You Actually Eat It?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7-9fE6lvBPgR_BSuieQ3Pw.jpeg" /></figure><p>The way the food is wrapped and handed to you changes everything. It is all about how you hold it and how clean you stay:</p><h4>The Classic Rolled Tube</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k1mH1JyukpF8dctYYhmZ4Q.jpeg" /></figure><p>The standard, tightly wrapped long tube. It is perfect for eating while walking because everything is packed tight, so you get a bit of every ingredient in every bite. The only downside? If the guy behind the counter puts too much tahini at the bottom, the bread will soak through and break open right onto your clothes. We have all lost a good shirt to this.</p><h4>The Triangle Pocket</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S9wnHdNXxDxns3R42-5zPw.jpeg" /></figure><p>The flatbread or pita is folded neatly into a thick, secure triangular pocket. It is super comfortable to hold, and the sealed bottom means the sauce has a zero percent chance of leaking onto your hands. It holds a bit less food than the long roll, but it is way safer for your clothes.</p><h4>The Open Platter (On a Plate)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RKeXsDmzpIwpw6S-DRQ5Ug.jpeg" /></figure><p>No bread wrapper at all. The golden falafel balls sit out on a smooth bed of hummus and tahini, surrounded by piles of pickles, fresh salads, and a side of fries. This is the sit-down version. It is built for a slow, relaxed meal where you can tear off pieces of fresh bread and scoop up whatever you want at your own pace, though you obviously can’t eat it while walking down the street.</p><h3>The One and Only Law: Always Get a Backup</h3><p>No matter which style you prefer, whether you want pure Lebanese tahini, the Syrian labneh twist, or you firmly believe fries belong inside the wrap (which is the correct opinion), there is one unwritten, universal law of the street: <strong>Ordering just one is a rookie mistake.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uiai7hMVTliR-s5E7VL5nA.png" /></figure><p>It is a total certainty. You will finish that first wrap, wipe the sauce off your chin, and immediately feel a deep wave of sadness because you don’t have another one ready to go. Don’t do that to yourself. Always order two from the start. Your future self will thank you for thinking ahead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*QVX8P63DbTbRuKsvvlvF0A.gif" /></figure><p>At the end of the day, falafel is so much more than just a quick, cheap meal. It is a living cultural journey that changes shapes every time it crosses a border. It is crunchy, comforting, full of history, and best of all, it never judges you when you accidentally drop a bit of sauce all over your desk.</p><p>Long live the chickpea ❤.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ab3e3130aba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Overloading Your REST APIs: A Practical Guide to gRPC]]></title>
            <link>https://medium.com/@cemakan/building-high-performance-apis-a-practical-guide-to-grpc-ec6c5e2b23a2?source=rss-a57043ed214a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec6c5e2b23a2</guid>
            <category><![CDATA[grpc]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Cem Akan]]></dc:creator>
            <pubDate>Sun, 19 Apr 2026 22:58:07 GMT</pubDate>
            <atom:updated>2026-05-24T17:50:29.861Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SNl3ScWTG1R3t9GnK5yNJg.gif" /></figure><p><em>Why traditional REST isn’t always enough and how gRPC is changing the way our microservices talk to each other.</em></p><p>If you are building microservices, mobile backends, or real-time data streams, you have probably hit a wall with traditional API communication. The web has grown, our systems have scaled, and the old ways of doing things are starting to show their limits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AUn2ddU5wX06s0DIVY93pg.jpeg" /></figure><p>Recently, I had the privilege of presenting a webinar to the Cloud Native Addis Ababa community about one of the most powerful technologies in modern backend development: gRPC. I wanted to adapt that session into a comprehensive article series because understanding gRPC is rapidly becoming an essential skill for any backend engineer.</p><p>Before we start looking at lines of code or complex architecture diagrams, we need to set the stage. At its core, modern backend development is entirely about communication. We are not just talking about how we collaborate as humans, but how we enable efficient, strictly typed, and incredibly fast communication between our isolated software services. Finding the right way to manage that constant server-to-server chatter is exactly what solves our biggest performance bottlenecks today.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0xo3DL6Fj2jLKePzbw6nmA.png" /></figure><p>In this guide, we are going to embark on a deep dive into the world of gRPC. My goal is that by the end of this read, you will not just know what the acronym stands for, but you will know exactly how to architect and build high-performance APIs with it.</p><p>Here is our roadmap:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DPI6lW_X3i-c5104uY09qQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oJxs72DJbTcY751W6CULWA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ji-csbTMVcviMzZMjwxOng.png" /></figure><p>Just to give you a bit of context on who is taking you on this journey: I am Cem, a Computer Engineering senior at Çukurova University. My daily focus is heavily rooted in backend development and system architecture. I spend a lot of my time working on internal automation tools, primarily utilizing Go and Node.js.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*3B8WKwQZw3ZSu9wkqcz7wQ.gif" /></figure><p>Beyond writing code and exploring cloud native tools, I am incredibly passionate about community building. I serve as the founder and leader of the Yazılım Çukurova community because I firmly believe that the absolute best way to learn is to teach and build things together.</p><p>Now that the introductions are out of the way, let us jump right into the basics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3HCBsE56pFHdPydF4qvOww.png" /></figure><p>My goal is that by the time you finish reading this, you will not just have heard<em> </em>of gRPC. You will understand why it is the preferred framework for modern cloud-native applications. You will know how to define strict interfaces, how to choose between gRPC and REST, and you will understand the power of bidirectional streaming. We are aiming for practical, production ready knowledge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fm_hvSq-Gy25iol5KXfTgg.png" /></figure><p>Let us start with the absolute basics. <strong>What exactly is RPC?</strong></p><p>It stands for Remote Procedure Call. The concept is beautifully simple: I want to write code on my machine that calls a function on your machine, but I want it to feel exactly like I am calling a local function in my own memory space. I want to tell my code to “calculate the result” and have the magic happen somewhere else on the network without me having to manually open sockets, parse TCP packets, or serialize data. The ultimate goal is transparency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*punNsEc2khGk26R_E-h93A.png" /></figure><p>The diagram from the presentation represents the heart of RPC. When your client code calls a remote function, it is actually talking to a local piece of code called a <strong>Client Stub</strong>. Think of this stub as a packer. It takes your parameters, say the numbers 5 and 10, and marshals them into a network message. The RPC Runtime then sends this message across the wire.</p><p>On the receiving end, the server has a similar stub that unpacks the message, finds the actual function, runs it, and then reverses the whole process for the return value. To your code, it looked like a single, simple function call. To the system, it was a complex round-trip journey.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RLjFGlqSwiWL2mx2QKxDsw.png" /></figure><p>One of the biggest hidden heavy lifters in this process is Marshalling. Your computer stores objects in a very specific, complex way in its memory. Network wires, however, only understand flat streams of bytes. Marshalling is the translation process of flattening that complex in-memory object into a byte stream that can travel. If your client is written in Python and your server is in Java, this translation gets incredibly complex. This exact complexity is where many older RPC systems stumbled.</p><p><strong>The Ghosts of Architectures Past</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SlX3j5nDzAYjQg5EN9NTug.png" /></figure><p>Traditionally, RPC was designed to mimic a standard function call. Standard function calls are synchronous. You call a function, and your thread freezes until the answer comes back. This is perfectly fine for a simple desktop app. However, in a massive microservices architecture, if Service A waits for Service B, and Service B is waiting for Service C, we suddenly have a cascading latency nightmare.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1hx0NS6Z-ki4w8H-rNkhDQ.png" /></figure><p>We did not arrive at our current solutions overnight. In the 90s, the industry tried CORBA. It attempted to solve everything but was famously painful to configure. Then came SOAP, which provided great structure but drowned developers in heavy XML tags. For the last decade or so, REST has been the undisputed king. It leveraged the native language of the web using HTTP and JSON. It was incredibly easy to use. But as our systems grew to massive scales, easy was no longer enough. We needed fast and efficient.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a-me3LHDunjK-AMHxNZYrA.png" /></figure><p>Remember earlier when I said RPC tries to make remote calls look local? That is actually its biggest trap. It is known as the Local Call Fallacy. When you call a local function, it almost never fails. When you call a function over a network, a router might crash, the server might be rebooting, or the Wi-Fi might drop. Traditional RPC frameworks often tried to hide these network errors to maintain that illusion of a local call, which inevitably led to catastrophic application crashes. A truly modern framework needs to acknowledge that the network is a chaotic, unpredictable place.</p><p><strong>If REST works, why change?</strong></p><p>At this point, you might be asking yourself: If REST is so incredibly popular, why change anything?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8fJTVfdvsmOAQFbkQ1NSpA.jpeg" /></figure><p>Let me be clear, REST is amazing for public APIs where you have no idea who the client is or what language they are using. But for internal microservices? It is horribly inefficient.</p><p>Sending JSON means sending repetitive, heavy text over the wire over and over again. Your expensive cloud servers burn valuable CPU cycles just turning plain text into numbers. Furthermore, REST is loosely typed. If I change a field name on the server, the client will not know until it crashes at runtime in production. We desperately need something stricter and lighter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XniWJBkFqalQvOYHXavLgw.png" /></figure><p>Another massive challenge is maintenance in a polyglot company. Today, your backend might be in Go, your data science team uses Python, and your frontend is in React. If you update a REST API, you often have to manually rewrite and update the client libraries for all those different languages. This creates an <strong>integration hell</strong> that severely slows down development cycles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XO6yaRHMKvBdiTkxGIT6xw.png" /></figure><p>So, as an industry, we created a wishlist for a modern solution. We realized we needed the strict structural contracts of the old SOAP days, the ease of use of REST, and the raw performance of binary protocols. We needed it to work seamlessly whether we were coding in C++, Go, or Ruby. Critically, we needed it to handle streaming so we could send continuous data without constantly opening and closing network connections.</p><p>This was the massive gap that existed in the market around 2015.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WKCZR8xwYm4mYuu9a_HPkw.png" /></figure><p>This brings us to the star of the show. You see, Google was experiencing these exact scaling and performance problems over a decade ago. To connect their massive data centers, they built an internal tool called Stubby. It worked brilliantly, and in 2015, they rewrote it and open-sourced it to the world as gRPC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*boCDkcnbrL8XxLEOLp9w9w.jpeg" /></figure><p>What does the ‘<strong>g</strong>’ stand for? It originally stood for Google, but today the ‘<strong>g</strong>’ stands for something different in every single release version. What truly matters is what it represents: the next generation of RPC, designed specifically from the ground up for the incredible scale and speed required by the cloud-native world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*906zB3XG_oGNcWw-74tFKA.png" /></figure><p>Let us peel back the layers and look at the architecture. gRPC is not just a simple library; it is an entire stack. At the very bottom, doing all the heavy lifting, is HTTP/2. Sitting directly on top of that is the ‘Core’, which is often written in C or C++ to provide raw, uncompromised speed. Finally, at the top, we have the language bindings. This is the part you interact with. Whether you are writing your backend in Python, Go, or Java, you are ultimately driving the exact same high-performance C-core engine underneath. This architecture guarantees consistency and blazing speed across every platform.</p><p><strong>The Engine: Why HTTP/2 Changes Everything</strong></p><p>If gRPC is a high-performance sports car, HTTP/2 is its engine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wIEG7xdEL8CoRWgavxV96w.png" /></figure><p>Most traditional REST APIs still run on HTTP/1.1. In the HTTP/1.1 world, if you want to send ten concurrent requests, you often need to open multiple TCP connections or wait in line for each to finish. It is essentially a single-lane road.</p><p>HTTP/2 introduces a concept called <strong>Multiplexing</strong>. It takes your data, breaks it into tiny binary frames, and sends them all at once over a single, long-lived connection. It allows gRPC to handle thousands of concurrent calls without the heavy overhead of constantly opening and closing connections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qTUazdXyTeMqLIRak0B2CA.jpeg" /></figure><p>This is an absolute killer feature for microservices. Imagine your application needs to fetch a user profile, their recent orders, and their recommendations. In gRPC, these are three separate API calls, but they travel over the exact same network wire at the exact same time. If the ‘orders’ database query is running slow, the <strong>profile</strong> data is not blocked. It just zips right past it on the multiplexed highway. This efficiency is exactly why gRPC dominates in environments where services chatter constantly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TbHCoOtib6W18OHkHOxjHw.png" /></figure><p>Now, let us talk about the data payload itself. By default, gRPC uses Protocol Buffers, commonly known as Protobuf. You can think of Protobuf as two distinct things: First, it is a language used to strictly define your API contracts. Second, it is a mechanism to serialize your data into bytes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TDxj6ZxWzIRvUvo9_-Ssxw.png" /></figure><p>People always ask, “<strong>Why not just use JSON?</strong>” JSON is fantastic for human readability, but it is terrible for machine efficiency. Every time you send a payload like {&quot;name&quot;: &quot;Cem&quot;}, you are sending the actual characters &#39;<strong>n</strong>&#39;, &#39;<strong>a</strong>&#39;, &#39;<strong>m</strong>&#39;, &#39;<strong>e</strong>&#39; over the network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zgnbo5NHhrFFdTnXjDoYJA.png" /></figure><p>In Protobuf, the field ‘<strong>name</strong>’ is assigned a numeric tag, like ‘1’. This makes the payload significantly smaller on the wire. More importantly, computers can parse binary data drastically faster than they can parse text. When your company is processing billions of internal requests, this efficiency translates directly to saved money and lower CPU usage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B7Ft5gF3bT8jY1iPOM7kTg.png" /></figure><p>This is what a .proto file actually looks like. It is highly readable but incredibly strict. We define the syntax version, a package name to prevent naming conflicts, and our <strong>Messages</strong>, which are simply data structures. Notice the = 1 and = 2? Those are the unique numeric tags that replace your field names on the network wire. Finally, we define the <strong>Service</strong>. We state exactly what methods exist, what inputs they take, and what they return. This file becomes your ironclad contract.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MDmHKBYakl7NECqADXhxCQ.png" /></figure><p>Here is the absolute best part of this entire system: You write that .proto file exactly once. Then, you hand it over to a tool called the protoc compiler. If your backend team uses Go, it generates Go code. If the mobile team uses Swift, it generates native Swift code. It creates all the data classes, the complex networking logic, and the stubs for you automatically. You never write manual HTTP requests or JSON parsers again. You just call methods on these auto-generated objects, which massively speeds up your development cycle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FU1kF7OVQ6iqGo9jkpfVJw.png" /></figure><p>Because gRPC enforces a <strong>Contract First </strong>approach, you get compile-time safety. If a developer tries to pass a string into a field that the contract defines as an integer, the code simply will not compile. You catch your errors before you deploy, not at 3 AM when production goes down.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BCVdeiGCypOmLl_ZKK_eNg.png" /></figure><p>Traditional APIs limit you to a simple request and response. You ask for something, and you wait for the answer. gRPC shatters this limitation by supporting four distinct modes of communication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ijSoUY86eAtJBSvOroxBWA.jpeg" /></figure><p>The first is <strong>Unary</strong>, which is your classic request and response. But then it gets incredibly interesting with Streaming.</p><p>With <strong>Server Streaming</strong>, the client sends a single request, such as <em>search for logs</em>, and the server pushes back a continuous stream of results over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Omm52d1H_vI3wdA3kycCug.jpeg" /></figure><p>With <strong>Client Streaming</strong>, the client uploads a massive amount of continuous data, and the server replies just once at the end. This is absolutely perfect for large file uploads or sensor telemetry.</p><p>Finally, we have the holy grail: <strong>Bi-directional Streaming</strong>. Both sides can send messages whenever they want, entirely independently. The server can send a message while it is still reading requests from the client. Imagine building a live multiplayer video game server or a real-time chat application. You cannot easily do this with standard REST. This unmatched flexibility is what makes gRPC an absolute powerhouse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gvRMMFZ9YMl-6rBHbtPSeA.png" /></figure><p>Now, let us address the elephant in the room. If REST works so well, why should anyone switch?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B8LppR6FrpkQYp5MqdJbvA.png" /></figure><p>It is crucial to understand that this is not about one technology being universally better than the other. It is about choosing the right tool for the job. REST has been the undisputed champion of the web for over a decade because it is flexible and runs absolutely everywhere. gRPC is the modern challenger, built specifically for speed, scale, and strict structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l7mUFiqExu2peF7E0kN9SQ.png" /></figure><p>Let us compare them head to head across a few key categories to see exactly where each one shines.</p><p>The first major difference is entirely philosophical. REST is resource oriented. You are forced to think in terms of <strong>Nouns</strong> like Books, Users, or Orders, and you manipulate them with standard HTTP verbs like GET or POST. This is very elegant for simple data management. gRPC, on the other hand, is action oriented. You think in <strong>Verbs</strong>. You define exact methods like GetBook or TriggerWorkflow. If your backend performs complex operations that do not fit neatly into a simple PUT or DELETE, gRPC will feel much more natural to your engineering team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k7GPRirCNZiOl6Yh3YWnuQ.jpeg" /></figure><p>We touched on the network differences earlier, but it bears repeating. REST typically rides on HTTP/1.1 and sends heavy text payloads. Even if you compress it, it is still text. gRPC is binary all the way down. It uses HTTP/2 advanced features like header compression and binary framing by default. You do not have to spend days configuring these optimizations; they come straight out of the box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D3D0Z__-0-cvAfMnJSTzZQ.jpeg" /></figure><p>However, here is where REST wins hands down: Browser Support. Every single web browser in the world speaks REST and JSON natively. You can open your developer console right now and type a fetch request. gRPC is much stricter. Because modern browsers do not give developers fine grained control over HTTP/2 frames, you cannot call a gRPC service directly from Chrome or Safari today. You need a translation layer, a proxy, and a special library called gRPC-Web. If you are building a public website, this definitely adds a layer of complexity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iIgwJkzQBz3s3fVQeowP1A.png" /></figure><p>Similarly, debugging REST is easy. You can literally read the network traffic with your own eyes. Debugging gRPC requires a slight mindset shift. Since the wire data is binary, it looks like absolute garbage to human eyes. You need specialized tools that have access to your .proto files to decode the messages back into something readable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cxq0Gg-bugtrFWqFyVo2LQ.png" /></figure><p>But when we talk about pure performance, the numbers are striking. For internal microservices communication, benchmarks consistently show gRPC being 7 to 10 times faster than REST with JSON. This is not just network speed; it is CPU speed. Your servers spend significantly less time parsing text and more time processing actual business logic. If you are paying for cloud compute by the millisecond, gRPC effectively lowers your infrastructure bill.</p><p>So, what is the final verdict?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fwPOF4Tr1gFfF1WaSt-P5A.png" /></figure><p><strong>Stick with REST</strong> for your Public APIs. If you are building the next Stripe or Twitter API for the entire world to consume, stick to REST and JSON because it is universal. Use it for browser heavy applications or quick prototypes where you do not want to manage strict contracts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4KFRGRN2P60-ARUs6cCHeQ.png" /></figure><p><strong>Choose gRPC</strong> for your Internal Microservices. It is the de facto standard for a reason. If you have Service A talking to Service B inside your Kubernetes cluster, use gRPC. It is perfect for polyglot environments and fantastic for mobile apps where saving battery and bandwidth is crucial.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OsQKsY4AiUcxP9WKEZxbsw.png" /></figure><p>And remember, you do not always have to choose just one. The industry standard is the <strong>Hybrid Approach</strong>. You expose a friendly REST API to the outside world for browsers and public clients. But as soon as that request hits your API Gateway, it is instantly translated into lightning fast gRPC for all internal server communication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gSBjpUpi5PReEWnhOC-tfQ.png" /></figure><p>Enough theory. Let us write some actual code. In this section, we are going to build a real gRPC service from scratch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9WuIAhtEPbOaoIfhIwAgFw.png" /></figure><p>We will build a <strong>Route Guide</strong> system, which is a classic example where clients can send their coordinates and get information about points of interest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UHPB3ZvkbUA0XW9RT2_1bA.png" /></figure><p>It all starts with the contract. You open a simple text file and name it route_guide.proto. Here, we define our RouteGuide service. We will define a simple Unary method called GetFeature. It takes a Point containing latitude and longitude, and it returns a Feature containing a name and a location.</p><p>Notice how incredibly clean this is? We are not worrying about JSON structures or URL paths. We are just defining clear data and behavior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eYsYeZKFCOZiWWfSTVbWfw.png" /></figure><p>Next, we run the magic command: protoc. This compiler tool reads our proto file and generates all the heavy lifting code for us automatically. If we are using Python, it creates two files. One contains our data structures, and the other contains the complex networking logic.</p><p>There is a golden rule in gRPC development: You never touch these generated files. If you need to change your API, you change the .proto file and simply regenerate them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mr6FJLoPmjRwFYgn_f9aig.png" /></figure><p>Now we switch over to our own Python file to write the server. The generator provided a base class called RouteGuideServicer. All we have to do is inherit from it and write the business logic for GetFeature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hDNfuhSi63KxaTC-0KvuwQ.png" /></figure><p>Look how beautifully simple the implementation is. The framework hands us the request object ready to use. We do our business logic, like looking up a database, and then we just return a Feature object. We do not have to serialize anything to JSON. We do not have to set HTTP status codes manually. We just return the Python object, and gRPC handles the rest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rv4Wcyc6UZftGai55OY3IQ.png" /></figure><p>To actually start the server, we create a gRPC server object, define a thread pool to handle concurrent requests, register our class, bind it to a port like 50051, and hit start. That is it. Our high performance binary server is officially running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TJ0yqB_k-k8rwzskmmbp0g.png" /></figure><p>Building the client is just as easy. We need two things: a Channel and a Stub. The Channel is the active connection to the server. It handles the TCP connection and security. The Stub is the object we actually interact with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dzytvhQSgV0RaayqhUOJyQ.png" /></figure><p>We open a channel to localhost on port 50051. Then, we just call feature = stub.GetFeature(my_point). This is the true magic of RPC. It looks exactly like a local Python function call. But behind the scenes, gRPC serialized that point, fired it over HTTP/2, waited for the server, and unpacked the resulting Feature. All of that network complexity is completely hidden from you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5rR5m65vWRcCrHeYjtPwzw.png" /></figure><p>What happens if the server is down? In REST, you check for an HTTP 404 or 500 status code. In gRPC, we catch exceptions. If the call fails, the client raises an error, and you can inspect the canonical status codes to see if it was a timeout, a permission issue, or a missing record.</p><h4><strong>The development loop summary:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MeLulAIE7WarjQ6P_w5K_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cPxG-tKdg3pJfLda-Mn-ng.png" /></figure><p>We have built a simple service together. That is a great start, but the real world is rarely simple. Sometimes data does not come in a single chunk; it flows continuously like water. Sometimes we need to secure that data against prying eyes. And eventually, we need to scale our application to handle millions of concurrent users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-MVSffft98R2Ac-fJVpQMA.jpeg" /></figure><p>In this section, we are going to unlock the advanced capabilities that make gRPC a true superhero in the microservices world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QINY_dTTe7Vb0ygb76efIQ.jpeg" /></figure><p>Let us start with Server-Side Streaming. Imagine you want to show a live feed of stock prices or a real time server log. In the REST world, you would have to constantly poll the server every single second, asking if there is new data. It is incredibly wasteful. With gRPC, the client sends a single request saying “I want to subscribe.” The server then keeps the channel open and pushes data continuously whenever an event occurs. You simply add the stream keyword to the return type in your proto file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mwz2lhdN5MNQtxDnh2T8Hw.png" /></figure><p>Implementing this is deceptively simple. On the server side, instead of returning a static list, we use the Python yield keyword. Every time we yield, a message is flushed to the network immediately. On the client side, it looks exactly like iterating over a list in memory. The loop just blocks and waits for the next item to arrive. It feels entirely intuitive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9DASdt9KheFXv7DyeCFZKQ.jpeg" /></figure><p>Now let us flip that scenario around. What if the client is generating the massive flood of data? Maybe you are uploading a 1GB video file or you have a temperature sensor sending readings every millisecond. You absolutely do not want to open a new HTTP connection for every single reading. With Client-Side streaming, the client writes to the stream continuously. The server listens, aggregates the data, and when the client finally says it is done, the server sends back a single summary response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*85Rbw1Mb90KV8vNpYS_CtA.jpeg" /></figure><p>Then we have the crown jewel: Bi-directional streaming. In this mode, both the client and the server can send messages whenever they want. They do not have to take turns. The server can send a message while it is still actively reading requests from the client. This is essential for things like a live chat application. I can type a message to you, but I also need to receive messages from others at the exact same time. It enables truly reactive architectures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pm7Rsv-oNG8cffCxgZy9hw.jpeg" /></figure><p>Let us switch gears to Security. By default, when we develop locally on our machines, we use insecure channels. But in a production environment, you cannot send unencrypted data. gRPC makes enabling encryption trivial. It uses standard SSL and TLS. You literally change one line of code: swap insecure_channel for secure_channel and provide your SSL certificates. Now your entire connection is encrypted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w5zhCFMuEN-c4NNkkk4Rng.jpeg" /></figure><p>Encryption protects the wire itself, but how do we know who is actually calling our API? In REST, we use HTTP Headers for authentication tokens. In gRPC, we call this concept Metadata. Metadata is just key and value pairs that travel alongside your request. You can attach things like Authorization Tokens, Trace IDs, or User IDs. The server can then inspect this metadata to decide whether to allow the request or return a Permission Denied error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z5uD9S22kYy7p96eGR0EaA.jpeg" /></figure><p>You definitely do not want to write “Check Authentication” code inside every single function you write. That gets messy fast. In web frameworks like Express or Django, we use Middleware. In gRPC, we use Interceptors. An interceptor sits right in front of your service. You can use it to log traffic, validate tokens, or measure performance metrics globally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vtgNBagUccpU-MCm6eo9hQ.jpeg" /></figure><p>Finally, we need to talk about scaling. This is historically the trickiest part of gRPC. In the old HTTP/1.1 world, you make a request, get a response, and close the connection. A standard Load Balancer simply distributes these new connections. But remember that gRPC uses HTTP/2, which keeps a single connection open forever. If you start a client, it connects to Server A and stays there. Even if you spin up Server B and C to help with the load, the client completely ignores them. This is known as the Sticky Connection problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KjbtcxgFbDe557kCF9pjcg.png" /></figure><p>How do we fix this? We have two main strategies. First is Client-Side Load Balancing, where the client becomes smart, queries a registry, and rotates its own requests. The second and much more popular approach in Kubernetes environments is using a Layer 7 Proxy like Envoy or Nginx. The proxy sits in the middle, terminates the long lived connection, and distributes the individual internal requests fairly across your backend servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SgWrTeLFI7v44FgpYuPqdQ.png" /></figure><p>We know how it works. Now let us talk about where it works and how to avoid shooting yourself in the foot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F0IGyAzFkYqKbpIUbwLIzg.png" /></figure><p>gRPC is the backbone of companies like Netflix, Uber, and Cisco. It is the ultimate Microservices Backbone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Glq5-l0D0spuJhsr37t2QQ.png" /></figure><p>It is also perfect for IoT and Mobile devices because the tiny binary payloads save crucial bandwidth and battery life.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U8GzEEnzBycAP6Xi7jc9OA.png" /></figure><p>It is the ultimate Polyglot Bridge, allowing your Python Data Science team to talk flawlessly to your Java backend team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OKX7cpYG3r-8qv-LLeiy5Q.png" /></figure><p>If you are going to use it, you need to follow the best practices. I call these the Golden Rules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YWgPDXf7tv_RhWPID39SBQ.png" /></figure><p><strong>Rule number one</strong>: Always set a deadline. Default gRPC calls can wait forever. If a server hangs, your client hangs. You must set a timeout on every call to force the system to fail fast and recover.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qgDy9Vu1pqan3DoRjDs1Dg.png" /></figure><p><strong>Rule number two</strong>: Respect the schema. The true power of Protobuf is backward compatibility. You can add new fields, but you must never change the numeric tag of an existing field. If ‘Name’ is field number 1, it stays field number 1 forever.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SIvE2ri5UY7KGvmuF3qdhg.png" /></figure><p><strong>Rule number three</strong>: Centralize your Protos. Do not copy and paste your proto files into every single project. Keep them in a Central Repository, use a CI/CD pipeline to generate the code, and publish them as versioned libraries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BLLzIHj4dyqFDyhZiO52Pg.png" /></figure><p><strong>Rule number four</strong>: Use Rich Error Handling. Standard error codes are rarely enough. Attach detailed metadata to your errors so the client developer knows exactly which field failed validation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iQwrzxHpifrGgZ-Z2OZDEA.png" /></figure><p><strong>Rule number five</strong>: Mind the size. gRPC is heavily optimized for small and incredibly fast messages. By default, it will not let you send a message larger than 4 megabytes. If you hit this limit, do not just increase the configuration. Use streaming to break your large object into chunks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gf___g67TeA70p-FSqltFg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABDzHl-xws_N3TErZS5veQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p6gn-AX99zUMaD8TUxNymA.png" /></figure><p>Working with binary protocols can be intimidating at first because you cannot just read the network traffic like you do with JSON. Fortunately, the ecosystem has exploded with incredible tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jPpnYqViq0G0dSmqwb90eg.png" /></figure><p>If you love the command line, you need grpcurl. It allows you to talk to a server right from your terminal, automatically translating your JSON input into binary Protobuf behind the scenes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ldMkhMz77LLysdJJ7hbykw.png" /></figure><p>If you prefer a visual interface, Postman now supports gRPC natively. For heavy duty streaming debugging, tools like Kreya or BloomRPC are absolutely fantastic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eVDq_Ch_k85s58-T2R240w.jpeg" /></figure><p>The technology is not standing still either. The next frontier is HTTP/3, moving to UDP with the QUIC protocol to handle packet loss on unreliable mobile networks even better. By investing time in gRPC today, you are learning a technology that is heavily future proofed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WxnSIBPQalxuqMZRzBoDaA.png" /></figure><p>We have covered a massive amount of ground today.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DYrHeX49qJxBOnkIuKJ-aA.png" /></figure><p>If you want to dive deeper, I highly recommend bookmarking the official docs at grpc.io. The <em>Awesome gRPC</em> repository on GitHub is a goldmine, and O’Reilly’s ‘gRPC: Up and Running’ is the standard textbook for mastering this stack.</p><p>Also, if you want to revisit any of the topics we discussed today or see the live Q&amp;A session, you can catch the full replay of the stream below:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FqOxnfYfbyDw%3Fstart%3D1273%26feature%3Doembed%26start%3D1273&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DqOxnfYfbyDw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FqOxnfYfbyDw%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/62a7638763940186bbeca3839ca9a454/href">https://medium.com/media/62a7638763940186bbeca3839ca9a454/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AO5ig4q7gVzYhJa8Ewgudg.png" /></figure><p>Thank you so much for joining me on this deep dive. Writing this out after my session with the Cloud Native Addis Ababa community has reminded me just how powerful our modern tooling has become. I hope you feel empowered to go open your code editor and build something significantly faster and stronger using gRPC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CNkSmd6AfKPuEW_X0PVotQ.png" /></figure><p>If you build something cool, or if you just want to talk about system architecture, please connect with me on LinkedIn or Twitter. I absolutely love seeing what the community builds.</p><p>Happy coding ❤</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5SPH-X_ieRJbRbR0AniLBA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec6c5e2b23a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rethinking Smart Parking: A Dynamic Line and Box Approach to Computer Vision]]></title>
            <link>https://medium.com/@cemakan/rethinking-smart-parking-a-dynamic-line-and-box-approach-to-computer-vision-4005eaf12917?source=rss-a57043ed214a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4005eaf12917</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[yolov8]]></category>
            <category><![CDATA[smart-city-solutions]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Cem Akan]]></dc:creator>
            <pubDate>Tue, 14 Apr 2026 00:42:42 GMT</pubDate>
            <atom:updated>2026-05-24T18:00:17.039Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o3X7HgtXe1F2gX-eSaEAUQ.jpeg" /><figcaption>I’m a Doctor, not a battery ;)</figcaption></figure><p>In the world of computer vision, there is a dirty secret. Most smart systems are actually quite rigid. If you want to track a parking lot, the standard industry practice involves a developer sitting in front of a monitor for hours, manually clicking on every single corner of every single parking spot. They draw hundreds of static polygons. It is a fragile, exhausting process. If the camera angle shifts by a few degrees or a maintenance crew repaints the lines, the whole system becomes blind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYH-VUVgiplcfRrv3pWRzA.gif" /><figcaption>Solovision rethinking urban mobility with dynamic computer vision ❤</figcaption></figure><p>We knew we needed a system that could think for itself. Instead of drawing a map and telling the machine where to look, why not build a system that understands the environment by observing the cars? This is how Solovision was born. We moved away from hardcoded coordinates and toward a methodology we call the Line and Box approach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TxgV1AHMK0eoGN1OTd9T_g.jpeg" /><figcaption>A direct visual comparison between traditional fixed grid monitoring on the left and our dynamic tracking methodology on the right.</figcaption></figure><p>We are all too familiar with the frustration of circling a parking lot for twenty minutes. It is a waste of fuel, time, and sanity. But fixing this should not require a human to manually draw every single spot in a database.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DsE247oNozxE&amp;type=text%2Fhtml&amp;schema=youtube&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FsE247oNozxE%3Ffeature%3Doembed" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b43c74e893733eb0e5ad6a11646392cb/href">https://medium.com/media/b43c74e893733eb0e5ad6a11646392cb/href</a></iframe><p>Here is a deep dive into the logic, the math, and the chaotic reality of making a machine see like a human.</p><h4>The Core Concept: Let the Cars Define the Spots</h4><p>The fundamental idea behind this new approach is simple. Instead of explicitly defining where the parking spots are, we let the computer vision algorithm figure it out based on where cars are currently parked.</p><p>If you see a row of five cars parked next to each other, human logic immediately tells you that they are sitting in a designated parking row. If there is a large gap between the second and third car, you intuitively know that gap is an empty parking space. Our goal was to translate this human intuition into algorithmic logic.</p><p>To do this, the system processes a video feed through a specific pipeline built on Python, OpenCV, and the YOLOv8 object detection model.</p><p><strong>Step 1- Vehicle Detection The Red Boxes:</strong></p><p>The first step is standard object detection. The system takes the video feed and processes it frame by frame using the YOLOv8 model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*9rxDKAlIcgvsZTCPmyqUEQ.gif" /><figcaption>Step by step detection. The system first isolates and identifies individual vehicles placing a red bounding box around each one.</figcaption></figure><p>YOLOv8 is incredibly fast and accurate at identifying vehicles. For every car it detects it draws a bounding box and returns the coordinates. In our visualization we represent these occupied spaces with red boxes. This granular isolation is the foundation of everything that follows because you cannot connect the dots until you find them.</p><p><strong>Step 2- Dynamic Parking Line Inference The Blue Line:</strong></p><p>This is where the methodology departs from traditional static mapping. We take the coordinates of all those red boxes and try to find geometric relationships between them.</p><p>The algorithm looks for cars that are aligned with one another. It searches for collinearity among the bounding boxes. When it finds a group of cars sitting in a line it calculates a dominant axis or a regression line through them. This line represents the center of that specific parking row. We visualize this as a blue line running through the red boxes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*lYx5R3yalMalDOJtRF4aVg.jpeg" /><figcaption>The conceptual logic. The system detects cars as red boxes finds their alignment and draws a dominant axis to establish a parking row.</figcaption></figure><p><strong>Step 3- Free Spot Generation The Green Boxes:</strong></p><p>Once the system has successfully established a parking line it starts looking for gaps. It measures the distance between the red boxes along that specific blue line.</p><p>Of course not every gap is a parking space. Sometimes cars are just parked a bit far apart. To solve this the algorithm compares the gap size to a dynamic threshold typically calculated as roughly one point five times the average width of the detected cars in that row. If the gap is large enough to fit a vehicle the system infers that this empty space is an available parking spot. It then generates a green box to represent it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*tyvAm0dfarlhAw3ABbMq7g.jpeg" /><figcaption>Generating available spots. By measuring the gaps along the blue lines the system dynamically generates green boxes to signify open parking spaces.</figcaption></figure><p>Because the system calculates this on the fly it is incredibly resilient. If a camera angle changes slightly the algorithm just recalculates the lines based on the new visual data.</p><h4>The User Experience</h4><p>To make this technology easy to use we built a clean web interface. Users do not need to be developers to run it. They can simply upload a pre recorded video file or paste a live camera stream URL directly into the dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mYigDtDw7sHKMfpM25_Ciw.png" /><figcaption>The Solovision web interface. Users can easily drag and drop video files or connect to live IP camera streams.</figcaption></figure><p>Once the stream is connected the system instantly goes to work. The user is taken to the Live Detection screen where they can watch the algorithm process the environment in real time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f7yp9-JN1XDq8a5n8RYr4Q.png" /><figcaption>The Live Detection view in action. After a video or stream is connected the system provides real time visual feedback drawing bounding boxes and calculating available spots on the fly.</figcaption></figure><h4>When Logic Meets the Real World</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*DIysIgeg9g6jtf2FmY5AMw.jpeg" /></figure><p>In clean diagrams this methodology looks great. However applying computer vision to a real parking lot introduces plenty of edge cases. The algorithm does not see the world in three dimensions like we do it just sees a flat two dimensional grid of pixels.</p><p>When we first tested the dynamic line logic without strict constraints the output was incredibly noisy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*JZ3_5ZmpgS-cXIRCPxTIdw.png" /><figcaption>The raw debugging state. Without constraints the algorithm gets completely lost trying to connect every single car to every other car creating a web of false lines and wild guesses.</figcaption></figure><p>Look closely at the image above. This raw debugging state perfectly illustrates the challenge of dynamic inference. The system detects the cars with red boxes just fine but when it tries to draw the blue lines to establish parking rows it struggles.</p><p>Because of the camera perspective cars in the back rows look like they are sitting right on top of cars in the front. The algorithm tries to connect a car from row one to a car from row three generating a web of overlapping lines. When the lines are wrong the gap measurement logic fails. It sees a false gap between two incorrectly connected cars and starts placing green boxes right in the middle of driving lanes.</p><p>This false line merging is our biggest hurdle. Sometimes the algorithm figures out the general direction but is just slightly off connecting cars that have nothing to do with each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*slKn7nPto3Vym1W4gIwJBw.jpeg" /><figcaption>The False state. The algorithm is confused by the camera angle and incorrectly connects cars across entirely different parking rows.</figcaption></figure><p>Now contrast that noise with the True state we are actively building towards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*DM45sqSvfMS_fGVFgbOmxw.jpeg" /><figcaption>The expected True state. The algorithm correctly identifies distinct parallel parking rows without crossing over them.</figcaption></figure><p>In a successful detection the algorithm isolates each parallel row. The blue lines stay strictly within their designated lanes allowing the gap measurement to work perfectly and place green boxes exactly where real empty spots exist.</p><h4>Improving the Logic</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*dTBGB2UTm2PN1A2JMJunyw.jpeg" /></figure><p>To move from this noisy debugging state to a stable release we are implementing several backend improvements. Simple dot to dot connections are not enough.</p><p>First we are enhancing the tracking stability. By integrating an object tracker like DeepSORT or BYTETrack we can maintain a consistent identification for each vehicle across frames. This stops the bounding boxes from flickering which in turn prevents the green boxes from disappearing and reappearing randomly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r-fcPRcvfmRt4XbHct2Eng.jpeg" /></figure><p>Second we are overhauling the line logic itself. Instead of simple alignment checks we are moving toward robust mathematical algorithms like RANSAC or a Hough Transform. These algorithms can find the true dominant axis of parked cars while ignoring visual outliers caused by camera perspective. We are also adding a post processing step to strictly enforce parallel lines and merge short adjacent segments that belong to the same axis.</p><h4>Data Logging and Analytics</h4><p>Once the real time detection is stabilized the final piece of the puzzle is data. The Flask backend sends the status of every spot to the frontend for live monitoring while simultaneously logging the data to a PostgreSQL database. A CSV fallback is used if the database is unavailable.</p><p>This historical data is where the real value lies. It allows parking operators to see overall statistics analyze trends and identify peak traffic hours. For instance the system can flag that peak congestion happens between eight and nine in the evening and recommend alternative times for visitors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w5t0uxypNpcINYoD-ETcUg.png" /><figcaption>The Analytics and Insights dashboard. Solovision transforms real time detection into actionable historical data highlighting peak traffic hours and usage trends to optimize parking management.</figcaption></figure><h4>Moving Forward</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s91DDHrBrcK7zTl68Rljiw.gif" /></figure><p>The Line and Box methodology is our attempt to shift away from rigid manual setups toward dynamic intelligent inference. Sure wrestling with real world camera angles and two dimensional perspective is a headache but the payoff is a highly scalable system. We are building something that can look at a parking lot figure out the geometry on its own and just work.</p><p>No more drawing fifty manual polygons every time a camera shifts :3</p><p>If you want to see how we are tackling these</p><p>perspective challenges check out the source code and explore the repository on GitHub at <a href="https://github.com/solovision/Solovision">https://github.com/solovision/Solovision</a> to see the progress for yourself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bjipGgYEQvXWMEwqfbDV-Q.jpeg" /><figcaption><a href="https://github.com/solovision/Solovision"><strong>https://github.com/solovision/Solovision</strong></a></figcaption></figure><p>Goodbye static coordinates. You will not be missed :D</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4005eaf12917" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Kubernetes Before You Lose Your Mind]]></title>
            <link>https://medium.com/@cemakan/understanding-kubernetes-before-you-lose-your-mind-f62222ef4764?source=rss-a57043ed214a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f62222ef4764</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes-pods]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Cem Akan]]></dc:creator>
            <pubDate>Mon, 23 Mar 2026 19:46:11 GMT</pubDate>
            <atom:updated>2026-04-13T17:59:33.397Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey everyone. If you are tired of reading boring technical docs and want to understand Kubernetes without losing your mind you are exactly where you need to be :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*m-H-hA6QzIjK1Zt9h8wunw.png" /></figure><p>Grab a coffee and get comfortable. A while ago I gave a detailed presentation on Kubernetes 101 for the UN SDG AI Lab and I realized it would make a highly beneficial Medium article for anyone trying to learn this technology.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6H9r1yfxeAi2fyA4ypR2XA.png" /></figure><p>Today we are going deep into the architecture and concepts. We will keep it conversational but stay focused on the technical details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AT2vbdR7FuiM-yfrHDPA9w.png" /></figure><p>Let us look at our roadmap for today. We are going to talk about the why first. You need to thoroughly understand the fundamental need and the pain points before we touch any new technology. Then we move to the what by actually defining Kubernetes. After that we will explore the how by breaking down the complex architecture into simple mental models. We will also do a live demonstration to prove it all works and map out your path forward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kctEk0bzsD-5KkBwZgnc2w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGULadrTwTmypUpxWFdMzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ipyZxqumQLeg31dFbIYeNg.png" /></figure><p>Before we dive into the deep end let me give you a quick background about myself. I am Cem Akan. I study Computer Engineering at Cukurova University. Right now I am heavily involved in developing an internal automation tool using Go and Node js. On the community side I am the Founder and Leader of Yazilim Cukurova. My core technical interests revolve around Back End Development, DevOps Culture and System Architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*KcYDLab3fY3WZegiSzzNTg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGULadrTwTmypUpxWFdMzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HO3ggW_YCMclJQDOHT_NTg.png" /></figure><p>Here is what we are going to achieve together today. We will understand the challenges of modern application deployment, define what Kubernetes is and the specific problems it solves, identify its core components and finally witness it in action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*4T0QT9D9MCt3umgzCiKNKg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGULadrTwTmypUpxWFdMzg.png" /></figure><p>To truly appreciate the peace we have now we must revisit the dark ages. We are talking about the evolution of application deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TS55Cu6LMG8ew1lYy0zZWA.png" /></figure><p>We started in the traditional era. Back then people deployed applications directly on bare metal servers. It was incredibly expensive and scaling was a massive headache. If you needed more computing power you had to physically buy a new server and set it up manually.</p><p>Then the tech industry evolved into the Virtualization era. This let us run multiple virtual computers on one single physical machine. But virtual machines are incredibly heavy because each one needs a full operating system to run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wxZAMpdwwTUZ4gBsdwiDxw.png" /></figure><p>Finally we reached a new era called containerization.</p><p>Let us take a quick look at containers and define what they actually are.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGULadrTwTmypUpxWFdMzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_pKhgSxGrIhh1mMEgkO6yg.png" /></figure><p>Containerization is a software deployment process. It packages an applications code together with all the files and libraries it needs to run on any infrastructure. This beautiful process creates a single lightweight executable unit that we call a container. You build it once and it just works anywhere without giving you endless configuration headaches.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HLHjJJIi8e90nRRhXe5hQA.png" /></figure><p>So life is perfect right. Having one or two containers running on your personal laptop is super easy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGULadrTwTmypUpxWFdMzg.png" /></figure><p>But in the real world you do not just have one container. The true challenge is managing containers at scale. Managing hundreds or thousands of them in a live production environment is absolute chaos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R_gwWSlpxy_sAJEeOR7ynQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGULadrTwTmypUpxWFdMzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FE6m2gGPnpIxthHi9RKd6Q.png" /></figure><p>Picture this scenario. You are fast asleep in your bed. Suddenly a crucial server catches fire and crashes. All your containers on that server die instantly. You wake up to a terrifying 404 error nightmare.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ptkoEXNB6Ke40Tu4fCSd0A.png" /></figure><p>Trying to fix that manually while thousands of users are getting errors is a terrible experience. We definitely need a moment of silence for all the developers who lived through this pain before modern orchestrators existed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FhAVh4AtHUhI83-YmPn0Hw.png" /></figure><p>This kind of sudden disaster is exactly why we need automation. But imagine you are having a normal day. Everything is running fine but you need to push a new feature. You need to update your application from version one to version two without stopping service. If you have hundreds of containers managing that traffic and ensuring zero downtime manually is another level of difficulty altogether. This brings us directly to the next huge challenge in application deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Qg1ClBDxXxXUVPngKg6gQ.png" /></figure><p>Or think about doing a live update. You need to push a new version of your application without dropping any user connections. Trying to handle this update manually across hundreds of containers is a complete nightmare. You are just a developer and not a traffic cop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGULadrTwTmypUpxWFdMzg.png" /></figure><p>Imagine staring at that broken server and thinking there has to be a better way to handle these live deployments and sudden crashes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kal8Jz1T-PcBPkTtiuv0jg.png" /></figure><p>But look up in the sky. It is a bird. It is a plane. It is Kubernetes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*Thl2dMaL-nVWHY2ttDuxeg.png" /></figure><p>When you have hundreds of these containers running wild you need a master conductor to organize the chaos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FATbQZvamaoH5gNSnICAAg.png" /></figure><p>What exactly is Kubernetes anyway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gO0fq6W9naLcdsMF6oxurw.png" /></figure><p>Kubernetes acts exactly like that conductor in an orchestra. It takes all your separate containers and makes them work together in perfect harmony. It is an open source container orchestration system and it completely automates deploying scaling and managing your applications.</p><p>So how does it actually solve our 3 AM nightmare. Let us look at the three main superpowers it brings to the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGULadrTwTmypUpxWFdMzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2AuizMltXWBNN6J4FRASAQ.png" /></figure><p>First we have self healing. If a container crashes or a node dies Kubernetes instantly notices the exact problem. It does not wait for you to wake up. It automatically restarts or replaces that container to bring your system back to the desired healthy state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k3nfVYJsmueISMgaZPdrTA.png" /></figure><p>Then we have smart scaling. Imagine your application suddenly goes viral and traffic spikes by ten times. Kubernetes monitors your resource usage and automatically scales your application up by adding more containers. When the traffic drops it scales them back down to save you money.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-0cU1GrFOP_7sbS1fTXMxQ.png" /></figure><p>And remember that live update nightmare. Kubernetes handles auto updates smoothly. It gradually rolls out new versions of your application while taking down the old ones so your users never experience any downtime at all.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*POarhkX3pjMWaT3q6mUJsQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGULadrTwTmypUpxWFdMzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2u_1un4wUi7xj7mJX5AfIg.png" /></figure><p>Because of these massive benefits it became the undeniable industry standard. It gives you high availability so your app is always online. It provides insane scalability. It gives you infrastructure freedom meaning you can run it on AWS Google Cloud Azure or your own bare metal servers without changing your code. And obviously it leads to massively increased productivity for your developer teams.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2XOs6cYhEbkzDIaY4BmBNg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGULadrTwTmypUpxWFdMzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hBO3fzLgvOgnJYrQTAmF3w.png" /></figure><p>Now Kubernetes architecture is famously complex and can be really hard to grasp at first glance. So let us use a mental model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5ZjPIweCaxwIESdpeLQdYQ.png" /></figure><p>Analogy time. We are going to look at the maritime shipping industry to understand how a Kubernetes cluster actually operates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w4C4Ba2fULKYrrKsiow4Zw.png" /></figure><p>Think of a massive cargo ship that carries physical shipping containers across the ocean.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*21tJ-7w4UUbjF7qGOgiUUQ.png" /></figure><p>In our Kubernetes world this cargo ship represents a Worker Node. The worker node is the absolute workhorse of your cluster. It does the actual heavy lifting of running your application containers. A cluster is made up of multiple worker nodes basically a whole fleet of these cargo ships working together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1T9Y93kHlxO6tMxq3wxEuQ.png" /></figure><p>But a fleet of ships cannot just sail blindly into the ocean. They need direction. Enter the Control Ship.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dKN-6O3DCH3132QzDHfjWQ.png" /></figure><p>The control ship represents the Master Node. The master node is the absolute brain of the entire operation. It manages everything plans schedules monitors and tells the cargo ships exactly what to do. The worker nodes just follow the orders given by the master node blindly.</p><p>Let us zoom in and look at the specialized crew working inside this Master Node brain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fAtKGsUPXpA_JaBX76cIBQ.png" /></figure><p>So we have this massive control ship making all the big decisions but it needs specialized crew members to actually handle specific tasks. First up we have the ship cranes. In the Kubernetes world we call this the Kube Scheduler.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Py06G_i1uaJ-6-Z9vLgNLA.png" /></figure><p>Think about how a real port works. When a brand new shipping container arrives someone has to decide exactly where it goes. You cannot just drop it anywhere and hope for the best. The Kube Scheduler is a core component of the control plane that does exactly this job.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b5Af1NlNHIJy0VYVc1dJ7Q.png" /></figure><p>Its main function is to assign newly created pods to specific worker nodes. It does not just throw them randomly. It makes this placement decision based on strict resource requirements policies and other constraints you define. It checks which cargo ship has enough CPU and memory space and assigns the cargo there smoothly. If a ship is full the scheduler is smart enough to find another one.</p><p>Now imagine having thousands of containers spread across hundreds of ships. You absolutely need a highly reliable way to track them all. You need to know which containers are on which ships and exactly when they were loaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JpPL-SrKRMyPx2UsesPGVQ.png" /></figure><p>This is where our highly available database comes in. We call it the ETCD cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HAYbd-emlUOBnywQ-totGQ.png" /></figure><p>ETCD is essentially a consistent and highly available key value store. It acts as the primary data store for all cluster data. You can think of it as the ultimate source of truth because it stores and replicates the entire Kubernetes cluster state. If this database goes down your control ship basically loses its memory completely. That is why keeping it healthy and backed up is one of the most critical things in cluster administration.</p><p>Moving on we have the offices in the dock. Picture an operation team handling ship control and a cargo team verifying if containers are damaged or need to be rebuilt. In our cluster this is known as the Controller Manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vub1GHuNeoBYCAjDfRuoYQ.png" /></figure><p>The Controller Manager handles various controllers that keep the system running automatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QhrX5rSADV1Srakk880WVg.png" /></figure><p>These controllers are basically continuous control loops that constantly watch the state of your cluster. When they notice something is wrong they make or request changes immediately. Every single controller tries to move the current cluster state closer to the desired state you originally defined. For example if a node goes down the node controller notices this failure and takes action to handle the onboarding of new nodes or rescheduling the lost workload.</p><p>But how do all these different services and teams actually communicate with each other. They need a central IT and communication office. Enter the Kube API Server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TVPMg5jQmGGu40OANjcAiw.png" /></figure><p>The API Server is the primary management component responsible for orchestrating all operations within a cluster. It exposes the Kubernetes API which is used by external users to perform management operations and by internal controllers to monitor the state of the cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UckVNBMt0J0lvfTP7K8LGg.png" /></figure><p>It is literally the front end for the control plane and the central point of communication for all components. Whenever you type a kubectl command in your terminal you are talking directly to this API server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zyLXKhjI-sAvg14D3Q2h8g.png" /></figure><p>It does not just blindly accept commands though. It goes through a strict pipeline. First it uses authentication to check who you are. Then it uses authorization to see if you actually have the right permissions. Finally it uses admission control to validate the request before saving the new state to ETCD.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1KNqXsyJ2hyT5KlVuIPqEg.png" /></figure><p>Alright we covered the control ship. Now let us talk about the worker components down in the actual cargo ships. Every good ship needs a captain to manage all sorts of activity on board.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9a7RSAiozu7-mx6MRJKd7w.png" /></figure><p>The captain lets the master ship know they are ready to join the fleet and sends regular reports back about the overall status of the ship and its containers. We call this captain the Kubelet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bL5cL2bCbfFENI1UkbgPEQ.png" /></figure><p>The Kubelet is an agent that runs on every single worker node in a cluster. Its main job is to watch for pod specifications and ensure the containers described in those specs are running correctly and are perfectly healthy on its node. It is the core component making sure your cargo does not sink into the ocean.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1VvPVS4spH2JSVtxvJN3PQ.png" /></figure><p>But we still have a networking issue to solve. How will a web server running on one worker node reach out to a database server running on another worker node. Basically how do two separate cargo ships communicate with each other over the network. They use the Kube Proxy service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dA0D1qJnULJBCSWQzhpr5Q.png" /></figure><p>Kube Proxy is a network proxy running on each node that manages all the necessary network rules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_6MvB2Pb6Bvd68IV_tlp_Q.png" /></figure><p>These rules enable network communication to your pods from both inside and outside the cluster. It basically handles all the complex routing making the whole Kubernetes service concept actually work without you having to configure routing tables manually on every single machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGULadrTwTmypUpxWFdMzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BZMC2ge0CD5lLqYcM_iGLw.png" /></figure><p>You might be wondering what exactly a pod is and why it is so important. A pod is the smallest deployable unit you can possibly create and manage in Kubernetes. It is the atomic unit of scheduling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*setA3uvt1vtX-TZ1K17Lww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ygI_W-V3ySV1M1FCelAyyA.png" /></figure><p>When you tell the master node to run something you do not ask it to run a container. You ask it to run a pod. A pod represents a single running process in your cluster and it can hold one or more containers inside it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-qKnQubZ2MO9P8PGIScEGg.png" /></figure><p>Now a lot of developers ask a very valid question here. They look at this and say why do we even need this extra layer. Why can we not just deploy a basic raw Docker container directly onto the worker node. Why did the engineers invent this whole pod concept.</p><p>To understand this you need to think of a pod as a special house. We can call it a pod house.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s1aBlrsnrRUxpe9Xs-oD5Q.png" /></figure><p>If you just deploy a raw Docker container it is completely isolated. But in modern architecture your main application often needs sidekick processes to function properly. You might have your main program container but you also need a proxy container to handle network traffic or a log container to collect error messages or a helper container to sync files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XWmWv-1BhpK-7ubBvrNwfg.png" /></figure><p>If these were just separate standard containers scattered on a massive server they would have a hard time finding each other and sharing resources securely. But when you put them together inside the same pod house magical things happen. First of all they get a shared network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dlnb8sZjAVoLewxRgp0fJQ.png" /></figure><p>Because they are in the same pod they literally share the exact same network namespace and IP address. This means they are speaking the exact same language. They can communicate with each other simply by using localhost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wnYYP0SH3WGxQLaNE8M_Pw.png" /></figure><p>They just use different ports to talk to one another. It is incredibly fast and efficient. Second they get shared space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oh02J3pviBntSmU0DgxLnQ.png" /></figure><p>They can mount the exact same storage volumes. So your main application can write a log file to a folder and your helper container can instantly read that exact same file and send it to your monitoring dashboard. The pod creates this perfect cooperative environment for containers that need to be tightly coupled.</p><p>But a pod is not immortal. It has a very specific lifecycle from the moment you create it until it dies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hSpGSa7IqFkuiyX09UNF4w.png" /></figure><p>When you first tell the API server to create a pod it enters a pending state while the scheduler looks for a good worker node. Once it is assigned and the containers start it moves to a running state. Eventually it will either finish its job and reach a succeeded state or something will break and it will hit a failed state.</p><p>To create a pod you do not click buttons in a user interface. You write a configuration file called a manifest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0BVi2WLi4eKUFMWpMtKcHA.png" /></figure><p>This manifest is usually a simple YAML file. You tell it the api version the kind of resource which is Pod in this case and give it metadata like a name. Then in the spec section you define exactly which containers you want inside this pod and what container ports they should expose. You hand this file to the API server and Kubernetes builds the exact house you asked for.</p><p>So running one pod is great. But what happens when your application goes viral.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gC9KKR5bkLRfFRt8cAE-BA.png" /></figure><p>What if you suddenly need one hundred identical pods running at the same time. What if one of those pods randomly crashes at 3 AM. Or what if you need to update the application image inside all one hundred pods without causing any downtime. You absolutely cannot sit there and manage them one by one. That would defeat the entire purpose of automation.</p><p>This is where we introduce the ReplicaSet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OvG29JxogBRhRrF5DL0JJQ.png" /></figure><p>The sole purpose of a ReplicaSet is to maintain a stable set of replica pods running at any given time. It acts like a strict manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1oVjNxfrA5q6tGj7qgMp4A.png" /></figure><p>If you define a ReplicaSet and scream give me exactly 3 pods it will constantly monitor the cluster to guarantee the availability of those 3 identical pods. If one pod accidentally dies the ReplicaSet instantly notices the count dropped to 2 and it immediately spins up a brand new pod to replace the dead one.</p><p>But we can evolve even further. Managing ReplicaSets directly is a bit outdated because we have an even bigger boss now. We call it a Deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cr6Tc_g5G-WcNi6yV18YYA.png" /></figure><p>A deployment is a higher level concept that manages both pods and replicasets for you. It allows you to describe the ultimate desired state for your application. The true power of a deployment is that it automates updates scaling and rollbacks in a completely controlled way. It ensures your application is always running exactly as you intended even when you are pushing massive version changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xix-bnpDShVoeYd_jxqMxw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4befgyd8j8g7tGywVlwDUg.png" /></figure><p>When you are ready to release a brand new version of your application a deployment performs what we call a rolling update.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YnfpU-6TFTGaoMgb5JN0yg.png" /></figure><p>Let us say you are moving from version 1 to version 2 and eventually to version 3. If you just killed all your old pods at once your users would experience a massive outage. Instead a deployment creates a new pod with version 2 waits for it to become completely healthy and then gracefully shuts down one of the old version 1 pods. It repeats this process one by one until your entire application is updated. If something goes terribly wrong with the new code you can just tell the deployment to roll back and it will automatically revert to the previous stable state. It is pure magic for developers.</p><p>But there is one final piece to this massive architectural puzzle. We already established that pods are completely mortal. They die they get replaced and when they do their IP addresses change constantly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ThJsOtE47upMSdfQ3npJ2w.png" /></figure><p>So think about this problem. If your backend database pod crashes and gets replaced with a brand new pod it will inevitably have a brand new IP address. How does your frontend web server consistently find that backend database if the address keeps changing every single day.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*StdB85xvadiBzWPAvV_zhA.png" /></figure><p>This is exactly why you use a Service. A service provides a stable permanent IP address and a reliable DNS name for a specific group of pods. It basically acts as an internal load balancer. Instead of your frontend trying to memorize the individual IP addresses of your backend pods it just sends traffic directly to the backend service. The service then routes that traffic to the correct healthy pods automatically. This allows all your different application components to communicate reliably even if the underlying pod IPs are changing a hundred times a day.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGULadrTwTmypUpxWFdMzg.png" /></figure><p>All of this theory is amazing but nothing beats seeing it run on your own machine. In my original presentation I did a live demo to prove that this architecture is not just a fairy tale.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lM8El_qGkOtTEf4FJjkbOQ.png" /></figure><p>If you want to practice all of this yourself I highly recommend installing minikube. It is a fantastic lightweight tool that lets you run a complete single node Kubernetes cluster right on your local laptop. You can create deployments break them fix them and learn the entire system without spending a single dollar on expensive cloud servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U8jEwqHkLxhZA8jpse7Dmw.png" /></figure><p>We covered an insane amount of ground today. We went from the absolute dark ages of bare metal servers to the futuristic automated world of Kubernetes container orchestration. It might seem overwhelming at first but once you understand the cargo ship analogy everything just clicks into place.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGULadrTwTmypUpxWFdMzg.png" /></figure><p>I want to give a massive thank you to everyone who stuck around for this deep dive. Also a big shoutout to the UN SDG AI Lab for hosting the original presentation that inspired this guide.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zr3bP-4kX9FJH6B_UoVzSw.png" /></figure><p>If you want to talk about tech complain about buggy code or just connect with me you can find me on social media. You can also shoot me an email or visit my personal website to see what else I am working on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ctHEE0LdPFhPytuDUMicw.png" /></figure><p>Thank you so much for reading and I will catch you all in the next article. Bye for now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*zkm5tTn99TJp9HlgDA-BrA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8m1dtupsS34qZOtyWFPa8g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f62222ef4764" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Golang Design Patterns: Behavioral Patterns]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@cemakan/golang-design-patterns-part-3-behavioral-patterns-3d4cf05299ab?source=rss-a57043ed214a------2"><img src="https://cdn-images-1.medium.com/max/1920/1*bQ1Zha0WjZc6DruVGuyx4w.jpeg" width="1920"></a></p><p class="medium-feed-snippet">Welcome back, Gophers &#x2764;. If you&#x2019;ve followed along from our previous dives, you know that building a system isn&#x2019;t just about spawning&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@cemakan/golang-design-patterns-part-3-behavioral-patterns-3d4cf05299ab?source=rss-a57043ed214a------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@cemakan/golang-design-patterns-part-3-behavioral-patterns-3d4cf05299ab?source=rss-a57043ed214a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d4cf05299ab</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[behavioral-patterns]]></category>
            <category><![CDATA[design-patterns]]></category>
            <dc:creator><![CDATA[Cem Akan]]></dc:creator>
            <pubDate>Sun, 21 Dec 2025 02:48:47 GMT</pubDate>
            <atom:updated>2026-05-29T19:48:19.146Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Golang Design Patterns: Structural Patterns]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@cemakan/golang-design-patterns-part-2-structural-patterns-fa24c4ba6b63?source=rss-a57043ed214a------2"><img src="https://cdn-images-1.medium.com/max/1920/1*Z-26b_3sB3wNjr1SD73-vg.jpeg" width="1920"></a></p><p class="medium-feed-snippet">Organize, Connect, Scale: A Deep Dive into Structural Design</p><p class="medium-feed-link"><a href="https://medium.com/@cemakan/golang-design-patterns-part-2-structural-patterns-fa24c4ba6b63?source=rss-a57043ed214a------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@cemakan/golang-design-patterns-part-2-structural-patterns-fa24c4ba6b63?source=rss-a57043ed214a------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa24c4ba6b63</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[structural-design-pattern]]></category>
            <dc:creator><![CDATA[Cem Akan]]></dc:creator>
            <pubDate>Sat, 20 Dec 2025 04:20:50 GMT</pubDate>
            <atom:updated>2026-05-29T19:46:01.230Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Golang Design Patterns: Creational Patterns]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@cemakan/golang-design-patterns-part-1-creational-patterns-4d9b31fab5d5?source=rss-a57043ed214a------2"><img src="https://cdn-images-1.medium.com/max/1920/1*GYG-45XT-_ZwpwNK51D9cg.jpeg" width="1920"></a></p><p class="medium-feed-snippet">Hello, Go enthusiasts. Welcome to the first installment of our deep dive into Golang Design Patterns</p><p class="medium-feed-link"><a href="https://medium.com/@cemakan/golang-design-patterns-part-1-creational-patterns-4d9b31fab5d5?source=rss-a57043ed214a------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@cemakan/golang-design-patterns-part-1-creational-patterns-4d9b31fab5d5?source=rss-a57043ed214a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d9b31fab5d5</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[creational-patterns]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Cem Akan]]></dc:creator>
            <pubDate>Sat, 11 Oct 2025 11:15:22 GMT</pubDate>
            <atom:updated>2026-05-29T19:43:40.249Z</atom:updated>
        </item>
    </channel>
</rss>