<?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 Omer Goren on Medium]]></title>
        <description><![CDATA[Stories by Omer Goren on Medium]]></description>
        <link>https://medium.com/@omergrn?source=rss-47f8bc74af75------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Dy6WK2G7oKbQdXRD_Nt2cQ@2x.jpeg</url>
            <title>Stories by Omer Goren on Medium</title>
            <link>https://medium.com/@omergrn?source=rss-47f8bc74af75------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 11:59:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@omergrn/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[Chaos Engineering: Why Your Lab Rat Won’t Survive the Street]]></title>
            <link>https://medium.com/@omergrn/chaos-engineering-why-your-lab-rat-wont-survive-the-street-b1e702611a44?source=rss-47f8bc74af75------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1e702611a44</guid>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[game-day]]></category>
            <category><![CDATA[failover]]></category>
            <category><![CDATA[chaos-engineering]]></category>
            <category><![CDATA[cascading-failure]]></category>
            <dc:creator><![CDATA[Omer Goren]]></dc:creator>
            <pubDate>Wed, 01 Apr 2026 12:03:23 GMT</pubDate>
            <atom:updated>2026-04-01T12:03:23.681Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Tl-PI4jW4YmZJgMAXuDHw.png" /></figure><p>Look we’ve all been into place, where it’s 3 AM on a weekday. We’re sitting in a dark killing the pods and dropping packets and stressing our cpus. On the screen we can see dashboards going red and back to green status. We tell our stakeholders we’re good and go to sleep. What a delusion.</p><p>Because real life doesn’t care about your 3 AM lab tests what it cares about 2 pm on a tuesday when your campaign goes live and your db decides to take a nap for 2 seconds.</p><p>Then, all at once, the platform we believed to be strong is not only not working, but it is destroying itself.<br>Your oncall engineers check the metrics, sweats and informs you that they have load-tested 2x of this traffic, They have chaos-tested. So why is everything melting?</p><p>The why? You tested failures in an idealized environment you have made but the real world does not fail in a predictable manner. Failure is not clean in the real world, it occurs at peak load, and it causes your safety mechanisms to become suicidal elements.</p><p>Let us discuss some of the situations we have observed occur in high scale environment that we were unprepared in our lab and learned the lesson the hard way.</p><h3>1. The Fallacy of Failover: Is One Region Enough?</h3><p>We believe we have our secondary region as an insurance to us in case of failures.</p><blockquote>“If Region-X has a bad day, we just flip the switch to Region-Y.”<em> It sounds so simple right?. But capacity isn’t a static number; it’s a moving target.</em></blockquote><h3>Scenario: Region-A vs. Region-B</h3><p>Our SRE on-call notices availability drop and error rate increase in the Region — A. The Incident Commander makes the decision to pull the trigger Full Failover, and he is sure about it due to a recent chaos test<strong>.</strong> We route 100% of the traffic to Region — Y<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*TJePc31FY0538ok8-Nj8Xw.png" /></figure><h4>The Flaw</h4><p>The chaos tests were always done ate the quites times of the Thursday morning. Company has got a campaign today and traffic is up 40<strong>%</strong>. We assumed Region — Y had sufficient headroom since it <em>did</em> last Thursday. It’s already operating 70 percent capacity today only on its own services.</p><h4>The Result: Moving the Fire</h4><p>When you switch to the second region, Region —Y gets hit with a traffic it wasn’t designed to carry. You see control plane beginning to choke as it attempts to spin up new replicas, but again it’s too late the nodes are already at 100 percent cpu. Rather than failover, you just initiated regional blackout. We didn’t only pass the traffic but moved the fire into a room full of cotton and locked the door.</p><h3>2. The Walking Dead Pods: The Liveness Probe Suicide Pact</h3><p>We are all obsessed with throughput don’t we? We ask ourselves “can we push 2.5 million req a minute?” and if the load test it says cheers, but we almost never test for entropy the slow degradation of database.</p><h4>The Flaw: The Liveness Probe Trap</h4><p>It usually starts with a dev who actually cares about reliability. They think, <em>“If pod can’t talk to the db, it’s useless”</em> So they point Liveness Probe to database health check. It looks like the responsible thing to do.</p><p><strong>The Reality:</strong> What really happens is when your database slows down to a 2-second response time. But your Liveness Probe has a trigger 1-second timeout. Kubernetes doesn’t care about “why”it only sees a pod that isn’t responding fast enough assumes it’s dead and executes it.</p><p>The Death Loop</p><p>This creates a Cascading Failure:</p><ol><li><strong>The Worker Shortage:</strong> K8s kills the “unhealthy” pods. Now less pods need to handle the same 2.5 million RPM.</li><li><strong>The Cooked Pods:</strong> The remaining pods are hit with 2x the traffic. Their CPU spikes, they slow down more and their own liveness probes fail.</li><li><strong>The Zombie Apocalypse:</strong> New pods spin up to “save” the day but they immediately hit the slow DB, fail their liveness check, and restart before they ever process a single request.</li></ol><p>Your “Health Checks” have become a suicide pact. You’re not just experiencing chaos you’re a spectator at your own system’s funeral.</p><h4>The Recovery: The “Big Red Button ” for Traffic Switch</h4><p>When you are in this <strong>Death Loop</strong>, standard auto-scaling is useless. It’s like trying to rebuild a house while a hurricane is still standing in your living room. You need to break the pattern.</p><h4>Step 1: Stop the Hurricane (Isolation)</h4><p>You cannot fix a cascading failure while the traffic is still hitting the broken pods. You must <strong>isolate one DC entirely.</strong></p><p>Cut the traffic at the Load Balancer level for DC-A.</p><ul><li>Once the environment is “quiet,” the pods can finally finish their readiness checks and actually start up without being punched in the face by 1 million requests.</li></ul><h4>Step 2: The “Breath” Room (Over-Provisioning)</h4><p>Before re-opening the gates, you must scale with <strong>ridiculous</strong> CPU and Memory limits. You aren’t scaling for “normal” traffic anymore but you’re scaling to handle the massive backlog you have that built up during the outage. Give them room to breathe.</p><h4>Step 3: The Rolling Re-entry</h4><p>Once DC-A is stable and “fat” with resources, slowly shift 10% of the traffic back. If it holds, move to 25%. Only when it’s rock-solid do you repeat the process for the other DC.</p><h4>Conclusion: Stop Testing in a Vacuum</h4><p>If your Chaos tests only involve killing a pod when the DB is fast and the traffic is low, you aren’t testing reality. You’re just rehearsing a play that will never be performed.</p><p>To build a truly resilient system, stop asking “Is it up?” and start asking:</p><ul><li><strong>What happens when the DB is 10x slower?</strong></li><li><strong>Is our Liveness probe a suicide switch?</strong></li><li><strong>Do we have a mechanism to stop the traffic and recover in a clean room?</strong></li></ul><p>Until you test the <strong>Slow Death</strong>, the <strong>Restart Loop</strong>, and the <strong>Manual Isolation</strong>, you aren’t <strong>resilient as much as you think</strong> .</p><h4>❌ The “Suicide Pact” Pattern (The Wrong Way)</h4><p>In this scenario, if the database is slow, the Liveness probe fails. Kubernetes kills the pod, which is exactly the opposite of what we want when a system is struggling with high load.</p><pre>livenessProbe:<br>  httpGet:<br>    path: /health  # This endpoint checks DB connection<br>    port: 8080<br>  initialDelaySeconds: 5<br>  periodSeconds: 10<br>  timeoutSeconds: 1   # If DB takes 1.1s, this pod dies.</pre><h4>✅ The “Resilient” Pattern (The Right Way)</h4><p>Here, the <strong>Liveness</strong> probe only checks if the app is alive. The <strong>Readiness</strong> probe checks the DB; if it fails, the pod is simply removed from the Load Balancer (stopping traffic) but stays alive to finish its work and recover.</p><pre># 1. Liveness: Is the process &quot;stuck&quot;?<br>livenessProbe:<br>  httpGet:<br>    path: /ping    # Just returns &quot;pong&quot; (checks process only)<br>    port: 8080<br>  periodSeconds: 20</pre><pre># 2. Readiness: Is the app ready to handle traffic?<br>readinessProbe:<br>  httpGet:<br>    path: /health  # This checks DB/cache dependencies<br>    port: 8080<br>  periodSeconds: 5<br>  failureThreshold: 3</pre><h3>The Human Element: The “Game Day” Mindset</h3><p>You can have the best automation in the world, but if your team’s first reaction to a chaos test is panic, your system isn’t resilient — it’s fragile.</p><h4>The “Tuesday at 2:00 PM” Challenge</h4><p>Real incidents don’t schedule themselves for 3:00 AM when only one sleepy SRE is watching. They hit when the product manager is breathing down your neck, the marketing campaign is live, and the whole team is in meetings.</p><p><strong>If your team is afraid to run a chaos experiment during business hours, that fear is your biggest technical debt.</strong></p><h4>Why Run “Game Days”?</h4><ul><li><strong>Muscle Memory:</strong> Incident response shouldn’t require looking up a runbook for the first time. It should be second nature.</li><li><strong>Socializing Failure:</strong> It moves the culture from “Who broke it?” to “How does it break?”</li><li><strong>Testing the “Human” Circuit Breakers:</strong> Can the Junior Dev on-call identify the cascading failure? Do they have the authority to “Stop the Hurricane” without three layers of management approval?</li></ul><blockquote><em>Start small. If you can’t survive a single pod failure on a Tuesday, you definitely aren’t ready to test a regional failover. Build muscle memory before you try to hit heavy weight.</em></blockquote><h3>🛡️ The “Is My System a Suicide Pact?” Checklist</h3><ul><li>[ ] Does my Liveness Probe depend on a downstream service (DB, API)?</li><li>[ ] Have I tested a DC Failover when the target DC is already at 70% load?</li><li>[ ] Does my Retry Logic have an exponential backoff, or is it a DDoS tool?</li><li>[ ] Do I have a documented way to “Stop the Hurricane” (Isolate traffic)?</li><li>[ ] Does my retry logic use <strong>Exponential Backoff + Jitter</strong>, or does it hammer the API all at once?</li><li>[ ] Are my regional configurations (DB connections, thread pools, memory limits) enforced by Code (IaC), or is there “Manual Drift”?</li><li>[ ] Do I have a Circuit Breaker pattern to stop “Retry Storms” before they reach the database?</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1e702611a44" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond the Fifth Why: How Complex Systems Fail (And Ho to Fix Them)]]></title>
            <link>https://medium.com/@omergrn/beyond-the-fifth-why-how-complex-systems-fail-and-ho-to-fix-them-aed1d9086643?source=rss-47f8bc74af75------2</link>
            <guid isPermaLink="false">https://medium.com/p/aed1d9086643</guid>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[postmortem]]></category>
            <category><![CDATA[systems-thinking]]></category>
            <category><![CDATA[resilience-engineering]]></category>
            <category><![CDATA[stamp]]></category>
            <dc:creator><![CDATA[Omer Goren]]></dc:creator>
            <pubDate>Mon, 22 Dec 2025 08:30:05 GMT</pubDate>
            <atom:updated>2025-12-22T08:42:19.830Z</atom:updated>
            <content:encoded><![CDATA[<h3>Beyond the Fifth Why: <strong><em>How Complex Systems Fail (And How to Fix Them)</em></strong></h3><p>We’ve all been there: sitting in the war room after an incident occurs and now it’s time to find the root cause, What do we do? Of course we reach for our most familiar tool:<br><strong>The 5 Whys</strong>.</p><ul><li><strong>Why did the service go down?</strong> Because the database was overloaded.</li><li><strong>Why was db overloaded?</strong> There was a bad query in new release.</li><li><strong>Why was this new version released?</strong> The developer didn’t test it in stage env.</li><li><strong>Why didn’t they test it in stage env?</strong> The stage env was broken.</li><li><strong>Why was it broken?</strong> …and so on.</li></ul><p>The problem?<br> This assumes that there is a straight path in our system which would lead to a single broken component or person. But in today’s modern distributed systems, this is really oversimplification. As systems becomes more and more complex accidents are rarely caused by a single failure. Instead, they are caused by the <strong>unsafe interactions</strong> between components which are mostly working exactly as they were designed to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BoLD1pDuDEUtHgBxN9PnMg.png" /></figure><h3>The Anatomy of a System Failure</h3><p>According to <a href="https://medium.com/r?url=https%3A%2F%2Fpsas.scripts.mit.edu%2Fhome%2Fwp-content%2Fuploads%2F2014%2F03%2FSystems-Theoretic-Process-Analysis-STPA-v9-v2-san.pdf">Research</a> by MIT, we need to quit searching a root cause and begin searching the system as Control Loop. When a system collapses it is normally due to a loss of control. Control breakdowns happens in four distinct areas as per the STAMP (Systems-Theoretic Accident Model and Processes) framework as:</p><ol><li><strong>Inadequate Control Algorithm:</strong> The logic itself is problematic. The code does exactly what it was told to do, but what it was told to do was not safe in that particular situation?</li><li><strong>Inconsistent Process Model:</strong> The most widespread hidden threat is this one. The controller (whether it’s a human operator or an automated script) is having the incorrect “map” of the system. It believes the system is in State A, so it issues a command, but the system is actually in State B.</li><li><strong>Inadequate Feedback:</strong> The lying sensors. when the feedback is incomplete, slow, or corrupted, this causes controller to make decisions based on the out-dated or incorrect information.</li><li><strong>External Disturbances:</strong> The system is hit by external factors like a massive spike in traffic or a regional cloud outage that the controller was never designed to handle.</li></ol><p>In order to have a better understanding in those topics let’s imagine a high-demand product such as a new gaming console goes live in our e-commerce platform. To manage the load, there is an <strong>Automated Inventory Controller</strong> designed to avoid overselling.</p><h4>1. Inadequate Control Algorithm</h4><p><strong>The Scenario:</strong> The developer introduces a “Retry-on-Failure” logic for the checkout service. If the Payment Gateway is slow, the system automatically retries the transaction after every 2 seconds so that the users don’t lose their spot.</p><ul><li><strong>The Flaw:</strong> When doing a huge flash sale, the Payment Gateway might slow down because of the volume. The “Reliable” retry logic comes into display for 100,000 users.</li><li><strong>The Result:</strong> The code actually performs the task it was told to do (retry), however, in this specific context, it creates a <strong>“Retry Storm”</strong> (a <a href="https://cloud.google.com/blog/products/gcp/how-to-avoid-a-self-inflicted-ddos-attack-cre-life-lessons">self-inflicted DDoS attack</a>) that entirely crashes the payment service. The algorithm was “correct” for a single user, but “unsafe” for the system at scale.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WJLj642g7nA2J1wi-S_3nQ.png" /></figure><h4>2. Inconsistent Process Model</h4><p><strong>The Scenario:</strong> To make our website fast, the <strong>Frontend Controller</strong> uses a “Process Model” that assumes the <strong>Inventory Database</strong> is our source of truth. It checks a cached value: In_Stock = True.</p><ul><li><strong>The Flaw:</strong> A “Race Condition” occurs. Two different fulfillment centers sell the last unit at the exact same millisecond. The Database updates to In_Stock = False, but the Frontend Controller’s &quot;Process Model&quot; is not yet updated.</li><li><strong>The Result:</strong> The Controller <em>thinks</em> the system is in “State: Available” when it is actually in “State: Out of Stock.” It continues to issue “Accept Order” commands. The “map” in the controller’s head no longer matches the “terrain” of the database, leading to thousands of angry customers receiving “Order Cancelled” emails an hour later.</li></ul><h4>3. Inadequate Feedback</h4><p><strong>The Scenario:</strong> The <strong>Auto-Scaling Group</strong> monitors the health of the web servers. It is based on a Health Check (Feedback) signal from each server.</p><ul><li><strong>The Flaw:</strong> A certain bug causes the a node/web server to enter a “Zombie State” the CPU is busy at 100 percent, the kernel logs are full of errors and they are not able to process requests, but the “Health Check” endpoint (a simple /health ping) is still returning HTTP 200 OK response because it runs on a separate thread on server.</li><li><strong>The Result:</strong> The feedback “sensors” are lying. The Auto-Scaler receives “Healthy” feedback and it decides not to spin up new servers even though the site is effectively down for users. The controller had the wrong decision because the feedback was corrupted (incomplete).</li></ul><h4>4. External Disturbances</h4><p><strong>The Scenario:</strong> The system is supposed to process 1 million requests per second. A “Botnet” or a huge “Influencer ” shares a link of product in their IG account and directs 10 million users to a single product page.</p><ul><li><strong>The Flaw:</strong> This is an “Out-of-Range Disturbance.” Our system is functioning correctly (they are running without errors), but the environment has changed too drastically and too quickly. The traffic load has exceeded the physical constraints our controllers were designed to manage.</li><li><strong>The Result:</strong> It is an out-of-range disturbance. The control logic of the Load Balancer was not intended to deal with that particular environmental condition.The system doesn’t fail because of a bug but it fails because the environment pushed the system into a state where the existing controllers had no authority or capability to maintain balance.</li></ul><h3>Moving Toward a Solution: The STPA Approach</h3><p><strong>STPA (Systems Theoretic Process Analysis)</strong> is a rigorous method invented at <strong>MIT</strong> to recognize these flaws we have mentioned previously before they bring our production environment down. Rather than searching a failure, <strong>STPA</strong> determines <strong>Unsafe Control Actions</strong> <strong>(UCAs)</strong>.</p><p>MIT suggests using a <strong>Control Loop Diagram</strong> to systematically identify flaws. Unlike the 5 Whys, which looks backward at a chain of events, STPA examines the Control Structure and makes us ask four questions about each command:</p><ul><li>What happens if we <strong>don’t provide</strong> a command?</li><li>What if we provide an <strong>unsafe</strong> command?</li><li>What if a command comes <strong>too late</strong> or <strong>too early</strong>?</li><li>What if we stop a command <strong>too soon</strong>?</li></ul><p>So you may be wondering then should we not consider <strong>Reliability</strong> and <strong>Safety</strong> as one? No you shouldn’t. Indeed, some of the most devastating system failures happen when every single component is working exactly as it was designed to. To understand why, let’s have a look at a our example.</p><h3>The Reliable Butter Knife (Reliability vs. Safety)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aZNliqDfC4TblyQTE6b-sQ.png" /></figure><ul><li><strong>The Component (The Knife):</strong> It is 100% reliable. It is made of metal, it is strong, and it works its functions of a knife in an excellent manner, It has not failed.</li><li><strong>The System (The User + The Knife + The Outlet):</strong> Imagine a “<strong>reliably curious</strong>” human takes that perfectly functioning knife and puts it into high-voltage power outlet and thrusts it in.</li><li>The result? system failure and ticket to hospital. However, <strong>nothing broke.</strong> The knife was a great knife; the outlet provided power exactly as intended. The accident happened because of an <strong>unsafe interaction</strong> between reliable components.</li></ul><p><em>Important lesson to take from here you can have “</em><strong><em>five-nines</em></strong><em>” reliability on every single microservice you have and yet the entire system might fail. Reliability is about individual parts; </em><strong><em>Safety</em></strong><em> is about how those parts are controlled and how they interact.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*_EeMWbdEzx41zDSpcHMFeA.png" /></figure><h3>Conclusion</h3><p>If we only use the 5 Whys, we end up fixing “broken” parts. We add a retry, we update a library, or we tell a developer to be more careful. However when the issue lies in the design of the control loop, those “fixes” are just Band-Aids.</p><p>To build truly resilient systems which are indeed resilient, we must move beyond the “Fifth Why.” We must start mapping our control structures, verifying our feedback loops, and ensuring that our controllers whether human or code truly understand the state of the world they are trying to manage.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aed1d9086643" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[İşletmenizin Kritik Kullanıcı Akışlarını 5 Dakikada Keşfedin]]></title>
            <link>https://medium.com/goturkiye/i%CC%87%C5%9Fletmenizin-kalp-at%C4%B1%C5%9F%C4%B1n%C4%B1-5-dakikada-bulmak-a88fc18bf5cd?source=rss-47f8bc74af75------2</link>
            <guid isPermaLink="false">https://medium.com/p/a88fc18bf5cd</guid>
            <category><![CDATA[reliability]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[availability]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[sre]]></category>
            <dc:creator><![CDATA[Omer Goren]]></dc:creator>
            <pubDate>Wed, 01 Oct 2025 18:49:29 GMT</pubDate>
            <atom:updated>2025-10-01T19:25:06.499Z</atom:updated>
            <content:encoded><![CDATA[<p>Eğer CEO’nuz şu anda masanıza gelse ve “Ürünlerimiz tüm müşterilerimiz için sağlıklı çalışıyor mu?” diye sorsa, 30 saniyeden kısa bir sürede kendinizden emin bir şekilde cevap verebilir misiniz?</p><p>CPU veya Memory istatistikleri ya da API hata oranları ile değil de, müşterilerimizin en önemli hedeflerine ulaştıklarına dair gerçek bir kanıtla.</p><p>Birçok takım lideri ve developer için cevap “hayır” olabilir. Genellikle o kadar çok teknik gürültüye gömülürüz ki, bu teknik gürültü asıl müşteri deneyimini gözden kaçırmamıza sebep olur.</p><p>Odağımızı sayısız low level metrikten, işletmemizin kalp atışını oluşturan etkileşimlere kaydırmamız gerekiyor. Bu etkileşimlere <strong>Critical User Flows (Kritik Kullanıcı Akışları)</strong> diyoruz.</p><h3>Critical User Flow Nedir?</h3><p>Bir Critical User Flow, kullanıcılarınıza verdiğiniz temel bir sözü temsil eden, eksiksiz ve üst düzey bir etkileşimdir. Tek bir endpoint, cronjob, teknik bir süreç veya tek bir düğme tıklaması değildir. Bu, baştan sona tüm kullanıcı deneyimidir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AJ4iFCeTlIvlIbc7eYvv4w.png" /></figure><p>Örnekler:</p><ul><li><strong>Place Order (</strong>Sipariş Ver)</li><li>Ödeme veritabanında bir satırı güncellemek</li><li><strong>Track a Shipment (</strong>Gönderiyi Takip Et)</li><li>Webhook üzerinden istek almak</li></ul><p>Yukarıdakilerden hangisi size bir Critical User Flow gibi görünüyor?</p><p>👉 <strong>Place Order (</strong>Sipariş Ver) bir Critical User Flow’dur.<br> ❌ Ödeme veritabanında bir satırı güncellemek değildir.<br> 👉 <strong>Track a Shipment (</strong>Gönderiyi Takip Et) bir Critical User Flow’dur.<br> ❌ Webhook üzerinden istek almak değildir.</p><p>Bu akışlar ürünlerimizin var olma sebebidir. Sunduğumuz temel değerlerdir ve onların sağlığını işletmemizin sağlığının doğrudan bir ölçüsü olarak düşünebiliriz.</p><h3>Gerçekten Önemli Olanı Belirlemek İçin 4 Adımlı Framework</h3><p>Hayati olan azınlığı önemsiz çoğunluktan ayırmak için her potansiyel akışı bu basit dört adımlı testten geçirebilirsiniz. Gerçek bir Critical User Flow dördünü de geçmelidir.</p><h3>1. Müşteri Odaklı mı?</h3><p>Bu akış, müşterinizin veyahut iş ortağınızın birincil hedefini temsil ediyor mu? Ürünü kullanma nedenlerinin temel vaadini doğrudan karşılıyor mu?</p><p>“View Support Page” veya “Remove Saved Address” gibi eylemler genellikle ikincil özelliklerdir. Çoğu işletme için var olmalarının temel nedeni değildirler. Tabii bazı teknik B2B şirketleri için support ve documentation akışı bile ürünün kritik bir parçası olabilir.</p><p>🔎 Sormanız gereken soru:</p><ul><li>“Eğer sadece bu akış başarısız olsaydı, müşterimize verdiğimiz temel sözü bozmuş olur muyduk?”</li></ul><h3>2. Zamandan Bağımsız mı?</h3><p>Gerçek bir akış, arkasındaki teknolojiden bağımsızdır.<br>Örneğin, “Viewing a Product Page”, ister bir monolith ister binlerce microservice tarafından desteklensin, on yıllardır temel bir e-ticaret akışıdır.</p><p>🔎 Sormanız gereken soru:</p><ul><li>“Tüm teknoloji alt yapımızı değiştirsek bile, bu akış beş yıl sonra da kullanıcılarımız için hayati olmaya devam edecek mi?”</li></ul><h3>3.Ölçülebilir mi?</h3><p>Yönetilebilmesi için ölçülebilmesi gerekir.<br> Bu akışın başarı oranını, performansını (latency) ve trafiğini gerçek zamanlı olarak takip edebilmelisiniz.</p><p>👉 Unutmayın: <em>“Ölçülmesi imkânsız olan bir akış, güvenilir bir sağlık göstergesi olamaz.”</em></p><p>🔎 Sormanız gereken soru:</p><ul><li>“Şu anda, son 20 dakika içinde bu akışta kaç kullanıcının başarılı ve başarısız olduğunu sayabiliyor muyuz?”</li></ul><h3>4. Bir Sahibi Var mı?</h3><p>Hesap verebilirlik anahtardır. Herkesin sorumluluğunda olan bir akış, kimsenin sorumluluğunda değildir.</p><p>Her Critical User Flow’un, baştan sona başarısından sorumlu net bir veyahut birden fazla sahibi olmalıdır.</p><p>🔎 Sormanız gereken soru:</p><ul><li>“Bu akışın baştan sona başarısı için net ve hesap verebilir bir sahibi var mı?”</li></ul><h3>Ekstra Filtre: Kritiklik (Aciliyet)</h3><p>Bazı organizasyonlar 5. bir filtre ekleyebilir: Kritiklik.</p><p>Bir akış dört testi de geçse bile, acil değilse gerçek bir Critical User Flow olmayabilir.<br> Tüm akışlar eşit önemde olmayabilir. Bazı hatalar mesai saatlerini bekleyebilirken, diğerleri gece veya gündüz fark etmeksizin anında müdahale gerektirebilir.</p><p>Eğer bir akış bu aciliyet eşiğini karşılamıyorsa, yarın sabah deploy edeceğimiz fix ile düzeltebiliyorsak yine de izlenebilir ancak bu durumda anomaly detection veya standart alerting ile takip etmek daha uygundur.</p><h3>Örnek Test: Track Order</h3><p>Müşteri Odaklı mı<strong>?</strong> ✅ Evet. “Where is my package?” sorusuna yanıt verir. Güven inşa etmek ve müşteri kaygısını azaltmak için temel bir deneyimdir.</p><p>Zamandan Bağımsız mı? ✅ Evet. Teknoloji ne kadar değişirse değişsin, teslimatın nerede olduğunu bilme ihtiyacı müşteri için hep var olacaktır.</p><p>Ölçülebilir mi? ✅ Evet. Tracking sayfası yükleme oranları, latency, taşıyıcıdan gelen bilgilerin güncelliği ölçülebilir.</p><p>Bir Sahibi Var mı? ✅ Evet. Delivery veya Fulfillment domain takımları uçtan uca başarıdan sorumlu olmalıdır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*_XVVNoEXTRYAG9GBxm7Tkw.png" /></figure><p>👉 <strong>Sonuç:</strong> Track Order kesinlikle bir Critical User Flow’dur.</p><h3>Örnek Test: Leave a Product Review</h3><p>Müşteri Odaklı mı? ✅ Evet. Güven yaratır, topluluk hissi oluşturur ve marketplace sağlığı için kritiktir.</p><p>Zamandan Bağımsız mı? ✅ Evet. Social proof ve review kavramı ticarette her zaman önemli olacaktır.</p><p>Ölçülebilir mi? ✅ Evet. Review submission başarı/başarısızlık oranı kolayca ölçülebilir.</p><p>Bir Sahibi Var mı? ✅ Evet. Customer Experience takımı uçtan uca sorumluluğu taşımalıdır.</p><p>👉 <strong>Sonuç:</strong> Leave a Product Review güçlü bir Critical User Flow’dur.</p><h3>Organizasyonu Dönüştürmek</h3><p>Critical User Flows’u tanımlamak şu etkileri yaratır:</p><ul><li><strong>Netlik &amp; Fokus:</strong> CEO’dan en yeni mühendise kadar herkes, “Track a Shipment” gibi en önemli deneyimlerin ne olduğunu bilir ve buna göre aksiyon alır.</li><li><strong>Anlamlı Alerting:</strong> Alert’ler teknik gürültüye değil, gerçek müşteri sorunlarına bağlanır. “Place Order failures spiked” → anında odaklanılır.</li><li><strong>Business &amp; Teknoloji Uyumu:</strong> Product Manager’lar ve mühendisler, aynı dili konuşarak iş önceliklerini net şekilde belirler.</li></ul><h3>Sonuç</h3><p>Artık veri içinde boğulmayı bırakıp işletmenizin kalp atışına odaklanma zamanı.</p><p>İlk adım: engineering, product ve business liderlerini bir araya getirin ve şu soruyu sorun:<br> <strong>“Müşterilerimize verdiğimiz en temel sözler nelerdir?”</strong></p><p>Burada alacağımız cevaplar sizin aday akışlarınızdır. Ardından şu basit checklist’ten geçirin:</p><ul><li>Customer-Centric mi?</li><li>Timeless mı?</li><li>Measurable mı?</li><li>Owned mu?</li></ul><p>💡 Ek bilgi: <strong>Adımları Birleştirerek, Gerçek Akışı Bulun</strong><br> Brain storm yaparken genellikle tekil adımlar listelersiniz. <br>Burada kendimize sormamız gereken şey:<br> “Bu eylem kullanıcının nihai hedefi mi, yoksa sadece oraya ulaşmak için gereken bir adım mı?”</p><p>Örneğin: Add Shipping Address veya Enter Payment Details → bunlar nihai hedef değil, tek bir gerçek akış olan <strong>Place Order</strong> içinde gerekli adımlardır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9TGAUqnCaLhM6aFBqkX9wg.png" /></figure><p>Bu konsolidasyon, gerçekten önemli akışlara odaklanmanıza yardımcı olur.</p><p>Critical User Flows’u bildiğinizde, her alert, her metric ve her roadmap kararı netleşir. İşte işletmenizin kalp atışını bu şekilde güçlü tutarsınız.</p><h3>Sırada Ne Var?</h3><p>Artık hangi akışların önemli olduğunu bildiğimize göre bir sonraki makalede, bu akışlar ile measurable hedefler (SLI, SLO ve SLA) nasıl oluşturulur, onu konuşacağız.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a88fc18bf5cd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/goturkiye/i%CC%87%C5%9Fletmenizin-kalp-at%C4%B1%C5%9F%C4%B1n%C4%B1-5-dakikada-bulmak-a88fc18bf5cd">İşletmenizin Kritik Kullanıcı Akışlarını 5 Dakikada Keşfedin</a> was originally published in <a href="https://medium.com/goturkiye">GoTurkiye</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finding Your Business’s Heartbeat — In 5 Minutes]]></title>
            <link>https://medium.com/@omergrn/finding-your-businesss-heartbeat-in-5-minutes-97beb390e898?source=rss-47f8bc74af75------2</link>
            <guid isPermaLink="false">https://medium.com/p/97beb390e898</guid>
            <category><![CDATA[reliability]]></category>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[critical-user-journey]]></category>
            <category><![CDATA[product-management]]></category>
            <dc:creator><![CDATA[Omer Goren]]></dc:creator>
            <pubDate>Wed, 01 Oct 2025 18:46:48 GMT</pubDate>
            <atom:updated>2025-10-01T18:46:48.683Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Finding Your Business’s Heartbeat — In 5 Minutes</strong></h3><p><strong>A Guide to Defining Critical User Journeys</strong></p><p>If your CEO walked up to your desk right now and asked, “Are our products healthy for all of our customers?” could you answer with confidence in under 30 seconds?<br>Not with CPU or Memory stats or API error rates, but with real proof that customers are succeeding at their most important goals.<br><strong>For many leaders, the honest answer is no. We are often so buried in technical noise that we lose sight of the actual customer experience</strong></p><p>We need to shift our focus from countless low level metrics to the interactions which form the very heartbeat of our business. We call these interactions: <strong><em>Critical User Journeys</em></strong></p><p>What is a <strong>Critical User Journey</strong>?</p><p>A Critical User Journey is a complete, high-level interaction that represents a fundamental promise you make to your users. It’s not a single endpoint, cronjob, a technical process, or an individual button click. It’s the entire, end-to-end experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AJ4iFCeTlIvlIbc7eYvv4w.png" /></figure><ul><li>Place Order</li><li>Update a row in the payments database</li><li>Track a Shipment</li><li>Receive a carrier API webhook</li></ul><p>Which one of the above seems like Critical user journey to you? <br>Is it <strong>Place Order</strong> or <strong>Receive a carrier API webhook</strong>, or can receiving a something through api could be part of bigger picture which represents our Shipment flow?</p><ul><li>Place Order is a Critical User Journey.</li><li>Update a row in the payments database is not.</li><li>Track a Shipment is a Critical User Journey.</li><li>Receive a carrier API webhook is not.</li></ul><p>These journeys are the reason our products exist.<br>They are the core values we deliver and their health is a direct measure of our business’s health.</p><p>But is there a way to identify them in a systematic way?</p><p><strong>A 4-Point Framework for What Truly Matters<br></strong>To separate the vital few from the trivial many, run each potential journey through this simple four-point test. A true Critical User Journey must pass all four.</p><ol><li><strong>Is it Customer-Centric?</strong> Does this journey represent a primary goal for your customer or partner? Does it directly fulfill the promise of why they use the product?<br>Actions like “View Support Page” or “Remove Saved Address” are typically secondary features. For most businesses, they aren’t the core, critical reason for existing <strong>though for some technical B2B companies, the support and documentation journey itself can be a critical part of the core product offering.</strong></li></ol><p>Questions to ask:</p><ul><li>“If this one journey failed, would it fundamentally break our promise to the customer?”</li></ul><p><strong>2. Is it Timeless?</strong> A true journey is independent of the technology behind it. “Viewing a Product Page” has been a core e-commerce journey for decades, whether it was powered by a monolith or a thousand microservices.</p><p>Questions to ask:</p><ul><li>“Will this journey still be essential to our users in five years, even if we completely change our tech stack?”</li></ul><p><strong>3. Is it Measurable?</strong> To be managed, it must be measured. You need to be able to track the success rate , performance (latency), and traffic of this journey in real-time.<br>Don’t forget “<strong>A journey that is impossible to measure cannot be a reliable indicator of health</strong>”.</p><p>Questions to ask:</p><ul><li>“Can we, right now, count how many users succeeded and failed at this journey in the last 20 minutes?”</li></ul><p><strong>4. Is it Owned?</strong> Accountability is key. A journey that is everyone’s responsibility is no one’s responsibility. Every Critical User Journey must have a clear executive owner who is accountable for the end-to-end success of that experience.</p><ul><li><strong>Question to ask:</strong> “Is there a clear, accountable owner for the end-to-end success of this journey?”</li></ul><p>Some organizations also add a 5th filter: <strong>Criticality (Urgency):</strong><br>Even if a journey passes all four tests, it may still not qualify as a true Critical User Journey unless it is urgent. Not all journeys are equal in importance. Some failures can wait until business hours, while others demand an immediate response, day or night.</p><p>If a journey doesn’t meet this urgency threshold, it may still be worth tracking but through anomaly detection or standard alerting, rather than being treated as a true Critical User Journey.</p><p><em>Question: Do you think </em><em>Track Order is a critical journey or not?</em></p><ul><li><strong>Customer-Centric?</strong> <strong>Yes.</strong> It directly answers the customer’s most common post-purchase question: “Where is my package?” Providing clear and accurate tracking information is fundamental to building trust and reducing customer anxiety.</li><li><strong>Timeless?</strong> <strong>Yes.</strong> The need to know the status of a delivery is a core part of commerce that will always be relevant, regardless of how technology or delivery methods evolve.</li><li><strong>Measurable?</strong> <strong>Yes.</strong> We can track the success rate of users loading the tracking page, the latency of the information displayed, and the freshness of the tracking data from carriers.</li><li><strong>Owned?</strong> <strong>Yes.</strong> A leader in the Delivery or Fulfillment domain should own the end-to-end success of this customer experience.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*_XVVNoEXTRYAG9GBxm7Tkw.png" /></figure><p><em>Our verdict is: </em><strong><em>Track Order </em></strong><em>is a definitely</em><strong><em> </em></strong><em>Critical User Journey</em><strong><em>.</em></strong><em> It is one of the most essential post-purchase experiences you can provide.</em></p><p><em>Let’s test another common journey: </em><strong><em>Leave a Product Review</em></strong><em>.</em></p><ul><li><strong>Customer-Centric?</strong> <strong>Yes.</strong> It builds trust for other shoppers, creates a sense of community, and is a key engagement feature. Its success is critical for a healthy marketplace.</li><li><strong>Timeless?</strong> <strong>Yes.</strong> The concept of user reviews and social proof will always be relevant in commerce.</li><li><strong>Measurable?</strong> <strong>Yes.</strong> We can easily track the success and failure rate of review submissions.</li><li><strong>Owned?</strong> <strong>Yes.</strong> A leader in the Customer Experience or Community domain should own this end-to-end journey.</li></ul><p><strong><em>Verdict:</em></strong><em> </em><em>Leave a Product Review is a strong Critical User Journey.</em></p><p>Defining those Critical User Journeys will help you to transform how your organization operates:</p><ul><li><strong>Clarity and Focus:</strong> Everyone, from the CEO to the newest engineer, would know what the most important experiences are like “Track Shipment”.</li><li><strong>Meaningful Alerting:</strong> Alerts will be tied to real customer pain, not technical noise. An alert for “Place Order failures have spiked&quot; gets immediate, focused attention.</li><li><strong>Business &amp; Tech Alignment:</strong> Product managers and engineers finally have a shared language, which helps them to prioritize work based on its impact on the journeys that matter most.</li></ul><p><strong><em>Conclusion</em></strong><em>:<br></em>It’s time to stop drowning in data and start focusing on your business’s heartbeat. The first step is to gather your engineering, product and business leaders and ask one simple question:</p><p><strong>“What are the most fundamental promises we make to our customers?”<br></strong>The answers will be your candidate journeys. Check them with this simple checklist:</p><p>[ ] <strong>Is it Customer-Centric?</strong> (Represents a core user goal)</p><p>[ ] <strong>Is it Timeless?</strong> (Independent of current technology)</p><p>[ ] <strong>Is it Measurable?</strong> (Can be tracked in real-time)</p><p>[ ] <strong>Is it Owned?</strong> (Has a clear, accountable leader)</p><h4>A Final Tip: Merge Steps to Find the Real Journey</h4><p>When you brainstorm journeys, you’ll often list individual steps. The key is to consolidate them. Ask yourself: “Is this action a final goal for the user, or just a mandatory step to get there?”</p><p>For example, Add Shipping Address and Enter Payment Details are not final goals; they are necessary steps within the one, true journey: <strong>Place Order</strong>. This consolidation is what helps us to focus on the most critical journeys that really matter for us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9TGAUqnCaLhM6aFBqkX9wg.png" /></figure><p>When you know your Critical User Journeys, every alert, every metric and every roadmap decision gains clarity. That’s how you keep your business’s heartbeat strong.</p><p><strong><em>What’s Next?</em></strong><em> Now that you know which journeys matter, in the next article I will show you how to set measurable targets for them using </em><strong><em>SLIs, SLOs and SLAs</em></strong><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97beb390e898" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your Queries Define Your Database]]></title>
            <link>https://medium.com/goturkiye/your-queries-define-your-database-96c41d59608b?source=rss-47f8bc74af75------2</link>
            <guid isPermaLink="false">https://medium.com/p/96c41d59608b</guid>
            <category><![CDATA[write-heavy-systems]]></category>
            <category><![CDATA[query-optimization]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[read-heavy-systems]]></category>
            <dc:creator><![CDATA[Omer Goren]]></dc:creator>
            <pubDate>Wed, 04 Jun 2025 22:15:44 GMT</pubDate>
            <atom:updated>2025-06-06T09:05:53.620Z</atom:updated>
            <content:encoded><![CDATA[<p>Whether you’re launching a new product or scaling an existing one, choosing a database is one of the decision that just seems technical but defines everything.</p><h4>One piece of advice from an experienced engineer that stuck with me was:</h4><blockquote>“Choose your database based on how you want to query your data”</blockquote><p>That hit me, because it’s very true and we’ll see why it’s in this article and will provide a framework to help you guide your decisions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rmSwcmVYIkWF0GdB4c-6Gg.png" /></figure><p>Think about building a feature that needs to pull data from users, orders, products, and maybe even more sources all at once. Without proper JOINs, you’ll end up making five separate queries and stitching the results together in your code. That’s when it hits you: the database should be doing this, not me.</p><p>So, how many relationships are involved? How complex are the joins?<br>Your query structure directly shapes how data must be stored, indexed, and validated.</p><p>The nature of your queries whether they’re simple lookups or complex joins plays a crucial role in the database you choose.</p><p><strong>Relational Databases</strong> (e.g., PostgreSQL, MySQL) are great for structured data with rich relationships.</p><p>Relational systems aren’t just about structure they’ve also got your back with ACID guarantees. That means every transaction is Atomic, always Consistent, Isolated from others and Durable even if your system crashes. If you’re working in a domain where one wrong number can break trust<br>like finance, billing, or inventory this level of reliability isn’t a luxury, it’s a requirement.</p><p>Use them when:</p><ul><li>You need <strong>JOINs</strong> across multiple tables.</li><li>Your data integrity requires <strong>transactions</strong>.</li><li>You’re performing <strong>complex analytics </strong>or<strong> reporting</strong>.</li></ul><p><strong>NoSQL Databases (e.g., Redis, MongoDB, Couchbase)</strong> are optimized for speed and scale in less structured environments</p><p><strong>NoSQL</strong> systems usually live in the world of trade-offs, and that’s where the <strong>CAP theorem</strong> comes in. It says you can only pick two: Consistency, Availability or Partition Tolerance. Most NoSQL databases lean into Availability and Partition Tolerance, letting go of immediate consistency for better uptime and global scale. That’s why your social feed loads lightning fast even if a like shows up a few seconds late.</p><ul><li>Best for flat or nested JSON-like documents.</li><li>Avoid JOINs; denormalization is encouraged.</li><li>Great for rapid development when schema evolves frequently.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z94UR2d59GY_XdKn52Bslg.png" /></figure><p>Before choosing your database, ask yourself:<br><strong>How often is your system going to query the data?</strong><br><strong>And is it mostly reading or writing?<br></strong>These two questions can change how you’re gonna architect your system.<br>For instance are you updating your dashboards every few seconds? Or streaming thousands of user events every second? The frequency and type of access, read or writes will dictate how your database should be tuned. <br>Some systems stress the database with heavy and concurrent reads Others might bombard it with constant inserts and updates <br>Let’s check both cases:</p><h3>Read-Heavy Systems</h3><p>When your application reads a lot more than it writes, your primary bottleneck is serving data fast and often. In these systems, performance is all about low latency, smart caching and smart indexing</p><h4>E-commerce Product Catalogs</h4><p>Customers constantly browse products, but the data changes infrequently.</p><ul><li><strong>Key concern:</strong> Can the DB serve high-concurrency reads?</li><li>Use <strong>read replicas</strong> and <strong>caching</strong> for fast response.</li><li><em>(e.g., PostgreSQL + replicas, Redis)</em></li></ul><h4>Search Interfaces</h4><p>Search must be fast, fuzzy, and scalable all in milliseconds.</p><ul><li><strong>Key concern:</strong> Can the system support full-text search and filtering efficiently?</li><li>Look for <strong>inverted indexes</strong> and <strong>ranking logic</strong>.</li><li><em>(e.g., Elasticsearch, OpenSearch)</em></li></ul><h4>Public APIs &amp; Reference Services</h4><p>Frequently accessed, low-change datasets.</p><ul><li><strong>Key concern:</strong> Can reads be cached and served quickly?</li><li>Combine traditional DBs with <strong>Redis or CDN layers</strong>.</li><li><em>(e.g., PostgreSQL + Redis)</em></li></ul><h4>Analytics Dashboards</h4><p>BI tools which run complex aggregations and filters.</p><ul><li><strong>Key concern:</strong> Can the DB run fast analytics over large datasets?</li><li>Use <strong>columnar databases</strong> or <strong>materialized views</strong>.</li><li><em>(e.g., ClickHouse, TimescaleDB)</em></li></ul><h4>Content Platforms (Docs, Blogs)</h4><p>High-frequency reads, low write frequency.</p><ul><li><strong>Key concern:</strong> Can you deliver low <a href="https://web.dev/articles/ttfb">TTFB</a> and scale traffic?</li><li>Use <strong>cache-first</strong> and <strong>precomputed pages</strong>.</li><li><em>(e.g., MySQL + Redis, CDN)</em></li></ul><h4>🔧 What to Look for in a Read-Optimized Database</h4><ul><li><strong>Low-latency access paths</strong></li><li><strong>Replication support</strong></li><li><strong>In-memory caching</strong></li><li><strong>Full-text search support</strong></li><li><strong>Materialized or pre-aggregated views</strong></li></ul><h3>Write-Heavy Systems</h3><p>Now let’s flip the scenario and imagine that you’re building an app that writes non-stop logs, metrics, sensor data or chat messages.<br>These systems push databases to their write limits and it’s less about querying and more about ingesting and storing the data efficently.</p><p>🧾 Logging &amp; Monitoring<br>Continuously write logs, metrics, and traces.</p><ul><li><strong>Key concern:</strong> High ingestion rates without lag.</li><li>Use <strong>append-only storage</strong> and <strong>time-based partitioning</strong>.</li><li><em>(e.g., VictoriaMetrics, ClickHouse, Loki)</em></li></ul><h4>📈 User Event Tracking / Clickstreams</h4><p>Tracks user interactions (clicks, views).</p><ul><li><strong>Key concern:</strong> Can the DB handle high write volume + analytics?</li><li>Needs <strong>sharding</strong>, <strong>batch reads</strong>, and <strong>efficient storage</strong>.</li><li><em>(e.g., Kafka + Druid, ClickHouse)</em></li></ul><h4>💬 Messaging / Real-Time Interaction</h4><p>Chat and message systems write constantly.</p><ul><li><strong>Key concern:</strong> Low-latency, small-payload writes at scale.</li><li>Focus on <strong>write amplification</strong> and <strong>durability</strong>.</li><li><em>(e.g., Cassandra, MongoDB)</em></li></ul><h4>💲 Financial Transactions</h4><p>Requires strict correctness and traceability.</p><ul><li><strong>Key concern:</strong> Atomic writes and auditability under pressure.</li><li>Often uses <strong>event queue + consistent DB combo</strong>.</li><li><em>(e.g., Kafka + PostgreSQL, ScyllaDB)</em></li></ul><h4>📳 IoT Telemetry / Sensor Data</h4><p>Massive streams of timestamped device data.</p><ul><li><strong>Key concern:</strong> Time-series volume and order handling.</li><li>Look for <strong>compression</strong> and <strong>efficient time bucketing</strong>.</li><li><em>(e.g., InfluxDB, TimescaleDB, Cassandra)</em></li></ul><h4>🔧 What to Look for in a Write-Optimized Database</h4><ul><li><strong>High ingestion throughput</strong></li><li><strong>Horizontal scalability</strong></li><li><strong>Time-series awareness</strong></li><li><strong>Write-optimized storage engines</strong> (e.g., LSM trees)</li><li><strong>Flexible schemas or batch writes</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3RthcessfU3J3TAQxtTE6A.png" /></figure><p>Not all queries are created equal. Some need accuracy others just need to respond fast even if the data is few seconds behind. This is where the classic <strong>Consistency</strong> vs <strong>Availability</strong> trade-off comes in.</p><p><strong>Strong Consistency and ACID Compliance<br></strong>If you’re working in a system something where correctness is critical like in banking systems or inventory management go with <strong>relational databases</strong> (e.g., PostgreSQL, MySQL). These systems will guarantee <strong>atomicity, isolation, and consistency</strong> through transactions.</p><blockquote>If a failed transaction could cost money or trust, consistency wins.</blockquote><h4>High Availability and Eventual Consistency</h4><p>In contrast, if you’re building something like a <strong>social feed</strong>, <strong>chat system</strong>, or <strong>IoT stream</strong>, being responsive at scale might matter more than being always correct. Here’s where NoSQL solutions like <strong>Cassandra</strong>, <strong>DynamoDB</strong>, or <strong>Redis</strong> shine.</p><blockquote><em>Think global scale, partition tolerance, and user experience first.</em></blockquote><p><strong>Hybrid Approaches<br></strong>Modern distributed databases like CockroachDB and FaunaDB offer <strong>distributed SQL</strong> with strong consistency, aiming to deliver the best of both worlds: <strong>ACID guarantees</strong> with <strong>horizontal scalability</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EgD9wm8qLCy5ynIAvCvWAg.png" /></figure><p>Your data isn’t always static and your schema shouldn’t be either.</p><p>When you’re building fast, especially in early-stage products, your data needs can change from week to week. One feature might require a new field, another might drop entirely. In these situations, <strong>schema flexibility</strong> becomes a dealbreaker.<br>🧾 Evolving Data, Flexible Models</p><p>If your queries change often like sometimes needing nested fields, or sometimes skipping them altogether strict schemas slow you down. That’s when <strong>document databases</strong> like <strong>MongoDB</strong> or <strong>Firestore</strong> really help. You can store rich and nested objects without redefining the structure every single time.</p><blockquote><em>Think product metadata, user settings, or logs where structure is semi-defined and grows over time.</em></blockquote><h4>Structured Data, Predictable Logic</h4><p>But if your app demands tight validation like a finance system or multi-entity relationship you’ll want <strong>relational databases</strong> (PostgreSQL, MySQL). These give you enforced schemas, foreign keys, and constraints.</p><blockquote><em>These are ideal for systems where data correctness is non-negotiable.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LCXIjpcnrdmo-1IrqCjJXA.png" /></figure><p>The timing of your queries, instant dashboards vs. overnight reports which will determine if your database needs streaming speed or batch processing efficiency. Query latency and urgency guide these choices.</p><ul><li>If your product demands <strong>instant results </strong>like dashboards, metrics, or user-facing updates you need <strong>real-time</strong> databases. These systems prioritize low-latency execution, fast writes, and responsive reads.<br><em>(e.g., ClickHouse, Druid, TimescaleDB)</em></li><li>For <strong>search-heavy</strong> use cases, where users query text or logs, look for databases built around indexing and scoring. <br><em>(e.g., Elasticsearch, OpenSearch)</em></li><li>When timing isn’t urgent — like running nightly reports or aggregating historical data — <strong>batch processing</strong> systems are ideal<br><em>(e.g., </em>BigQuery<em>, </em>Snowflake<em>)</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_wj8YLrZGKLpYLcbijB9Og.png" /></figure><p>What do your queries search for? Your queries don’t just ask for data they also ask how to find it. <br>The more fields you filter on, the more your database must support complex and efficient indexing.</p><ul><li>If you frequently query across <strong>multiple fields, </strong>need <strong>range filters</strong>, or run <strong>aggregations</strong>, go for databases which offer <strong>rich indexing options</strong>.<br><em>(e.g., GIN indexes in PostgreSQL, compound indexes in MongoDB)</em></li><li>For <strong>full-text or fuzzy search</strong>, standard indexes won’t cut it. You’ll need engines designed for document-based querying. Choose engines like <strong>Elasticsearch </strong>that are built for those access patterns.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dDlRyPqJz3yL2wThH_dCEw.png" /></figure><p>Where your users are matters <strong>latency</strong> is <strong>physical</strong>.<br>If your app serves users across regions, your database must follow them. Long-distance queries increase response times and reduce reliability.</p><ul><li>Use <strong>multi-region databases</strong> with replication support if your data must be close to users worldwide. <em>(e.g., Cassandra, DynamoDB Global Tables, CockroachDB)</em></li><li>For <strong>read-heavy systems</strong>, a combination of <strong>read replicas</strong> and CDN caching can reduce latency without full geo-distribution.</li></ul><h3>Query Language and Ecosystem Fit</h3><p>Your team’s familiarity with a database’s ecosystem often matters more than technical perfection.</p><ul><li>SQL is universal standart and widely adopted language for <strong>data manipulation and analysis</strong>.</li><li>For <strong>hierarchical or relationship-driven queries</strong>, consider <strong>graph databases</strong> like <strong>Neo4j</strong> or <strong>ArangoDB</strong>.</li></ul><p>But it’s not just about syntax ask yourself:</p><ul><li>Are client libraries well-supported in your language?</li><li>Can you monitor and troubleshoot effectively?</li><li>Is there a strong community or cloud-managed option?</li></ul><h3>Final Thoughts: Design for Query First</h3><p>Your schema, performance, scalability, and even the success of your product hinge on understanding one thing: <strong>how your data will be accessed</strong>.</p><p>Before jumping into any tech stack, take your time to:</p><ul><li>Map out <strong>real use cases</strong>.</li><li>Draft <strong>sample queries</strong>.</li><li>Estimate <strong>scale, latency, </strong>and<strong> consistency</strong> needs.</li></ul><p><em>Do Not Forget !<br>Your database is not just a storage layer. It’s your product’s nervous system<br>Choose Wisely, Because the way you </em><strong><em>query today</em></strong><em> shapes how you’ll </em><strong><em>scale tomorrow</em></strong><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96c41d59608b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/goturkiye/your-queries-define-your-database-96c41d59608b">Your Queries Define Your Database</a> was originally published in <a href="https://medium.com/goturkiye">GoTurkiye</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Art of Simplified Java: Enhancing Development with Project Lombok]]></title>
            <link>https://medium.com/@omergrn/the-art-of-simplified-java-enhancing-development-with-project-lombok-65726ef9d2b4?source=rss-47f8bc74af75------2</link>
            <guid isPermaLink="false">https://medium.com/p/65726ef9d2b4</guid>
            <category><![CDATA[boilerplate-code]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[project-lombok]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Omer Goren]]></dc:creator>
            <pubDate>Tue, 16 May 2023 19:43:56 GMT</pubDate>
            <atom:updated>2023-05-16T19:43:56.350Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Hypy3kS112_zYgpOLJcz6w.png" /></figure><p>Java, despite its power and versatility, has long been criticized for its excessive boilerplate code. One recurring issue is the need to write repetitive getters and setters for class properties. These mundane tasks can clutter your codebase and make it harder to focus on the essential aspects of your application. However, thanks to Project Lombok, you can bid farewell to this ceremonial code and embrace a more efficient and elegant coding style.</p><h3>What is Project Lombok?</h3><p>Project Lombok is a Java library that provides annotations to automate the generation of common boilerplate code, such as getters, setters, constructors, and more. By leveraging these annotations, you can significantly reduce the amount of code you write, resulting in cleaner and more concise Java programs. Let’s explore some of the key features of Project Lombok and understand how it can enhance your development workflow.</p><h3>History of Project Lombok</h3><p>Project Lombok was initially created by Reinier Zwitserloot, known as @surial on Twitter, and Roel Spilker before 2009.<br>The name “Lombok” draws inspiration from the Indonesian island of the same name, located east of Java. Additionally, “Lombok” is Indonesian for “chilli,” aligning with the library’s tagline, “Spicing up your Java.”</p><h3>How Does Lombok Work?</h3><p>At its core, Project Lombok hooks into the Annotation Processor API and seamlessly integrates with the Java compiler. When you use Lombok annotations in your code, the Abstract Syntax Tree (AST) of your source code is passed to Lombok for code generation. Lombok then generates the necessary code, which is compiled along with your project. Importantly, this process incurs no runtime performance penalty.</p><p>Suppose you manually implement a method that Project Lombok would typically generate. In that case, Lombok recognizes your custom implementation and seamlessly incorporates it into the generated code. This flexibility allows you to override Lombok’s generated code effortlessly, tailoring it to your specific requirements.</p><h3>Project Lombok and IDEs</h3><p>Integrating Project Lombok into your development environment is crucial for harnessing its full potential. Modern IDEs, such as IntelliJ, Eclipse, and NetBeans, offer excellent support for Project Lombok out of the box.</p><p>To enable Lombok support in IntelliJ, you can follow these steps to install the Lombok IntelliJ plugin:</p><ul><li>Go to File &gt; Settings &gt; Plugins</li><li>Click on Browse repositories...</li><li>Search for Lombok Plugin</li><li>Click on Install plugin</li><li>Restart IntelliJ IDEA</li></ul><h3>Notable Features of Project Lombok</h3><p>Project Lombok provides a rich set of annotations that simplify the creation of Java classes and reduce code verbosity. Let’s take a closer look at some of the noteworthy features:</p><h3>@Getter and @Setter</h3><p>The @Getter annotation generates getter methods for all properties of a class, eliminating the need to write them manually. Similarly, the @Setter annotation generates setters for all non-final properties.</p><pre>import lombok.Getter;<br>import lombok.Setter;<br><br>@Getter<br>@Setter<br>public class Person {<br>    private String name;<br>    private int age;<br>    private String city;<br>}<br><br>// Usage<br>Person person = new Person();<br>person.setName(&quot;Omer&quot;);<br>person.setAge(25);<br>person.setCity(&quot;Istanbul&quot;);<br>System.out.println(person.getName());  // Output: Omer<br>System.out.println(person.getAge());   // Output: 25<br>System.out.println(person.getCity());  // Output: Istanbul</pre><h3>@ToString</h3><p>The @ToString annotation generates a convenient toString() method for a class. By default, it includes the class name and a comma-separated list of its fields. You can also provide optional parameters to include field names or even include a call to the superclass&#39;s toString() method, further enhancing the output.</p><pre>import lombok.ToString;<br><br>@ToString<br>public class Book {<br>    private String title;<br>    private String author;<br>    private int year;<br><br>    // ...<br>}<br><br>// Usage<br>Book book = new Book();<br>book.setTitle(&quot;The Great Gatsby&quot;);<br>book.setAuthor(&quot;F. Scott Fitzgerald&quot;);<br>book.setYear(1925);<br>System.out.println(book);  // Output: Book(title=The Great Gatsby, author=F. Scott Fitzgerald, year=1925)</pre><h3>@EqualsAndHashCode</h3><p>The @EqualsAndHashCode annotation generates implementations of the equals(Object other) and hashCode() methods based on the class&#39;s properties. By default, it includes all non-static and non-transient properties, ensuring accurate equality and hashing semantics. You can also exclude specific properties if needed.</p><pre>import lombok.EqualsAndHashCode;<br><br>@EqualsAndHashCode<br>public class Point {<br>    private int x;<br>    private int y;<br><br>    // ...<br>}<br><br>// Usage<br>Point p1 = new Point();<br>p1.setX(5);<br>p1.setY(10);<br><br>Point p2 = new Point();<br>p2.setX(5);<br>p2.setY(10);<br><br>System.out.println(p1.equals(p2));  // Output: true<br>System.out.println(p1.hashCode() == p2.hashCode());  // Output: true</pre><h3>@NoArgsConstructor and @RequiredArgsConstructor</h3><p>The @NoArgsConstructor annotation generates a no-args constructor for a class. It&#39;s particularly useful when working with frameworks that require a default constructor, such as serialization or dependency injection. However, note that if your class contains final fields, the @NoArgsConstructor annotation will cause a compiler error. In such cases, you can optionally use the force parameter, which initializes final fields with default values (0, false, or null).</p><p>On the other hand, the @RequiredArgsConstructor annotation generates a constructor that includes all fields marked as final or annotated with @NonNull. This constructor ensures that none of the @NonNull fields are null, throwing a NullPointerException if any are.</p><pre>import lombok.NoArgsConstructor;<br>import lombok.RequiredArgsConstructor;<br><br>@NoArgsConstructor<br>@RequiredArgsConstructor<br>public class Person {<br>    private final String name;<br>    private int age;<br><br>    // ...<br><br>    // Usage<br>    Person person1 = new Person();  // No-args constructor<br>    Person person2 = new Person(&quot;Omer&quot;);  // Constructor with name parameter<br>}</pre><h3>@Data and @Value</h3><p>The @Data annotation is a convenient shorthand for combining several Lombok annotations. It includes @Getter, @Setter, @ToString, @EqualsAndHashCode, and @RequiredArgsConstructor. This comprehensive annotation streamlines the creation of Plain Old Java Objects (POJOs) by generating all the necessary boilerplate code.</p><p>Similarly, the @Value annotation serves as an immutable variant of @Data. When applied to a class, it makes all fields private and final by default, ensuring the immutability of instances.</p><pre>import lombok.Data;<br><br>@Data<br>public class Car {<br>    private String make;<br>    private String model;<br>    private int year;<br><br>    // ...<br>}<br><br>// Usage<br>Car car = new Car();<br>car.setMake(&quot;Toyota&quot;);<br>car.setModel(&quot;Camry&quot;);<br>car.setYear(2022);<br><br>System.out.println(car.getMake());   // Output: Toyota<br>System.out.println(car.getModel());  // Output: Camry<br>System.out.println(car.getYear());   // Output: 2022</pre><pre>import lombok.Value;<br><br>@Value<br>public class Point {<br>    private final int x;<br>    private final int y;<br><br>    // ...<br>}<br><br>// Usage<br>Point p = new Point(5, 10);<br>System.out.println(p.getX());  // Output: 5<br>System.out.println(p.getY());  // Output: 10</pre><h3>@NonNull</h3><p>The @NonNull annotation allows you to mark parameters of methods or constructors, enforcing non-null values. If a marked parameter receives a null value during execution, a NullPointerException will be thrown. This annotation promotes safer programming practices by explicitly declaring nullability requirements.</p><pre>import lombok.NonNull;<br><br>public class Person {<br>    private String name;<br><br>    public void setName(@NonNull String name) {<br>        this.name = name;<br>    }<br><br>    // ...<br><br>    // Usage<br>    Person person = new Person();<br>    person.setName(null);  // Throws NullPointerException<br>}</pre><h3>@Builder</h3><p>The @Builder annotation implements the well-known builder pattern for object creation. With this annotation, you can easily create instances of complex classes with a fluent and expressive syntax.</p><pre>import lombok.Builder;<br><br>@Builder<br>public class House {<br>    private String address;<br>    private int bedrooms;<br>    private int bathrooms;<br><br>    // ...<br>}<br><br>// Usage<br>House house = House.builder()<br>    .address(&quot;123 Fatih Street&quot;)<br>    .bedrooms(3)<br>    .bathrooms(2)<br>    .build();</pre><h3>Additional Useful Annotations</h3><p>Project Lombok provides several other annotations to simplify and enhance your Java development experience. Here are a few worth mentioning:</p><ul><li>@SneakyThrows: Allows you to throw checked exceptions without declaring them in the calling method&#39;s throws clause, reducing code clutter.</li><li>@Synchronized: Provides a safer implementation of Java&#39;s synchronized keyword, ensuring thread-safe access to annotated methods or blocks.</li><li>@Log: Generates a Java util logger, offering a convenient way to add logging capabilities to your classes. However, keep in mind that Java util loggers are generally considered subpar.</li><li>@Slf4j: Creates a logger using the Simple Logging Facade for Java (SLF4J). SLF4J is a widely used and recommended logging facade, and its integration with Project Lombok can streamline your logging efforts.</li></ul><p><strong>In conclusion</strong>, Project Lombok is a powerful Java library that eliminates the need for writing repetitive and boilerplate code. By using annotations like <strong>@Getter</strong>, <strong>@Setter</strong>, and <strong>@ToString</strong>, you can save time and improve code readability.</p><p>Say goodbye to excessive ceremony and embrace cleaner and more maintainable code. Spice up your Java projects with Lombok and experience the benefits firsthand.</p><p><strong>Happy coding with Project Lombok!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65726ef9d2b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP Verbs: A Guide to Understanding RESTful Services]]></title>
            <link>https://medium.com/@omergrn/http-verbs-a-guide-to-understanding-restful-services-b48dd66375dd?source=rss-47f8bc74af75------2</link>
            <guid isPermaLink="false">https://medium.com/p/b48dd66375dd</guid>
            <category><![CDATA[http-request]]></category>
            <category><![CDATA[rest]]></category>
            <category><![CDATA[crud]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Omer Goren]]></dc:creator>
            <pubDate>Mon, 08 May 2023 18:56:05 GMT</pubDate>
            <atom:updated>2023-05-08T21:33:20.882Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Have you ever wondered how the internet works?<br></strong> <strong>How we are able to access all the information we need with just a few clicks?</strong> The answer lies in a set of rules and protocols called HTTP, or Hypertext Transfer Protocol. It is the foundation of data communication on the World Wide Web. And one of the key features of HTTP is its ability to perform different types of operations or verbs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_ypcew4dvJ49lSoI" /></figure><p>In this article, we will explore the different types of HTTP verbs and their functions in RESTful services. REST, or Representational State Transfer, which is a set of architectural principles for building web services. It is a popular way to create web services because it is simple and flexible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*5ADI0pu2l-PWr0wmqiS9Cg.png" /></figure><h3>What are HTTP Verbs?</h3><p>HTTP verbs, also known as HTTP methods, are used to specify the type of action that should be performed on a resource. There are five main HTTP verbs: GET, PUT, POST, PATCH, and DELETE. Let’s take a closer look at each of them.</p><p><strong>HTTP-GET:</strong> Read data from resource</p><p>The <strong>HTTP-GET</strong> verb is used to retrieve information from a resource. It is a read-only operation that does not change the state of the resource. It is an <strong>idempotent </strong>operation, which means that making multiple GET requests to the same resource will not change the result.<br> It represents the read part of the C<strong>R</strong>UD (Create, Read, Update, Delete) operation. <br>It is commonly used to <strong>fetch data from a server or API</strong>.<br>Here’s an example of how the HTTP-GET verb can be used in Java Spring Framework</p><pre>@GetMapping(CUSTOMER_PATH)<br>public List&lt;Customer&gt; listCustomers() {<br>    return customerService.listCustomers();<br>}<br><br>@GetMapping(CUSTOMER_PATH_ID)<br>public Customer getCustomerById(@PathVariable(value = &quot;customerId&quot;) UUID customerId) {<br>    log.debug(&quot;Get customer by id - in controller&quot;);<br>    return customerService.getCustomerById(customerId).orElseThrow(NotFoundException::new);<br>}</pre><p><strong>HTTP-PUT</strong>: Insert or update data in resource</p><p>The HTTP-PUT verb is used to insert new data or update existing data in a resource. It is an idempotent operation, which means that making multiple PUT requests to the same resource will not change the result. It is not a safe operation, which means that it does change the state of the resource. <br>It represents the “Create” and “Update” parts of the <strong>C</strong>R<strong>U</strong>D operation.</p><p>It is commonly used to <strong>create or update data on a server or API</strong>.<br>Here’s an example of how the HTTP-PUT verb can be used in Java Spring Framework</p><pre>@PutMapping(CUSTOMER_PATH_ID)<br>public ResponseEntity updateById(@PathVariable(value = &quot;customerId&quot;) UUID customerId, Customer customer) {<br>    customerService.updateByCustomerId(customerId, customer);<br>    return new ResponseEntity(HttpStatus.NO_CONTENT);<br>}</pre><p><strong>HTTP-POST</strong>: Create a new object</p><p>The HTTP-POST verb is used to create a new object in a resource. It is a non-idempotent operation, which means that making multiple POST requests will create multiple objects. It is not a safe operation, which means that it does change the state of the resource. It is the only non-idempotent, non-safe HTTP verb. <br>It represents the “Create” part of the <strong>C</strong>RUD operation.<br>It is commonly used to <strong>add new data to a server or API</strong>.<br>Here’s an example of how the HTTP-POST verb can be used in Java Spring Framework</p><pre> @PostMapping(CUSTOMER_PATH)<br>    public ResponseEntity handlePost(@RequestBody Customer customer) {<br>        Customer savedCustomer = customerService.saveNewCustomer(customer);<br>        HttpHeaders headers = new HttpHeaders();<br>        headers.add(&quot;Location&quot;, CUSTOMER_PATH + &quot;/&quot; + savedCustomer.getId().toString());<br>        return new ResponseEntity(headers, HttpStatus.CREATED);<br>    }</pre><p><strong>HTTP-PATCH</strong>: Partially update an existing resource</p><p><strong>HTTP-PATCH</strong>: Partially update an existing resource</p><pre>@PatchMapping(CUSTOMER_PATH_ID)<br>    public ResponseEntity patchCustomerById(@PathVariable(&quot;customerId&quot;) UUID customerId,<br>                                            @RequestBody Customer customer) {<br><br>        customerService.patchCustomerById(customerId, customer);<br><br>        return new ResponseEntity(HttpStatus.NO_CONTENT);<br>    }</pre><p><strong>HTTP-DELETE</strong>: Delete an object</p><p><strong>HTTP-DELETE</strong>: Delete an object</p><pre>@DeleteMapping(CUSTOMER_PATH_ID)<br>    public ResponseEntity deleteById(@PathVariable(&quot;customerId&quot;) UUID customerId) {<br>        customerService.deleteById(customerId);<br>        return new ResponseEntity(HttpStatus.NO_CONTENT);<br>    }</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b48dd66375dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analysis of Memory and Runtime Performance in Java]]></title>
            <link>https://medium.com/@omergrn/analysis-of-memory-and-runtime-performance-in-java-a3761fada240?source=rss-47f8bc74af75------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3761fada240</guid>
            <category><![CDATA[runtime]]></category>
            <category><![CDATA[heap]]></category>
            <category><![CDATA[garbage-collection]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[stack]]></category>
            <dc:creator><![CDATA[Omer Goren]]></dc:creator>
            <pubDate>Sat, 03 Dec 2022 21:40:54 GMT</pubDate>
            <atom:updated>2022-12-03T21:40:54.121Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zkv4q2hTCTA5ySeJRDp4KQ.jpeg" /></figure><h4>In today’s topic, we will talk about the collection of java performance measurement pointers which describes how memory works in general and how java uses the heap and the stack. Also, we’ll learn how to set the available memory for java and how to get the runtime and the memory consumption of the java applications.</h4><h3>Performance factors</h3><p>Compared to a pure interpreter, <strong>Java is an extremely faster than other languages to make it faster let’s dive in.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/1*LRT7pRYcgWAl0XiEqhiB2w.png" /></figure><p>A Java program’s performance-affecting factors can be divided into two categories.</p><ol><li>Memory Consumption of the Java program<br><em>Memory consumption is the total amount of memory that a program uses while running.</em></li><li>Total runtime of a program</li></ol><p>Note: If the program interacts with other programs also Response Time is really important for the performance of the program.</p><h3>Memory handling in Java</h3><p>Java handles its memory in two areas. The heap and the stack</p><p>To understand better the concept of java heap and stack let’s start with a short overview of memory in general on a computer.</p><h3>Native Memory</h3><p>Native memory is the memory that is available to a process, such as the Java process. The operating system (OS) manages native memory based on physical devices like disk, flash memory, and physical memory.</p><p>The processor (CPU) of the computer computes the instructions to execute and stores its computation results in the registers.</p><p>These registers are fast memory elements that store the output of the CPU.</p><p>The processor can access the normal memory over the memory bus. The amount of memory a CPU can access is based on the size of the physical address which the CPU uses to identify physical memory.</p><p>For example</p><p>A 16-bit address can access 2¹⁶ (=65.536) memory locations.</p><p>A 32-bit address can access 2³² (=4.294.967.296) memory locations.</p><p>If each memory area consists of 8 bytes then a 16-bit system can access 64KB of memory, a 32-bit system can access 4GB of memory and a 64-bit system can access 16 Exabytes of memory.</p><p>An operating system (OS) normally uses virtual memory to map the physical memory to the memory that each process can see. The operating system then allocates memory to each process in a virtual memory space for this process and maps access to this virtual memory to real physical memory.</p><p>Current 32-bit systems use an extension (Physical Address Extension (PAE)) that expands the physical space of the operating system to 36 bits. This enables the operating system to access 64GB. The operating system then uses virtual memory to provide the individual process with 4 GB of memory. A process cannot access more than 4 GB of memory even when PAE is enabled</p><p>“In fact, with 64-bit operating systems, this 4GB limit no longer exists.”</p><h3>Memory in Java</h3><p>Java controls the memory that is available for use. New objects are created and stored in the heap.</p><p>When your application no longer has a reference to an object, the Java garbage collector is allowed to delete the object and free the memory so that your program can use it again.</p><p>Now it’s time to explain the Java heap and stack.</p><h3>Java Heap</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*nMx46s8e9aFlO7MG8DFxzQ.png" /></figure><p>The Java Virtual Machine (JVM) stores all objects created by the Java application in the Heap, for example, by using the “new” operator. The Java garbage collector (GC) can logically divide the heap into distinct sections, allowing the GC to identify objects that can be removed faster.</p><h3>Java Stack</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*CK3KfUmu8Cu-b88aHebHdQ.png" /></figure><p>The stack is where method invocations and local variables are stored. When a method is executed, its stack frame is added to the top of the call stack. The stack frame stores the method’s state, including which line of code is being executed and the values of all local variables. The method at the top of the stack is always the stack’s current running method. Each thread has its call stack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*NX2PYzGZ8TE4qrAfQ64jZw.png" /></figure><h3>Escape analysis</h3><p>As said before, Java objects are created and stored in the heap. The programming language does not allow the programmer to determine whether or not an object should be generated in the stack. However, in some cases, allocating an object on the stack might be preferred since memory allocation on the stack is less costly than memory allocation on the heap, deallocation on the stack is free, and the stack is efficiently handled by the runtime.</p><p>As a result, the JVM uses escape analysis internally to determine whether an object is only used with a thread or method. If the JVM detects this, it may decide to create the object on the stack, enhancing the Java program’s performance.</p><h3>Memory leaks</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*_KYRNcz77cgiXtwG8yP0WQ.png" /></figure><p>The JVM’s garbage collector releases Java objects from memory as long as no other object points to this object. If other objects still have pointers to these objects, the JVM’s garbage collector will be unable to release them.</p><h3>Garbage Collector</h3><p>The JVM automatically recollects the memory that is no longer in use. The garbage collector will automatically release memory for objects that are no longer referred to. Add the command line argument “-verbose:gc” to your virtual machine to test if the garbage collector starts working.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*bTTyHTdK2_Q11zkHp6CYFQ.gif" /></figure><h3>Java virtual machine memory settings</h3><p>The JVM operates with a set amount of available memory. When this memory is reached, the error “java.lang.OutOfMemoryError” is thrown. The JVM tries to make a decision about available memory at initialization, but you can override this with the following options.</p><p>Certain JVM parameters can be used to improve performance.</p><p>💡 -Xms1024m: Set the JVM’s minimum usable memory to 1024 Megabytes.</p><p>💡 -Xmx1800m: Set the JVM’s maximum accessible memory to 1800 Megabytes. The Java application cannot use more heap memory than the amount specified by this option.</p><h3>Memory Consumption and Runtime</h3><p>In general, an operation is called complex if it has a significant runtime or consumes a large amount of memory.</p><h3>Memory Consumption of a Java program</h3><p>The total used/free memory of an application can be determined using java.lang.Runtime.getRuntime();</p><p>The runtime includes various memory-related methods.</p><p>The following code example shows how to use it.</p><pre>import java.util.ArrayList;<br>import java.util.List;</pre><pre>public class TestPerformance{<br>	public static void main(String[] args) {<br>        List&lt;Car&gt; list = new ArrayList&lt;Car&gt;();<br>        for (int i = 0; i &lt;= 10000; i++) {<br>            list.add(new Car(&quot;Civic&quot;));<br>        }<br>        // Get the Java runtime<br>        Runtime runtime = Runtime.getRuntime();<br>        // Running the Garbage Collector<br>        runtime.gc();<br>        // Calculating the used memory<br>        long memory = runtime.totalMemory() - runtime.freeMemory();<br>        System.out.println(&quot;Used memory in bytes: &quot; + memory);<br>    }<br>}</pre><h3>The runtime of a Java program</h3><p>Calculate the difference between the start and end times using System.currentTimeMillis().</p><pre>class TimeTest {<br>    public static void main(String[] args) {<br>        long startingTime = System.currentTimeMillis();<br>        long total = 0;<br>        for (int i = 0; i &lt; 100000; i++) {<br>            total += i;<br>        }<br>        long endingTime= System.currentTimeMillis();<br>        long elapsedTime = stopTime - startTime;<br>        System.out.println(&quot;The runtime: &quot;+elapsedTime);<br>    }<br>}</pre><h3>Lazy initialization</h3><p>If a variable is highly expensive to construct, it is sometimes preferable to postpone its creation until the variable is required. This is known as lazy initialization. In general, lazy initialization should be utilized only if analysis reveals that this is a highly expensive program. This is a result that lazy initialization making the code even more difficult to read.</p><pre>public class Area{<br>}</pre><h3>Lazy initialization</h3><p>The easiest approach is to use a synchronized block. Because field access is always synchronized, this variation is slow when reading.</p><pre>public class SynchronizedTest {<br>    private Area area;</pre><pre>    public synchronized Area getAre() {<br>        if (area== null) {<br>            area= new Area();<br>        }<br>        return area;<br>    }<br>}</pre><p>More about lazy initialization:</p><h3>Just-in-time (JIT) compiler</h3><p>During the execution of your program, the Java JIT compiler compiles Java bytecode to native executable code. This dramatically boosts the runtime of your software. The JIT compiler uses runtime information to identify runtime-intensive parts of your application. These “hot spots” are then translated into native code. This is why the JIT compiler is often known as a “Hot-spot” compiler. Because JIT can decide that certain compilation steps must be altered, it stores the original bytecode and native code in memory.</p><h3>Using VisualVM (jvisualvm)</h3><h3>What is VisualVM?</h3><p>jvisualvm is a tool for analyzing your Java application’s runtime behavior. It allows you to monitor the memory and CPU utilization of a running Java program. It can also be used to generate a memory heap dump to study the objects in the heap.</p><p><a href="https://visualvm.github.io/">https://visualvm.github.io/</a> [Visualvm] is included in JDK distribution (as of Update 7 for jdk1.6). To launch visualvm, navigate to the bin directory of your JDK installation and double-click jvisualvm.exe. If your patch includes a bin directory, you can start it with the jvisualvm command.</p><h3>Creating a heap dump with</h3><p>VisualVM can be used to take a heap dump of a locally running application. Until you actively save it, this produces a temporary file. If you do not save the file, it is erased when the application from whence the heap dump was obtained closes.</p><h3>Load Test</h3><p>A load test tool is a tool that simulates user and system operations on an application to measure the system’s reaction and behavior. A load test tool is widely used to measure the behavior of a web application.</p><p>Some of the Popular load-testing tools are:</p><ol><li>JMeter</li><li>LoadNinja</li><li>Gatling</li><li>BlazeMeter</li><li>JProfiler</li><li>XRebel/JRebel</li><li>Stagemonitor</li><li>Zipkin</li><li>Prefix by Stackify</li><li>Retrace by Stackify</li><li>Java Application Performance Management tool by AppOptics</li><li><a href="https://xperti.io/blogs/java-performance-testing-tools-and-technologies/#12_Java_Log_Management_and_Analysis_tool_by_SolarWinds_Loggly">Java Log Management and Analysis tool by SolarWinds Loggly</a></li><li>The Eclipse Memory Analyzer</li><li>Web Tracer by LightStep</li><li>Web Profilers by EJ Technologies (JProfiler)</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3761fada240" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TREES DATA STRUCTURE]]></title>
            <link>https://medium.com/@omergrn/trees-data-structure-1c566db3b726?source=rss-47f8bc74af75------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c566db3b726</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[trees]]></category>
            <category><![CDATA[binary-search]]></category>
            <category><![CDATA[binary-tree]]></category>
            <category><![CDATA[data-structures]]></category>
            <dc:creator><![CDATA[Omer Goren]]></dc:creator>
            <pubDate>Mon, 06 Dec 2021 20:11:24 GMT</pubDate>
            <atom:updated>2021-12-07T10:02:07.275Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Trees are a data structure that is What we call hierarchical structure.<br>Which is very similar to the Family Tree.<br>The tree usually starts with a single root node or we can say parent node and every child in the tree descends from this root (parent ) node.</strong></p><blockquote><strong>When we look at that Tree Structure it’s like inversed Tree.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*87h2uhCJ5qztBNwfck2b6g.jpeg" /></figure><p><strong>In Tree, every child can descend from only one parent.<br> tree, we have a parent-child relationship that only goes one way.<br>In Tree, we also have leaf nodes which is the end of the tree data structure.<br>In Tree, we also have Sub-trees as you can see in the example Tree.</strong></p><blockquote><strong>I think everybody has tried to play a Chess Game at least once against to computer, when there wasn’t machine learning it used Tree Data Structure<br>to make a decision. It was asking should I make this move or should I make this move based on which move has a better outcome.</strong></blockquote><blockquote><strong>The beauty of Trees that we’ll use the same principle as we did in the linked list.<br>We have nodes and we can contain anything in a node.<br>Note: Linked List is a type of tree but with one single path and it’s linear.<br>Note: In Tree, Nodes can only point to a child.</strong></blockquote><blockquote><strong>Just like in real life we have lots of types of Trees in Tree Data Structure but we’ll only use some of them.</strong></blockquote><h3><strong>BINARY TREE</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N3t8QbGBkhIqZELxBNlqLQ.png" /></figure><blockquote><strong>A Binary tree is a type of tree with a few straightforward rules.<br>Each parent node can only have 0, 1 or 2 child and a child node can only have one parent.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*fLRe-YsCU_Er4BkHumIjZQ.png" /></figure><h3><strong>Perfect Binary Tree</strong></h3><blockquote><strong>A Perfect binary tree has everything filled in.<br>Every Node has two children or zero children and the bottom layer of the tree is filled.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*XOPCEFPuIS85z2EPT70c1w.png" /></figure><h3><strong>FULL BINARY TREE</strong></h3><blockquote><strong>In Full Binary, Tree nodes have either two or zero children. but never one child.</strong></blockquote><blockquote><strong>Perfect binary tree is really really efficient.</strong></blockquote><blockquote><strong>Perfect binary tree has two interesting properties.<br>1-) Number of total nodes doubles as we move down the tree.<br> As can be seen in the figure above in the first level we have one node, in the second level we have 2 nodes in the third level we have four nodes and it continues doubling. By organizing our data in that way we’ll have half of our data at the bottom level.<br>2-)Number of nodes on the last level is equal to the sum of the number of nodes on all the other levels plus one.<br>For example in the figure above there are 8 nodes on the last level and sum of the all other nodes are 7 if we add one to the sum we’ll get an equal number of nodes.</strong></blockquote><h3><strong>Binary Search Tree</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*lAfSmSu2VCgahMiGhejJqA.png" /></figure><blockquote><strong>Binary search tree is a data structure that has the properties below</strong></blockquote><blockquote><strong>1-) All child nodes in the tree to the right of the root node must be greater than the current node. It means if we keep going to the right value of the node will constantly increase.<br>2-) All child nodes in the tree to the left of the root node must be less than the current node. It means if we keep going to the left value of the node will constantly decrease.<br>3-)Node can only have up to two children.</strong></blockquote><blockquote><strong>Methods and time complexity in Binary <br>-lookup O(log N)<br>-insert O(log N)<br>-delete O(log N)</strong></blockquote><p><strong>You can find the Binary Search Tree Implementation with java below.<br>Remove method is complex but I didn’t want to bore you with an explanation of it.</strong></p><pre><strong>public class BinaryTree {<br>    Node root = null;<br>    BinaryTree(){<br><br>    }<br><br>    class Node{<br>        Node left;<br>        Node right;<br>        Integer data;<br><br>        Node(Integer value){<br>            this.left = null;<br>            this.right = null;<br>            this.data = value;<br>        }<br>    }<br>        public void insert(Integer value){<br>            Node newNode = new Node(value);<br>            //If tree is empty<br>            if(root == null){<br>                root = newNode;<br>            }<br>            else {<br>                Node currentNode = root;<br>                while (true){<br>                    if(value&lt; currentNode.data){<br>                        //Left<br>                        if(currentNode.left == null){<br>                            currentNode.left = newNode;<br>                            return;<br>                        }<br>                        currentNode = currentNode.left;<br>                    }<br>                    else {<br>                        //Right<br>                        if(currentNode.right == null){<br>                            currentNode.right = newNode;<br>                            return;<br>                        }<br>                        currentNode = currentNode.right;<br>                    }<br>                }<br>            }<br>        }<br><br>        public void lookUp(Integer target){<br>        if(root == null){<br>            System.<em>out</em>.println(&quot;Tree is empty&quot;);<br>            return;<br>        }<br>        Node currentNode = root;<br>        while (currentNode !=null){<br>            if(target &lt; currentNode.data){<br>                currentNode = currentNode.left;<br>            }<br>            else if(target&gt; currentNode.data){<br>                currentNode = currentNode.right;<br>            }<br>            else if(target == currentNode.data){<br>                System.<em>out</em>.println(target+&quot; is found out in Binary Tree.&quot;);<br>                return;<br>            }<br>        }<br>            System.<em>out</em>.println(target+ &quot; is not found out in Binary Tree.&quot;);<br>        }<br><br>        public void remove(Integer target){<br>        if(root == null){<br>            System.<em>out</em>.println(&quot;Tree is empty!&quot;);<br>            return;<br>        }<br>        Node currentNode = root;<br>        Node parentNode = null;<br>        while (currentNode!= null){<br>            if (target &lt; currentNode.data){<br>                parentNode = currentNode;<br>                currentNode = currentNode.left;<br>            }<br>            else if (target &gt; currentNode.data){<br>                parentNode = currentNode;<br>                currentNode = currentNode.right;<br>            }<br>            else if(currentNode.data == target){<br>                //We have match<br>                //Option 1 No right child:<br>                if(currentNode.right == null){<br>                    if(parentNode == null){<br>                        root = currentNode.left;<br>                    }else {<br>                        //if parent &gt; current value, make current left child a child of parent<br>                        if(currentNode.data &lt; parentNode.data){<br>                            parentNode.left = currentNode.left;<br>                        }<br>                        else if(currentNode.data &gt; parentNode.data){<br>                            parentNode.right = currentNode.left;<br>                        }<br>                    }<br>                }<br>                else if(currentNode.right.left == null){<br>                    if(parentNode == null){<br>                        root = currentNode.left;<br>                    }<br>                    else {<br>                        currentNode.right.left = currentNode.left;<br>                        // if parent &gt; current, make right child of the left THE parent<br>                        if(currentNode.data &lt; parentNode.data){<br>                            parentNode.left = currentNode.right;<br><br>                            //if parent &lt; current, makethe  right child a right child of the parent<br>                        }<br>                        else if(currentNode.data &gt; parentNode.data){<br>                            parentNode.right = currentNode.right;<br>                        }<br>                    }<br>                }<br>                //OPTION 3 RIGHT CHILD THAT HAS A LEFT CHILD<br>                else {<br>                //find the right child&#39;s left most child<br>                    Node leftmost = currentNode.right.left;<br>                    Node leftmostParent = currentNode.right;<br>                    while (leftmost.left != null){<br>                        leftmostParent = leftmost;<br>                        leftmost = leftmost.left;<br>                    }<br>                    //Parents left subtree is not leftmost&#39;s right subtree<br>                    leftmostParent.left = leftmost.right;<br>                    leftmost.left = currentNode.left;<br>                    leftmost.right = currentNode.right;<br>                    if (parentNode ==null){<br>                        root = leftmost;<br>                    }<br>                    else {<br>                        if(currentNode.data &lt; parentNode.data){<br>                            parentNode.left = leftmost;<br>                        }<br>                        else if(currentNode.data&gt;parentNode.data){<br>                            parentNode.right = leftmost;<br>                        }<br>                    }<br>                }<br>                return;<br>            }<br><br>        }<br><br>        }<br><br>    }</strong></pre><h3>To be continued.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c566db3b726" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MERGE SORT and O(n log n)]]></title>
            <link>https://medium.com/@omergrn/merge-sort-and-o-n-log-n-ab896b9537b7?source=rss-47f8bc74af75------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab896b9537b7</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[time-complexity]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[merge-sort]]></category>
            <category><![CDATA[big-o-notation]]></category>
            <dc:creator><![CDATA[Omer Goren]]></dc:creator>
            <pubDate>Sat, 30 Oct 2021 15:05:30 GMT</pubDate>
            <atom:updated>2021-10-30T15:05:30.625Z</atom:updated>
            <content:encoded><![CDATA[<p><em>MERGE SORT and O(n log n)</em></p><blockquote><em>Today we’re going to talk about a sorting method where lots of people get confused on which is Merge Sort.</em></blockquote><blockquote><em>We have lots of examples of merge sort in our real life.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UXhB2UnbZiePZwXf" /></figure><p><strong><em>For example, When we need to look for a phone number in our phone book, we open it up not from the first page, but from the middle page and we keep breaking up the pages until we found the page that has the phone number which we’re looking for and we use the same technique in merge sort.</em></strong></p><blockquote><em>Merge sort is one of the most efficient ways you can sort a list of things and it’s going to perform better than other algorithms.<br>We use Divide and Conquer Method</em></blockquote><blockquote><em>The divide method is basically to divide our array until there is only one element left.</em></blockquote><blockquote><em>The conquer method is comparing and sorting the elements inside of those arrays.</em></blockquote><blockquote><em>And the last thing is The Combine step which joins all of those elements together.</em></blockquote><blockquote><em>Once we divide the array we need to sort the items because we’re going to order ‘n’ items it’s going to take ‘</em><strong><em>O(n)’</em></strong><em> and just because there are </em><strong><em>log(n)</em></strong><em> steps in a Merge sort we’ll have a runtime of </em><strong><em>O(n log(n)), </em></strong><em>Which you can see in the graph is not as bad as the O(n²)</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*gYjvIh0vau1Ea_P3hEcHtg.png" /></figure><blockquote><em>We don’t need to compare everything to everything like we did in the selection and the bubble sort because of that it’s more efficient than them.</em></blockquote><blockquote><em>But there are not only good things about merge sort just because it is using recursive algorithm it’ll use the memory wasteful.</em></blockquote><h4><em>Let’s have a look at how Merge Sort works with our gif.</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*opwN0BhtH4zvPF697fPlow.gif" /></figure><blockquote><em>Firstly In Merge Sort, we’re gonna take this list and divide it in half<br>and we’re gonna divide again these sublists until we have one item.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*gtgr1D_iGt2hevviRByF-w.png" /></figure><p><em>Once we have them divided up, we’re going to take the first and second item and ask them which one should I put first?</em></p><p><em>Let’s put 5 first and 6 after, put 1 first and 3 after, 7 first and 8 after, 2 first and 4 after.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*IeK4n6g1OOs8EXOE7dtx1A.png" /></figure><p><em>We are going to combine those lists again.<br>For example, 5 and 1 which one comes first? 1 let’s put 1 first index, 5 and 3 which one comes first? 3 let’s put 3 in the second index and keep combining until having a 2 list.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*HIBmlh1NiSxw3RQyTmyJuQ.png" /></figure><p><em>Lastly, we’re going to compare and combine those 2 lists together.<br>and now we have our sorted list.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*UeSRF7aibJtwyT_crDv5fg.png" /></figure><p><em>You can see what does Merge Sort looks like in a written JAVA CODE below.</em></p><pre><em>public static void main(String[] args) {    Integer[] array = {1, 8, 54, 9, 65, 1, 100, 0, 45, 50, 0, 90, 30, 46};    Arrays.stream(mergeSort(array)).forEach(System.out::println);  }</em></pre><pre><em>public static Integer[] mergeSort(Integer[] array) {<br>    return mergeSort(new ArrayList&lt;&gt;(Arrays.asList(array))).toArray(new Integer[0]);<br>}</em></pre><pre><em>public static List&lt;Integer&gt; mergeSort(List&lt;Integer&gt; array) {<br>    if (array.size() == 1) {  // Returning the arrays itself if array only has one element.<br>        return array;<br>    }<br>    int middle = array.size()/2;<br>    List&lt;Integer&gt; left = array.subList(0,middle);  // Split Array in into right<br>    List&lt;Integer&gt; right = array.subList(middle, array.size()); // Split Array in into right<br>    return merge(mergeSort(left), mergeSort(right));<br>}<br><br>public static List&lt;Integer&gt; merge(List&lt;Integer&gt; left, List&lt;Integer&gt; right) {<br>    List&lt;Integer&gt; merged = new ArrayList&lt;&gt;();<br>    int leftIndex = 0;<br>    int rightIndex = 0;<br>    while (leftIndex &lt; left.size() &amp;&amp; rightIndex &lt; right.size()) { //Keep merging until we done with one of the sides<br>        if (left.get(leftIndex) &lt;= right.get(rightIndex)) { // compare the elements each other.<br>            merged.add(left.get(leftIndex));<br>            leftIndex++;<br>        } else {<br>            merged.add(right.get(rightIndex));<br>            rightIndex++;<br>        }<br>    }<br>    merged.addAll(left.subList(leftIndex, left.size()));<br>    merged.addAll(right.subList(rightIndex, right.size()));<br>    System.out.println(&quot;Merged: &quot; + merged);<br>    return merged;<br>}</em></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab896b9537b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>