<?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: Raja Upadhyay</title>
    <description>The latest articles on DEV Community by Raja Upadhyay (@rajaupadhyay96).</description>
    <link>https://dev.to/rajaupadhyay96</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%2F833820%2F9984a8c8-1513-4dc5-a922-711d5b91b4e6.jpg</url>
      <title>DEV Community: Raja Upadhyay</title>
      <link>https://dev.to/rajaupadhyay96</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rajaupadhyay96"/>
    <language>en</language>
    <item>
      <title>Storage and Retrieval</title>
      <dc:creator>Raja Upadhyay</dc:creator>
      <pubDate>Tue, 21 Jun 2022 06:31:35 +0000</pubDate>
      <link>https://dev.to/rajaupadhyay96/storage-and-retrieval-g1</link>
      <guid>https://dev.to/rajaupadhyay96/storage-and-retrieval-g1</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Indexes are used in databases to speed up reads. Any kind of index usually slows down writes, because the index also needs to be updated every time data is written. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A clustered index stores all row data within the index.&lt;br&gt;
A non-clustered index only stores the references (to heap file) to the data within the index.&lt;br&gt;
A covering index stores some of a table's columns within the index. This allows some queries to be answered using the index alone.&lt;/p&gt;

&lt;p&gt;Indexes duplicate data and although they speed up reads, they require additional storage and can add overhead on writes.&lt;/p&gt;

&lt;p&gt;Multi-column indexes enables efficient querying of multiple columns at once. e.g. a multi-column index on (date, temp) can be used to efficiently find all observations in 2013 where the temp was between 25 and 30 degrees. With a 1D index, you would have to either scan all records from 2013 and then filter (or vice vera).&lt;/p&gt;

&lt;h2&gt;
  
  
  In memory databases
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;The performance advantage of in-memory databases is not due to the fact that they don't need to read from disk - even a disk-based storage engine may not need to read from disk if there is enough memory since the OS caches recently used disk blocks in memory anyway. The performance advantage comes from not having to encode in-memory data structures in a format that can be written to disk.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  OLTP vs OLAP access pattern
&lt;/h2&gt;

&lt;p&gt;OLTP (Online Transaction Processing) is an access pattern that is widely used in interactive applications where records are inserted/updated based on user input e.g. actions in a game.&lt;/p&gt;

&lt;p&gt;OLAP (Online Analytics Processing) is an access pattern used for analytic queries and business intelligence.&lt;/p&gt;

</description>
      <category>ddia</category>
      <category>storage</category>
      <category>distributedsystems</category>
    </item>
    <item>
      <title>Data Models and Query Languages</title>
      <dc:creator>Raja Upadhyay</dc:creator>
      <pubDate>Mon, 09 May 2022 20:07:10 +0000</pubDate>
      <link>https://dev.to/rajaupadhyay96/data-models-and-query-languages-33jd</link>
      <guid>https://dev.to/rajaupadhyay96/data-models-and-query-languages-33jd</guid>
      <description>&lt;p&gt;In complex applications, APIs could be built upon APIs. Each data model hiding the complexity of the layers below it by providing a clean data model.&lt;/p&gt;

&lt;p&gt;One of the best data models known today is SQL, based on the relational model.&lt;/p&gt;

&lt;p&gt;Most application development today is done in object-oriented programming languages and therefore a translation layer is sometimes required between the objects in the application code and the database model of tables, rows and columns - &lt;em&gt;aka impedance mismatch&lt;/em&gt;. This is where object-relational mapping is used (e.g. of ORM is sqlalchemy in python).&lt;/p&gt;

&lt;p&gt;Using document stores or JSON representation can sometimes help reduce the impedance mismatch but this data model also has its disadvantages (to be explored further in later chapters).&lt;/p&gt;

&lt;p&gt;JSON representation has better locality than multi-table relational models. e.g. to obtain a piece of data you might need to perform multi-way joins in a relational database whereas in a document model, all the relevant information is in one place.&lt;/p&gt;

&lt;h2&gt;
  
  
  Relational vs Document Databases
&lt;/h2&gt;

&lt;p&gt;Document databases offer schema flexibility and better performance due to locality. Relational databases allow you to perform joins and support many-to-one and many-to-many relationships.&lt;/p&gt;

&lt;p&gt;If your application needs to access "entire" datasets then the locality of document databases can be advantageous. If data is split across multiple tables, multiple index lookups and joins can require more disk seeks and therefore add time.&lt;/p&gt;

&lt;p&gt;On the flip side, document databases typically load the entire document even if you only want to access a small portion of it.&lt;/p&gt;

&lt;p&gt;NB: Locality is not a feature offered only by document databases. Google Spanner DB offers locality properties by allowing schema to declare that a table's rows should be interleaved within a parent table. Other such offerings also exist.&lt;/p&gt;

&lt;h2&gt;
  
  
  Query Languages for Data
&lt;/h2&gt;

&lt;p&gt;Imperative programming languages describes the exact operations and the order of those operations (e.g. Python, JS etc). Declarative languages (e.g. SQL) on the other hand just describe the data you want, any conditions the results must meet and any transformations (e.g. group by). It is up to the database system's query optimiser to decide how to achieve the result (using joins, indexes etc).&lt;/p&gt;

&lt;p&gt;Declarative languages have a better chance of faster parallel execution since they only specify the pattern of results and not the actual algorithm to obtain the results.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(summary of chapter 2 from Designing Data-Intensive Applications by Martin Kleppmann)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ddia</category>
      <category>distributedsystems</category>
      <category>summary</category>
    </item>
    <item>
      <title>Reliability, Scalability and Maintainability</title>
      <dc:creator>Raja Upadhyay</dc:creator>
      <pubDate>Thu, 24 Mar 2022 19:31:30 +0000</pubDate>
      <link>https://dev.to/rajaupadhyay96/reliability-scalability-and-maintainability-3bod</link>
      <guid>https://dev.to/rajaupadhyay96/reliability-scalability-and-maintainability-3bod</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Reliability: The system should continue working correctly even when things go wrong e.g. the system should be able to deal with the user making mistakes.&lt;/li&gt;
&lt;li&gt;Scalability: The system should be able to serve it's users as the userbase grows.&lt;/li&gt;
&lt;li&gt;Maintainability: Many people will work on a given system and this should be as productive as possible.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Load&lt;/strong&gt;&lt;br&gt;
We can define the load on a system using load parameters and this varies from system to system.&lt;br&gt;
Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Requests per second to a web server&lt;/li&gt;
&lt;li&gt;Number of concurrent users&lt;/li&gt;
&lt;li&gt;Hit rate on a cache&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Latency vs Response Time&lt;/strong&gt;&lt;br&gt;
Response time is what the client sees (the time taken to process the request). Latency is the duration during which a request is waiting to be handled (awaiting service).&lt;/p&gt;

&lt;p&gt;When discussing response times, using percentiles is better than just describing the average response time. The average does not provide an idea of how many users actually experience that delay. High percentile of response times (e.g. 99.9th percentile) aka tail latencies are important as they affect the users experience of the service.&lt;/p&gt;

&lt;p&gt;Percentiles are often used in SLAs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Coping with load&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Vertical scaling: moving to a more powerful machine&lt;/li&gt;
&lt;li&gt;Horizontal scaling: distributing load across multiple machines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Elastic systems involve scaling horizontally once an increase in load is detected.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Maintainability&lt;/strong&gt;&lt;br&gt;
A maintainable system is one that is easy to operate (easy for ops teams to keep the system running smoothly), simple to understand for new engineers and is easily extensible or evolvable.&lt;/p&gt;

&lt;p&gt;(&lt;em&gt;summary of chapter 1 from Designing Data-Intensive Applications by Martin Kleppmann&lt;/em&gt;)&lt;/p&gt;

</description>
      <category>ddia</category>
      <category>systems</category>
      <category>distributedsystems</category>
    </item>
  </channel>
</rss>
