Jekyll2023-10-15T11:47:26+01:00https://jnmanso.github.io/feed.xmlJoão MansoI'm the sum of my actions, and therefore my habits make all the difference - adapted from Aristotle.João MansoCAP theorem2023-04-23T18:15:00+01:002023-04-23T18:15:00+01:00https://jnmanso.github.io/cap_theorem<h2 id="introduction">Introduction</h2>
<p>The CAP theorem, also known as Brewer’s theorem, is a fundamental concept in distributed computing that provides insights into the tradeoffs that must be made when designing highly available, distributed systems. In this article, we will discuss the three key components of the CAP theorem and how they apply to distributed systems.</p>
<h2 id="what-is-the-cap-theorem">What is the CAP theorem?</h2>
<p>The CAP theorem states that in a distributed system, it is impossible to simultaneously provide more than two of the following three guarantees:</p>
<ul>
<li>Consistency: All nodes in the system see the same data at the same time.</li>
<li>Availability: Every request made to a non-failing node in the system receives a response, without guarantee of whether it contains the most recent data or not.</li>
<li>Partition Tolerance: The system continues to operate even when network partitions occur, i.e., when the communication between nodes is temporarily interrupted or delayed.</li>
</ul>
<p>In other words, the CAP theorem involves tradeoffs between Consistency, Availability, and Partition Tolerance.</p>
<h2 id="consistency-vs-availability-vs-partition-tolerance">Consistency vs. Availability vs. Partition Tolerance</h2>
<p>When a network partition occurs, the nodes in the system will be divided into two or more disjoint groups, each group may not be able to communicate with the other groups. If the system chooses to maintain consistency and partition tolerance, then it must sacrifice availability. In other words, a request to a node in a partitioned group will result in an error or timeout, as the system waits for the group to rejoin before processing the request.</p>
<p>On the other hand, if the system chooses to maintain availability and partition tolerance, then it must sacrifice consistency. In other words, the system must accept that different nodes may see different versions of the same data at the same time.</p>
<p>If the system chooses to maintain partition tolerance and consistency, then it must sacrifice availability. In other words, the system must accept that requests to nodes in the partitioned group will result in an error or timeout.</p>
<p>The tradeoffs between Consistency, Availability, and Partition Tolerance are not always straightforward, and the optimal balance will depend on the specific requirements and constraints of each system.</p>
<h2 id="conclusion">Conclusion</h2>
<p>The CAP theorem highlights the tradeoffs that must be considered when designing distributed systems, and it emphasizes the importance of prioritizing the most critical system requirements. By understanding the tradeoffs between Consistency, Availability, and Partition Tolerance, developers can make informed decisions about how to design their systems to meet their business requirements. Ultimately, the decision of which two guarantees to prioritize is dependent on the specific use case and the business requirements of the system.</p>João MansoIntroduction The CAP theorem, also known as Brewer’s theorem, is a fundamental concept in distributed computing that provides insights into the tradeoffs that must be made when designing highly available, distributed systems. In this article, we will discuss the three key components of the CAP theorem and how they apply to distributed systems.Introduction to Big O Notation2023-04-23T17:40:00+01:002023-04-23T17:40:00+01:00https://jnmanso.github.io/introduction_to_big_o_notation<h2 id="understanding-algorithm-complexity">Understanding Algorithm Complexity</h2>
<p>Big O notation is a mathematical tool that allows us to express the time and space complexity of algorithms in a clear and concise way. It’s an essential concept in computer science, as it helps us analyze the efficiency of algorithms and make informed decisions about which ones to use in different situations.</p>
<h2 id="what-is-big-o-notation">What is Big O Notation?</h2>
<p>Big O notation is a mathematical notation used to describe the limiting behavior of a function when the argument tends towards a particular value or infinity. In the context of algorithm analysis, it’s used to describe how the running time or space requirements of an algorithm scale with the size of the input.</p>
<p>The “O” in Big O notation stands for “order of magnitude,” which represents the rate of growth of the function as the input size increases. It’s important to note that Big O notation doesn’t provide an exact measurement of the running time or space usage of an algorithm, but rather an upper bound on these values.</p>
<h2 id="why-is-important">Why is important?</h2>
<p>Big O notation is important because it allows us to compare the efficiency of different algorithms and choose the best one for a particular task. By analyzing the time and space complexity of algorithms, we can identify bottlenecks and optimize performance.</p>
<p>For example, let’s say we have two algorithms that perform the same task. One algorithm has a time complexity of O(n), while the other has a time complexity of O(n^2). If we’re working with small inputs, both algorithms might perform similarly, but as the input size grows, the O(n^2) algorithm will quickly become prohibitively slow. By using Big O notation, we can make an informed decision about which algorithm to use for a particular task.</p>
<h2 id="how-is-calculated">How is calculated?</h2>
<p>To calculate the Big O notation of an algorithm, we first need to determine its basic operations. These are the fundamental steps that the algorithm performs, such as comparisons, assignments, and arithmetic operations.</p>
<p>Once we’ve identified the basic operations, we can count how many times each operation is performed as a function of the input size. For example, if an algorithm performs a single comparison for each element in an array, we can say that it has a time complexity of O(n), where n is the size of the array.</p>
<p>In general, we use the following rules to calculate the Big O notation of an algorithm:</p>
<ul>
<li>We ignore constant factors. For example, if an algorithm performs 2n comparisons, we can still say that it has a time complexity of O(n).</li>
<li>We ignore lower-order terms. For example, if an algorithm performs n^2 + n comparisons, we can say that it has a time complexity of O(n^2).</li>
<li>Worst case is usually the way we measure.</li>
</ul>
<p>By applying these rules, we can simplify the time and space complexity of an algorithm to its essential features and express them using Big O notation.</p>
<h2 id="common-notation-classes">Common notation classes</h2>
<p>There are several common Big O notation classes that are used to describe the time and space complexity of algorithms. Here are some of the most important ones:</p>
<ul>
<li>O(1): constant time complexity. The running time of the algorithm doesn’t depend on the size of the input.</li>
<li>O(log n): logarithmic time complexity. The running time of the algorithm grows logarithmically with the size of the input.</li>
<li>O(n): linear time complexity. The running time of the algorithm grows linearly with the size of the input.</li>
<li>O(n log n): linearithmic time complexity. The running time of the algorithm grows as the product of the input size and the logarithm of the input size.</li>
<li>O(n^2): quadratic time complexity. The running time of the algorithm grows quadratically with the size of the input.</li>
<li>O(2^n): exponential time complexity. The running time of the algorithm grows exponentially with the size of the input.</li>
<li>O(n!): factorial time complexity. The running time of the algorithm grows factorially with the size of the input.</li>
</ul>
<h2 id="conclusion">Conclusion</h2>
<p>Big O notation is a powerful tool for analyzing the efficiency of algorithms and understanding how their performance changes as the input size grows. By using Big O notation, we can compare the relative efficiency of different algorithms and choose the most appropriate one for our needs. It’s important to keep in mind that Big O notation only describes the upper bound of an algorithm’s running time, and that the actual running time may be much faster in practice.</p>
<h2 id="resources">Resources</h2>
<p><a href="https://frontendmasters.com/courses/algorithms/">The Last Algorithms Course You’ll Need</a> is a comprehensive course on algorithm design and analysis, taught by ThePrimeagen, a software engineer with over 10 years of experience in the industry. The course covers a wide range of topics, from basic data structures to advanced algorithms, and provides practical examples and exercises to help you apply these concepts in real-world scenarios.</p>
<p>Throughout the course, you’ll learn how to analyze the time and space complexity of algorithms using Big O notation, and how to choose the best data structures and algorithms for a given problem. You’ll also learn about common algorithms and data structures such as arrays, linked lists, stacks, queues, trees, heaps, hash tables, and graph algorithms.</p>João MansoUnderstanding Algorithm Complexity Big O notation is a mathematical tool that allows us to express the time and space complexity of algorithms in a clear and concise way. It’s an essential concept in computer science, as it helps us analyze the efficiency of algorithms and make informed decisions about which ones to use in different situations. What is Big O Notation? Big O notation is a mathematical notation used to describe the limiting behavior of a function when the argument tends towards a particular value or infinity. In the context of algorithm analysis, it’s used to describe how the running time or space requirements of an algorithm scale with the size of the input.Thumb rules to design good Cassandra partition2023-02-04T14:43:00+00:002023-02-04T14:43:00+00:00https://jnmanso.github.io/thumb_rules_to_design_good_cassandra_partition<p>Cassandra is a popular NoSQL database that is designed for large scale data storage and retrieval. One of the key factors that make Cassandra a great choice for large data sets is its partitioning strategy. Partitioning helps to distribute the data evenly across multiple nodes and avoid hotspots, which can result in performance degradation. Here are some thumb rules that can help you design a good Cassandra partition:</p>
<ul>
<li>Choose the right partition key</li>
<li>Store together what you retrieve together</li>
<li>Make use of clustering columns</li>
<li>Avoid big partitions
<ul>
<li>Up to 2 billion cells per partition</li>
<li>Up to ~100k rows in a partition</li>
<li>Up to ~100MB in a partition</li>
</ul>
</li>
<li>Avoid hot partitions</li>
<li>Monitor your partitions using tools like nodetool to monitor the data distribution and identify any potential issues.</li>
</ul>
<p>By following these thumb rules, you can design a good Cassandra partition that will provide fast and reliable data retrieval while avoiding hotspots and performance degradation. With a well-designed partition, you can ensure that your Cassandra cluster is able to handle large data sets and provide fast and efficient data retrieval.</p>João MansoCassandra is a popular NoSQL database that is designed for large scale data storage and retrieval. One of the key factors that make Cassandra a great choice for large data sets is its partitioning strategy. Partitioning helps to distribute the data evenly across multiple nodes and avoid hotspots, which can result in performance degradation. Here are some thumb rules that can help you design a good Cassandra partition:Glenn Santos’ Senior Developer Roadmap2023-01-01T21:35:00+00:002023-01-01T21:35:00+00:00https://jnmanso.github.io/glenn_santos_senior_developer_roadmap<p>If you’re a software developer looking to advance your career to the senior level, you might find <a href="https://github.com/glennsantos/senior-developer-roadmap">Glenn Santos’ Senior Developer Roadmap</a> helpful. This roadmap provides a comprehensive overview of the skills and knowledge required for a senior developer, covering areas such as programming languages, frameworks, development methodologies, and architecture patterns.</p>
<p><img src="/assets/images/2023/01/SeniorDeveloperRoadmap.jpg" alt="Senior developer roadmap" /></p>João MansoIf you’re a software developer looking to advance your career to the senior level, you might find Glenn Santos’ Senior Developer Roadmap helpful. This roadmap provides a comprehensive overview of the skills and knowledge required for a senior developer, covering areas such as programming languages, frameworks, development methodologies, and architecture patterns.Are you a backend developer looking to stay ahead of the curve in your field?2023-01-01T20:35:00+00:002023-01-01T20:35:00+00:00https://jnmanso.github.io/are_you_a_backend_developer_looking_to_stay_ahead_of_the_curve_in_your_field<p>Are you a backend developer looking to stay ahead of the curve in your field? <a href="https://roadmap.sh/backend">Roadmap.sh</a> is the perfect resource for you! This site provides a comprehensive roadmap for backend developers, covering the latest technologies, best practices, and industry trends.</p>
<p>With <a href="https://roadmap.sh/backend">Roadmap.sh</a>, you can find the information you need to master the backend development landscape. Whether you are just starting out or looking to expand your skills, Roadmap.sh provides a clear and actionable path for your development journey.</p>
<p>The site is divided into several key categories, each focusing on a specific area. For example, you can find resources on databases, server-side frameworks, and API development. Each category is filled with practical tips, tutorials, and resources to help you learn and grow as a backend developer.</p>
<p>So, whether you are looking to learn a new technology, brush up on your skills, or stay on top of the latest industry trends, Roadmap.sh has got you covered! Head over to the site today and start your journey to becoming a top-notch backend developer.</p>
<p><img src="/assets/images/2023/01/backend.jpg" alt="Backend developer roadmap" /></p>João MansoAre you a backend developer looking to stay ahead of the curve in your field? Roadmap.sh is the perfect resource for you! This site provides a comprehensive roadmap for backend developers, covering the latest technologies, best practices, and industry trends.