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
Newsletter
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
  • Compliance Automated Standard Solution (COMPASS), Part 10: How OSCAL Mapping Paves the Way for Continuous Compliance Scalability
  • When Retries Become a Denial-of-Wallet

Trending

  • Building a Real Pipeline With senro: Monorepos, Caching, and Triggers
  • Building IoT Time-Series Applications With Java and Apache IoTDB
  • Member Spotlight: Raghava Dittakavi
  • MQTT, Kafka, NATS, or Zenoh? Choosing Edge-to-Cloud Messaging by Traffic Pattern

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  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
DZone Core CORE ·
May. 15, 23 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
5.0K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

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
  • Compliance Automated Standard Solution (COMPASS), Part 10: How OSCAL Mapping Paves the Way for Continuous Compliance Scalability
  • When Retries Become a Denial-of-Wallet

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • 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