databases

17 articles

Cover illustration for Master Slave Replication (Single Leader Replication)

Master Slave Replication (Single Leader Replication)

In database replication, master-slave replication is also known as active/passive or leader-based replication. There are two types of nodes in this architecture: Master and slave. The single master (leader) node works as the primary database, while one or more slave (follower) nodes maintain copies of the Master’s data.

Cover illustration for Database Replication Introduction, Types and Advantages

Database Replication Introduction, Types and Advantages

In distributed systems, database replication is the process of keeping multiple copies of the same data in different servers (replicas) so that if one server goes down, other servers can continue to serve data without any interruption or downtime. Database replication provides several advantages like high performance, availability, and reliability.

Cover illustration for Introduction to Caching and Caching Strategies

Introduction to Caching and Caching Strategies

Caching is the process of storing the results of a request in a cache or a temporary storage location so they can be accessed more quickly. In this blog, we have discussed: 1) How caching works? 2) Real-life examples of caching 3) Types of caching 4) Cache eviction policies 5) The idea of cache invalidation 6) Advantages and disadvantages of caching.

Cover illustration for Caching Strategy: Write-Behind (Write-Back) Pattern

Caching Strategy: Write-Behind (Write-Back) Pattern

Write-behind (write-back) caching pattern is similar to the write-through cache with one big difference: data written to the cache is asynchronously updated in the database. In other words, application will first write to the cache and cache will write to the database after some delay. This asynchronous update will help us to reduce the latency of write operations.

Cover illustration for Caching Strategy: Write-Around Pattern

Caching Strategy: Write-Around Pattern

In write-around caching, when application write new data, it bypasses the cache and directly write it to the database. So data is not stored in the cache during the write operation. When there is a cache miss during a read request, cache will fetch data from the database, update its entry and return data to the application.

Cover illustration for Caching Strategy: Refresh Ahead Pattern

Caching Strategy: Refresh Ahead Pattern

Refresh-ahead cache asynchronously refreshes the most recent version of data from the database before the expiration. The refresh operation is done on a consistent time interval by some background job. So refresh-ahead cache ensures that data that are likely to be accessed soon are available in the cache before they expire. This will help to reduce the read latency of frequently accessed data.