OceanBase Database Proxy (ODP) is a dedicated proxy server for OceanBase Database. OceanBase Database stores replicas of user data on multiple OBServer nodes. When ODP receives an SQL statement from a user, ODP forwards the statement to the optimal OBServer node and returns the execution result to the user.
Why is ODP required?
Although ODP adds a hop to the database access link, ODP serves as a proxy server that provides various features and benefits. The following figure shows a sample deployment architecture where ODP is used.

As shown in the preceding figure, the application is a business application and is allocated with three ODP nodes that run obproxy processes. In actual deployment, a load balancer such as F5 is deployed between the ODP nodes and the application to distribute requests to multiple ODP nodes, to which OBServer nodes are connected. Six OBServer nodes are deployed in the sample deployment architecture.
The reasons why ODP is required are as follows:
Connection management: An OceanBase cluster contains a large number of OBServer nodes, with a high probability of OBServer node or software problems or connection status changes under maintenance. If one of the preceding exceptions occurs when a client is directly connected to an OBServer node, the connection will be closed. ODP masks the complexity of distributed OBServer nodes. If a client is connected to ODP, ODP can ensure the stability of the connection and manage the status of OBServer nodes in complex business scenarios.
Data routing: ODP can obtain information about data distribution on OBServer nodes and forwards an SQL statement of a user to the OBServer node where the required data is located. This improves execution efficiency. As shown in the preceding figure, the data of the t1, t2, and t3 tables is in P1, P2, and P3, respectively. ODP can forward the SQL statement "insert into t1" to the OBServer node that contains the P1 leader in Zone 2 and the SQL statement "update t2" to the OBServer node that contains the P2 leader in Zone 1.
Based on ODP, a distributed database can be used in a similar manner as a standalone database.
Benefits
ODP is a key component of OceanBase Database and provides the following benefits:
High-performance forwarding
ODP is fully compatible with the MySQL protocol and supports the proprietary protocol of OceanBase. It adopts the multi-threaded asynchronous framework and transparent streaming forwarding to ensure high-performance data forwarding. In addition, it consumes minimal cluster resources.
Optimal routing
ODP fully considers the location of replicas that are included in each user request, read/write split routing strategy configured by each user, optimal procedure for multi-region deployment of OceanBase Database, and the status and load of each OBServer node. ODP routes a user request to the optimal OBServer node and ensures the performance of OceanBase Database operations.
Connection management
For the physical connections of a client, ODP maintains its connections to multiple OBServer nodes at the backend. ODP also adopts the incremental synchronization solution based on version numbers to maintain the session status of connections to the OBServer nodes. This ensures efficient client access to each OBServer node.
Proprietary protocol
By default, ODP and OBServer nodes use the proprietary protocol of OceanBase. For example, ODP performs a cyclic redundancy check (CRC) on messages to ensure the correctness of connections to each OBServer node. ODP also enhances the transmission protocol to support Oracle-compatible data types and interaction models.
Security and reliability
ODP supports data access by using SSL and is compatible with the MySQL protocol to meet the security requirements of users.
Easy O&M
ODP is stateless and supports unlimited horizontal scale-out. It allows you to access multiple OceanBase clusters at the same time. You can monitor the status of OceanBase Database in real time by using various internal commands. This allows you to perform routine O&M in an efficient manner.
License
ODP Community Edition is fully open sourced under Mulan Public License, Version 2 (Mulan PubL v2). You can copy and use the source code free of charge. You must follow the requirements outlined in the license when you modify or distribute the source code.