<?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 Simone Di Maulo on Medium]]></title>
        <description><![CDATA[Stories by Simone Di Maulo on Medium]]></description>
        <link>https://medium.com/@toretto460?source=rss-7f202329d600------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ibg_Fnui4OVz0FyYMLaqTw.jpeg</url>
            <title>Stories by Simone Di Maulo on Medium</title>
            <link>https://medium.com/@toretto460?source=rss-7f202329d600------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 09:19:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@toretto460/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[Microservices 101: balancing the size]]></title>
            <link>https://medium.com/@toretto460/microservices-101-balancing-the-size-ee568f6de918?source=rss-7f202329d600------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee568f6de918</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Simone Di Maulo]]></dc:creator>
            <pubDate>Mon, 11 Nov 2024 22:29:43 GMT</pubDate>
            <atom:updated>2024-11-12T12:58:18.025Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qRG9k_hBtg4AQHI1vsjeCQ@2x.jpeg" /><figcaption>Photo by Marty Brixen on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you want to read the full article go here <a href="https://simoat.work/posts/microservice-architecture-find-the-right-size/">https://simoat.work/posts/microservice-architecture-find-the-right-size</a>/</p><p>One of the most common challenges developers and architects face when designing a microservice architecture is determining the optimal size of each service. How “micro” should a microservice be? In this article, we explore the various factors – acting as driving forces – that influence decisions regarding service size</p><p>1.	Technical Factors:</p><p>•	Performance &amp; Scalability: Separate services with varying performance needs (e.g., high-traffic payment services) to enable independent scaling.</p><p>•	Security: Isolate sensitive services to apply stricter security controls, reducing vulnerability.</p><p>2.	Domain Factors:</p><p>•	Multi-purpose Services: Services covering multiple contexts should be split for better maintainability and scalability.</p><p>•	Code Change Frequency: Frequently changing components (e.g., a “buy now, pay later” feature) should be isolated to avoid impacting more stable areas.</p><p>3.	Developer Experience Factors:</p><p>•	Over-Fragmentation: Excessive microservices can increase communication overhead, complexity, and operational costs. Merging may be necessary if services are tightly coupled or require consistency.</p><p>•	Development Optimization: Merging services can simplify CI/CD pipelines, reducing coordination for feature releases.</p><p>If you want to read the full article go here</p><p><a href="https://simoat.work/posts/microservice-architecture-find-the-right-size">https://simoat.work/posts/microservice-architecture-find-the-right-size</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee568f6de918" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build a rock solid app]]></title>
            <link>https://medium.com/free-code-camp/how-to-build-a-rock-solid-app-29dffe7875d2?source=rss-7f202329d600------2</link>
            <guid isPermaLink="false">https://medium.com/p/29dffe7875d2</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Simone Di Maulo]]></dc:creator>
            <pubDate>Mon, 03 Sep 2018 16:18:34 GMT</pubDate>
            <atom:updated>2018-09-03T16:18:34.311Z</atom:updated>
            <content:encoded><![CDATA[<h4>An overview of different app design options</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ZdfWIIB1rwY8wjXMkfb0g.jpeg" /><figcaption>source: <a href="https://pixabay.com/en/blacksmith-working-metal-hammer-2385628/">https://pixabay.com/en/blacksmith-working-metal-hammer-2385628/</a></figcaption></figure><p>When we design software, we constantly think about error cases. Errors have a huge impact on the way we design and architecture a solution. So much so, in fact, that there is a philosophy known as <a href="http://wiki.c2.com/?LetItCrash">Let It Crash</a>.</p><p><strong>Let it crash</strong> is the Erlang way to treat failures by just letting the application crash and allowing a supervisor to restart the crashed process from a clean state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lVLik3M6m33YZ52n0iHclQ.png" /><figcaption>Supervisors restart the crashed process</figcaption></figure><p>Errors could be everywhere, and the more your application grows, the more there will be points of failure that you need to keep under control. External service calls, sending email, database queries are all operations that could fail.</p><h4>Kinds of Failures</h4><p>A failure can have different origins which lead to different impacts on your service availability. Think of a scenario where we’re running too many SQL queries and the database server is going to throttle the application. In that case, we could retry the query or add a catch in the code to identify the failing queries and provide a sensible response to the user.</p><p>These kinds of errors are called <strong>Transient Errors,</strong> which means that the database server is temporary overloaded but it’s going to come back soon.</p><p><strong>Transient errors</strong> are not related to any problem in the application. They are usually caused by external conditions such as network failures, overloaded servers, or service rate limits. For that reason, it’s safe for a client to ignore it and retry the failed operation after a while.</p><p>These errors are much more frequent within cloud native applications, because the apps are split into different services and deployed on different servers that communicate over the network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SjWLLvJNhNtqAjuGviDYBQ.png" /></figure><h4>Identifying Transient Errors</h4><p>Transient errors can usually be detected in an automatic manner. <br>We can recognise the errors by inspecting the transport layer metadata (for example HTTP errors, network errors, timeouts) or when they are explicitly marked as transient (such as rate limits).</p><h4>Treating the Errors</h4><p>There are different actions we can do in case of an error. One trivial approach could be to just retry the request, API call, or query.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c295faa7eb5a054ca4206a96509aca04/href">https://medium.com/media/c295faa7eb5a054ca4206a96509aca04/href</a></iframe><p>Even though this solution might be fine in many cases, there are lot of cases when it can lead to a performance decrease for the app.</p><p>Let’s take the case of a network failure. Indefinitely retrying some API calls to a disconnected service would result in continuous network timeouts, and the application will be stuck waiting for a response for a very long time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*KaOlLRtoOIQXgxnIXVZzcQ.png" /></figure><p>Before going ahead with complex implementations, let’s evaluate the pros and cons of the “just-retry” option.</p><p><strong>PROS</strong></p><ul><li>Trivial implementation.</li><li>Stateless (every retry request is isolated and you don’t need any extra information).</li></ul><p><strong>CONS</strong></p><ul><li>For heavily loaded applications, the caller will continuously send requests to the degraded server resulting in a denial of service.</li><li>Cannot provide a response until the server comes back.</li></ul><p>This simple retry strategy can be considered as a very first approach to solving the issue. For low traffic apps it would work, but if you have a more complex architecture, it’s definitely not enough.</p><p>So let’s discuss a more resilient approach.</p><h4>Stealing an Idea from the IEEE</h4><p>The next stop of your journey for a reliable application is to avoid the wasted time and to make the application more responsive. The exponential backoff algorithm could be the right tool for the job.</p><p>The concept of the <em>exponential backoff</em> directly comes from the <a href="https://en.m.wikipedia.org/wiki/Exponential_backoff#Example_exponential_backoff_algorithm">Ethernet</a> network protocol (IEEE 802.3) where it’s used for packet collision resolution.</p><p>For our purposes, the exponential backoff can be used to avoid wasting time between timed out calls or to avoid hammering an overloaded server with an continual flow of requests that cannot be resolved.</p><p>Binary exponential backoff for packet collisions can be resumed with help from the follow definition:</p><blockquote>After *c* collisions, a random number of slot times between 0 and 2*c* - 1 is chosen. For the first collision, each sender will wait 0 or 1 slot times. After the second collision, the senders will wait anywhere from 0 to 3 slot times. After the third collision, the senders will wait anywhere from 0 to 7 slot times (inclusive), and so forth. As the number of retransmission attempts increases, the number of possibilities for delay increases exponentially - <a href="https://en.m.wikipedia.org/wiki/Exponential_backoff">Exponential backoff - Wikipedia</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y1jkyHboflo5rqixjfh7Kw.png" /></figure><p>This algorithm can be quickly adapted to many use cases. The following example is a PHP message handler class that exponentially waits for a response from an API endpoint.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/72f969a542faf1c5d05a97baf3d4466a/href">https://medium.com/media/72f969a542faf1c5d05a97baf3d4466a/href</a></iframe><h4>Retry vs Exponential Backoff</h4><p>The previous two strategies are both sub-optimal. They guarantee that you’ll eventually be able to generate a response to give back to the client, but they rely on continuously calling the external service until a successful response is received.</p><p>We may be lucky and receive a response after a couple of retries, or we could fall in the retry-wait-retry-wait… infinite loop and never receive the response.<br>You know, Murphy’s law is always here: “<em>Anything that can go wrong will go wrong</em>.”</p><p>As you might imagine, scaling a service oriented infrastructure that in case of failure continuously retries the request to the dependant services is the perfect recipe for application collapse.</p><p>We need a stronger strategy to maintain infrastructure resilience.</p><h4>Electronics may Help Us</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qnvQ3GiF27TlIZbFCr2omA.jpeg" /><figcaption><a href="https://pixabay.com/en/circuit-breakers-rcds-fault-current-1167327/">Source: https://pixabay.com/en/circuit-breakers-rcds-fault-current-1167327/</a></figcaption></figure><p>In case of continuous errors, the easy thing to do is clear. We do not want to loop and retry calling an external service. The point is we’ll just<strong> stop</strong> doing it, by taking the concept of <strong>Circuit Breakers</strong> from electronics.</p><h4>From Electronics to Computer Science</h4><p>A circuit breaker is a component that wraps a protected call to an external service and can monitor the responses by checking the service health. Exactly like an electronic component, a software circuit breaker could be <strong>open</strong> or <strong>closed</strong>. An <strong>open</strong> status would mean that the service behind the circuit is down, and a <strong>closed</strong> status would mean that the service is up.</p><p>So the circuit breaker can autonomously control the service status and decide to <strong>open</strong> or <strong>close</strong> the circuit, so that in case of disconnection or server overload, the client stops sending new connections and the degraded service can use more resources to come back to a healthy state.</p><p>In case of an <strong>open</strong> circuit, we could decide to quickly answer to the client with a fallback response. For example, cached data, default data, or whatever make sense for the particular application.</p><p>Let’s see a real example from the e-commerce world. We’re going to use the circuit breaker method to protect the product listing API call.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/08a5d3ae6b12897c6a530a462d01820c/href">https://medium.com/media/08a5d3ae6b12897c6a530a462d01820c/href</a></iframe><p>The circuit breaker will transparently handle all errors and show the default response in case of an API call failure. It also allows defining a max number of retries to avoid too many failed calls.</p><p>In this case, protecting a third party service API call is a very simple task: we just need to provide the callback and number of max failures allowed, after which the <strong>circuit breaker</strong> will be opened for 10 seconds and the default response is given back to the client, as in the example below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d97d61a2c964a3ddffa2e445183e79c4/href">https://medium.com/media/d97d61a2c964a3ddffa2e445183e79c4/href</a></iframe><h4>Conclusion</h4><p>Whether you’re designing a SOA, micro services or a cloud native application, you should be ready to tackle the failure case in the right way. Errors and failures are in the same room from the day you launch your app.</p><p>Here some of the well known tactics to build a real rock solid app:</p><ul><li><a href="https://docs.microsoft.com/en-us/azure/architecture/patterns/retry">https://docs.microsoft.com/en-us/azure/architecture/patterns/retry</a></li><li><a href="https://en.m.wikipedia.org/wiki/Exponential_backoff">https://en.m.wikipedia.org/wiki/Exponential_backoff</a></li><li><a href="https://martinfowler.com/bliki/CircuitBreaker.html">https://martinfowler.com/bliki/CircuitBreaker.html</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29dffe7875d2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/how-to-build-a-rock-solid-app-29dffe7875d2">How to build a rock solid app</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>