<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: propainter</title>
    <description>The latest articles on DEV Community by propainter (@propainter).</description>
    <link>https://dev.to/propainter</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F517357%2F4e415429-702e-4259-8bc7-b1963b46e492.jpeg</url>
      <title>DEV Community: propainter</title>
      <link>https://dev.to/propainter</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/propainter"/>
    <language>en</language>
    <item>
      <title>Uber/OLA System Design</title>
      <dc:creator>propainter</dc:creator>
      <pubDate>Tue, 26 Dec 2023 09:34:45 +0000</pubDate>
      <link>https://dev.to/propainter/uberola-system-design-547l</link>
      <guid>https://dev.to/propainter/uberola-system-design-547l</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9jtvU-iI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8idgkxrjrkfmynmulax4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9jtvU-iI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8idgkxrjrkfmynmulax4.png" alt="Final Design System design uber ola" width="800" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u4xSHSWp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m4iomf047b0akhrxhlnf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u4xSHSWp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m4iomf047b0akhrxhlnf.png" alt="System design uber ola, communication websocket vs http" width="800" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LAboVFp2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xtgf4r2wwa4exoh860bb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LAboVFp2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xtgf4r2wwa4exoh860bb.png" alt="System design uber ola, map geo hashing" width="800" height="1833"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jHMFY8ql--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qwtrmmkyjr23dvp76c5b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jHMFY8ql--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qwtrmmkyjr23dvp76c5b.png" alt="System design uber ola, user design Flow" width="800" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Understanding CAP theorem</title>
      <dc:creator>propainter</dc:creator>
      <pubDate>Mon, 30 Oct 2023 10:34:50 +0000</pubDate>
      <link>https://dev.to/propainter/understanding-cap-theorem-47f</link>
      <guid>https://dev.to/propainter/understanding-cap-theorem-47f</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i4b5Wo2h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ft6x4bhc1plgqxwfjnvm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i4b5Wo2h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ft6x4bhc1plgqxwfjnvm.png" alt="Image description" width="800" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After having long session with my study group I am collecting major points here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Notes from discussion:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;NoSQL Landscape&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;key-value store:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Regular:&lt;/strong&gt; memcached, Redis, Flare, AmazonSimpleDB, Keyspace...&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Eventual consistency:&lt;/strong&gt; Amazon Dynamo&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;column-oriented stores:&lt;/p&gt;

&lt;p&gt;GoogleBigTable, HBase, Cassandra, HyperTable, QBase&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Document Databases:&lt;/p&gt;

&lt;p&gt;CouchDB, MongoDB, ...&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Object Datastores:&lt;/p&gt;

&lt;p&gt;Amazon S3&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Graph Databases:&lt;/p&gt;

&lt;p&gt;Neo4j, VertexDB, Filament ...&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;link for blog post:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://bardoloi.com/blog/2017/03/06/cap-theorem/#:%7E:text=In%20other%20words%2C%20the%20CAP,C%20or%20A%20by%20design.&amp;amp;text=there%20can%20be%20several%20levels%20of%20consistency"&gt;https://bardoloi.com/blog/2017/03/06/cap-theorem/#:~:text=In%20other%20words%2C%20the%20CAP,C%20or%20A%20by%20design.&amp;amp;text=there%20can%20be%20several%20levels%20of%20consistency&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;From the point of view of data intensive applications&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Consistency:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All clients have same view of data at same time&lt;/li&gt;
&lt;li&gt;Note actually ACID transactions in db&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Partition-tolerance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;System continues to operate despite network partitions.&lt;/li&gt;
&lt;li&gt;No single point of failure&lt;/li&gt;
&lt;li&gt;Infinite scale out&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Availability:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each client can always read and write&lt;/li&gt;
&lt;li&gt;Total redundancy&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;What does a traditional CAP theorem says?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A distributed system can satisfy any two of these guarantee at same time but not all&lt;/p&gt;

&lt;p&gt;1) There is some risk of data becoming unavailable. [MongoDB, Hbase, Neo4j, Google BigTable]  - CP&lt;/p&gt;

&lt;p&gt;2) Network problem might stop system. Eg: RDBMS, Orable db, Mysql,..  - CA&lt;/p&gt;

&lt;p&gt;3) Client may read inconsistent data .[ Like eventual consistency in Cassandra Db]  - AP&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  BUT !!
&lt;/h3&gt;

&lt;p&gt;Can we really compromise the partition tolerance?&lt;/p&gt;

&lt;p&gt;The future of databases is primarily based on distribution. (Big Data trends ..)&lt;/p&gt;

&lt;p&gt;A proper understanding of CAP theorem is essential to making decisions about the future of distributed database design. Misunderstanding can lead to inappropriate design choices.&lt;/p&gt;

&lt;p&gt;Though the ACID (atomicity, Consistency, Isolation, Durability) properties of Relation Databases are powerful and we would like to have them in our database. But its unfortunately impossible to have availability , consistency &amp;amp; partition tolerance all in at once.   ....  Well really? 🤔&lt;/p&gt;

&lt;p&gt;Popular misconception is 2 or of 3. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;An important observation is that in larger distributed-scale systems, network partitions are a given; therefore, consistency and availability cannot be achieved at the same time&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;12 Years later: Prof Eric - father of CAP theorem&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; The 2 of 3 formula was always misleading because it tends to oversimplify the tensions among properties. Its not a 0 or 1 game.

CAP prohibits only a tiny part of design space: perfect availability and consistency in presence of partitions, which are rare.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;availability is inverse of latency / latency is inverse of availability&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Proposition: Make partition tolerance a must to have and dissolve rigidity in terms of consistency and availability.&lt;/p&gt;

&lt;h3&gt;
  
  
  Consistency
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Types of Consistency&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Strong Consistency&lt;/p&gt;

&lt;p&gt;After update competes, any subsequent access will return same updated value.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Weak Consistency&lt;/p&gt;

&lt;p&gt;Its is not guaranteed that subsequent accesses will return the updated value.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Eventual Consistency&lt;/p&gt;

&lt;p&gt;Specific form of weak consistency. 0 → 1&lt;/p&gt;

&lt;p&gt;Its guaranteed that if no new updates are made to object, eventually all accesses will return the last updated value (eg. propagate updates to replicas in a lazy fashion)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Eventual Consistency:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tweets feed

&lt;ul&gt;
&lt;li&gt;Lots of users are refreshing latest tweets. But its okay to show them stale data for some time as eventually all of them will be viewing latest tweets.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Offline money withdraw allowed from ATM (with limit)

&lt;ul&gt;
&lt;li&gt;Though banks transaction need to be highly consistent. But when you have to perform an ACID transaction with only single node you are talking to (for the instance ).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Dynamic Consistency:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Airlines Booking&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Partition
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Data partitioning

&lt;ul&gt;
&lt;li&gt;shopping cart data, product data, user data, etc&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Operational partitioning

&lt;ul&gt;
&lt;li&gt;customer query, billing desk&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Services/Functional partitioning

&lt;ul&gt;
&lt;li&gt;Microservices, DNS, distributed Lock ,&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;User Partitioning

&lt;ul&gt;
&lt;li&gt;regions / availability zones, geographic areas&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Availability
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;High availability = less latency&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;By replicating data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;unavailable things have extreme high latency&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;link for blog post:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.allthingsdistributed.com/2008/12/eventually_consistent.html"&gt;https://www.allthingsdistributed.com/2008/12/eventually_consistent.html&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Resources&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://hub.packtpub.com/the-cap-theorem-in-practice-the-consistency-vs-availability-trade-off-in-distributed-databases/"&gt;https://hub.packtpub.com/the-cap-theorem-in-practice-the-consistency-vs-availability-trade-off-in-distributed-databases/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.notion.so/Revisiting-CAPs-ffb4eb5e224c46ba96998ac1da0a047f?pvs=21"&gt;https://www.notion.so/himanshug/Revisiting-CAPs-ffb4eb5e224c46ba96998ac1da0a047f#bddc9791a0944635ac7acbbab4e81dd1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/CAP_theorem"&gt;https://en.wikipedia.org/wiki/CAP_theorem&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💡 Notes &lt;br&gt;
Last Reviewed : 30 Oct, 7am&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
