OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database Proxy

V4.2.0Community Edition

  • What is ODP?
  • Installation and deployment
    • Deploy ODP by using OBD
    • Deploy ODP by using OCP
    • Deploy ODP by using the CLI
    • Deployment modes
  • Basic operations
  • Configuration parameter
    • Parameter description
    • Dynamically modifiable parameters
    • Parameters that are not dynamically modifiable
    • Internal and inherited parameters
    • In-memory parameters
  • Connection management
    • Principles
    • Session status synchronization
    • Client session
    • Server session
  • Data routing
    • Factors affecting data routing
    • Routing strategies
    • ODP routing
    • Intra-tenant routing
    • Read/Write separation
    • Follower latency threshold
  • High availability mechanism
    • Overview
    • High availability of ODP services
    • High availability of OceanBase Database
    • High availability testing
  • Security and protocols
  • Operation and maintenance
    • Troubleshooting
      • Troubleshooting logic
      • Monitoring logs
    • Performance analysis
    • Show Trace

Download PDF

What is ODP? Deploy ODP by using OBD Deploy ODP by using OCP Deploy ODP by using the CLI Deployment modes Basic operations Parameter description Dynamically modifiable parameters Parameters that are not dynamically modifiable Internal and inherited parameters In-memory parameters Principles Session status synchronization Client session Server session Factors affecting data routing Routing strategies ODP routing Intra-tenant routing Read/Write separation Follower latency threshold Overview High availability of ODP services High availability of OceanBase Database High availability testing Security and protocols Troubleshooting logic Monitoring logs Performance analysis Show Trace
OceanBase logo

The Unified Distributed Database for the AI Era.

Follow Us
Products
OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
Resources
DocsBlogLive DemosTraining & Certification
Company
About OceanBaseTrust CenterLegalPartnerContact Us
Follow Us

© OceanBase 2026. All rights reserved

Cloud Service AgreementPrivacy PolicySecurity
Contact Us
Document Feedback
  1. Documentation Center
  2. OceanBase Database Proxy
  3. V4.2.0
iconOceanBase Database Proxy
V 4.2.0Community Edition
  • V 4.3.6
  • V 4.3.4
  • V 4.3.3
  • V 4.3.2
  • V 4.3.1
  • V 4.3.0
  • V 4.2.3
  • V 4.2.2
  • V 4.2.0 and earlier
Community Edition
  • V 4.2.0
  • V 4.1.0
  • V 4.0.0
  • V 3.1.0

Follower latency threshold

Last Updated:2023-10-10 02:43:33  Updated
share
What is on this page
Background
Introduction
Considerations
Examples

folded

share

Background

OceanBase Database Proxy (ODP) may forward weak-consistency read requests to a follower. Especially in a read/write splitting scenario, ODP will first forward weak-consistency read requests to a follower. A latency exists between the data saved by a follower and the latest data in the leader. A weak-consistency read request may not read the latest data from a follower.

Generally, a short latency is acceptable in weak-consistency read scenarios, but a long latency is unacceptable in actual business scenarios. In the scenario shown in the following figure, the latency of the data read by the follower is unacceptable for the client, and the client cannot perceive or control the latency of the data read by a weak-consistency read request.

Figure 1

ODP and OceanBase Database provide the follower latency threshold feature to address this issue.

Introduction

The follower latency threshold feature allows you to control the maximum latency of the data read by weak-consistency read requests. Based on the timeout feedback from an OBServer node, ODP forwards the weak-consistency read requests that exceed the latency threshold to other OBServer nodes.

In the preceding scenario, the latency of the OBServer1 node does not meet the expectation of the client. When a weak-consistency request is forwarded to OBServer1, OBServer1 will provide timeout feedback. Then, ODP will route this request to OBServer3. The following figure shows the result.

Figure 2

Considerations

You must set the following parameters to adjust the follower latency threshold feature.

  1. read_stale_retry_interval: specifies the time for clearing the latency tags of replicas. The default value is 5s. This is a parameter of ODP.

  2. ob_max_read_stale_time: specifies the maximum latency allowed for data read by weak-consistency read requests. The default value is -1, indicating that this feature is disabled. This is a parameter of ODP. OceanBase Database perceives data latency based on weak-consistency read version numbers. Therefore, the value of this parameter must not be smaller than the refresh interval of weak-consistency read version numbers in OceanBase Database.

  3. weak_read_version_refresh_interval: specifies the refresh interval for weak-consistency read version numbers. This is a parameter of OceanBase Database. The default value is 100 ms in OceanBase Database V4.0.0 and later, and is 50 ms in versions earlier than OceanBase Database V4.0.0. For more information, see weak_read_version_refresh_interval in the OceanBase Database documentation.

Note

  • This feature depends on the OceanBase 2.0 protocol.

  • If a data partition has a latency on all followers, ODP will forward all requests that access this data partition to the leader.

Examples

  1. Query the value of the weak_read_version_refresh_interval parameter of OceanBase Database and make sure that the value of ob_max_read_stale_time is not smaller than that of weak_read_version_refresh_interval.

    obclient> show parameters like 'weak_read_version_refresh_interval';
    | zone  | svr_type | svr_ip        | svr_port | name                               | data_type | value | info                                                                       | section  | scope   | source  | edit_level        |
    +-------+----------+-------------+----------+------------------------------------+-----------+-------+----------------------------------------------------------------------------+----------+---------+---------+-------------------+
    | zone1 | observer | 10.10.10.1  |     2882 | weak_read_version_refresh_interval | NULL      | 100ms | the time interval to refresh cluster weak read version Range: [50ms, +∞)   | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
    | zone3 | observer | 10.10.10.3 |     2882 | weak_read_version_refresh_interval | NULL      | 100ms | the time interval to refresh cluster weak read version Range: [50ms, +∞)   | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
    | zone2 | observer | 10.10.10.2  |     2882 | weak_read_version_refresh_interval | NULL      | 100ms | the time interval to refresh cluster weak read version Range: [50ms, +∞)   | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
    +-------+----------+-------------+----------+------------------------------------+-----------+-------+----------------------------------------------------------------------------+----------+---------+---------+-------------------+
    
  2. Log on to the proxysys tenant as the root user and turn on threshold settings related to weak-consistency read.

    obclient> alter proxyconfig set enable_ob_protocol_v2=true;
    Query OK, 0 rows affected
    
    obclient> alter proxyconfig set enable_reroute='true';
    Query OK, 0 rows affected
    
    obclient> alter proxyconfig set ob_max_read_stale_time='800ms';
    Query OK, 0 rows affected
    
  3. In normal cases, the data latency does not exceed the specified value (800 ms) of the ob_max_read_stale_time parameter. The following example sets the NIC latency for the node where the weak-consistency read replica resides to achieve the target data latency.

    obclient> select svr_ip, sql_port from oceanbase.__all_virtual_proxy_schema where tenant_name = 'mysql' and database_name = 'test' and table_name = 'test' and sql_port > 0 AND role = 2;
    +------------+----------+
    | svr_ip     | sql_port |
    +------------+----------+
    | 10.10.10.2 |     2881 |
    | 10.10.10.3 |     2881 |
    +------------+----------+
    2 rows in set
    
  4. Initiate a weak-consistency request.

    obclient> select /*+READ_CONSISTENCY(WEAK)*/ * from test where c2 = 10;
    Empty set
    
  5. Query the latency tagging records of the weak-consistency read replica.

    obclient> show proxysession read_stale;
    +-----------------+----------+--------------+----------------------------+
    | server_addr     | table_id | partition_id | feedback_time              |
    +-----------------+----------+--------------+----------------------------+
    | 10.10.10.2:2881 |   500003 |       200002 | 2023-06-25 11:18:03.129081 |
    +-----------------+----------+--------------+----------------------------+
    
  6. Weak-consistency read requests of this partition will no longer be forwarded to this replica within the latency clearing time of this replica, which is specified by the read_stale_retry_interval parameter.

  7. After the time specified by read_stale_retry_interval elapses, ODP will try to forward requests to the tagged replica. If this replica still has a latency, the OBServer node will continue to return weak-consistency read latency feedback. If this replica has got rid of the latency, requests are normally processed.

Previous topic

Read/Write separation
Last

Next topic

Overview
Next
What is on this page
Background
Introduction
Considerations
Examples