DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Designing High-Performance APIs
  • Migrating From MySQL to YugabyteDB Using YugabyteDB Voyager
  • When Retries Become a Denial-of-Wallet
  • The Hidden Latency of Autoscaling

Trending

  • Stop Running Two Data Systems for One Agent Query
  • Integrating AI-Driven Decision-Making in Agile Frameworks: A Deep Dive into Real-World Applications and Challenges
  • Implementing Secure API Gateways for Microservices Architecture
  • Architecting an Embedded Efficiency Layer: A Platform Deep Dive into Day-Two Operational Tuning
  1. DZone
  2. Software Design and Architecture
  3. Performance
  4. Improve Application Latency With Read Replicas Using YugabyteDB [Video]

Improve Application Latency With Read Replicas Using YugabyteDB [Video]

Learn how to optimize read latency for users worldwide by utilizing YugabyteDB's read replica nodes. Achieve scalability and low latency for real-time data.

By 
Denis Magda user avatar
Denis Magda
DZone Core CORE ·
May. 15, 23 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
4.8K Views

Join the DZone community and get the full member experience.

Join For Free

Scalability and low latency are crucial for any application that relies on real-time data. One way to achieve this is by storing data closer to the users.

In this post, we'll discuss how you can use YugabyteDB and its read replica nodes to improve the read latency for users across the globe. 

Whether you prefer reading or watching, let’s walk through a practical example using an application that streams market orders to see how you can achieve low latency for reads regardless of a user's location.

YugabyteDB Managed Cluster

Let's say you have a YugabyteDB Managed cluster consisting of three nodes running in the United States.

YugabyteDB Managed cluster consisting of three nodes running in the United States.

Next, assume the following:

  1. You start the application that connects to this cluster and streams market orders into the database.
  2. A user from the United States opens a database connection and queries for the most popular stocks. In this case, the latency will be around 20 milliseconds.
  3. However, if a different user from Southeast Asia sends the same query, the latency will be much higher—around 190 milliseconds.

Increased latency for users from distant locations

The increased latency for users from distant locations, such as Southeast Asia, can negatively impact the experience. One of the options to tackle this issue is by storing data closer to the users with read replicas.

Deploying Read Replica

Read replicas store a full or partial copy of the primary database. Directing read queries from the users to the nearest read replica makes it possible to improve the read latency significantly.

Let’s add a replica node to the USA-based YugabyteDB Managed cluster to demonstrate how replicas work in practice. The replica will be added to the asia-east1 region. 

Follow these steps to set up your replica node:

  1. Navigate to your YugabyteDB Managed cluster dashboard.
  2. Click on "Configure Read Replicas."
  3. Select the "asia-east1" region.
  4. Confirm the configuration.

The replica node in Southeast Asia will be ready within a few minutes. Once the node becomes active in the specified region, it synchronizes with the main database to keep the data consistent.

Connecting Users to Nearby Replica Nodes

The next step is to connect the users from Southeast Asia to the newly deployed replica node in the asia-east1 region. Once that’s done, it's time to compare the latencies. 

Now, when users from Southeast Asia query for the most popular stocks again, the latency drops dramatically to 20 milliseconds – similar to the latency for the user from the United States. 

As a result, users from both locations will have a comparably better user experience thanks to the improved latency.

Summary

Read replicas can significantly improve the read latency for users in distant locations. By deploying replica nodes in different regions and connecting users to their nearest replica, you can match the experience for all of your users, regardless of where they are located.

Database connection Scalability YugabyteDB Performance improvement

Opinions expressed by DZone contributors are their own.

Related

  • Designing High-Performance APIs
  • Migrating From MySQL to YugabyteDB Using YugabyteDB Voyager
  • When Retries Become a Denial-of-Wallet
  • The Hidden Latency of Autoscaling

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook