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.

In the figure, APP is the business application. Three ODP nodes (the ODP process is named obproxy) are deployed in front of APP. In actual deployment, a load balancer (such as F5) is generally deployed between ODP and APP to distribute requests to multiple ODP nodes. OBServer nodes are deployed below ODP. The figure shows six OBServer nodes.
The reasons why ODP is required are as follows:
Connection management: An OceanBase cluster is large in scale, and machine failures, software issues, or O&M operations such as bringing machines online or offline are common. If a client directly connects to an OBServer node, the client may be disconnected when such situations occur. ODP masks the distributed complexity of OBServer nodes. When a client connects to ODP, ODP ensures connection stability and handles the complex state of OBServer nodes internally.
Data routing: ODP can obtain data distribution information on OBServer nodes and efficiently forward user SQL to the machine where the data resides, improving execution efficiency. For example, in the figure, the data of table t1 is in P1, the data of table t2 is in P2, and the data of table t3 is in P3. For an "insert into t1" statement, ODP can forward the SQL to the machine in ZONE_2 that contains the P1 leader. For an "update t2" statement, ODP can forward the SQL to the machine in ZONE_1 that contains the P2 leader.
Based on ODP, a distributed database can be used in a similar manner as a standalone database.
ODP features
ODP is a key component of OceanBase Database and has the following features:
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 involved in each user request, the read/write split routing strategy configured by users, the optimal path for multi-region deployment of OceanBase Database, and the status and load of each OBServer node. ODP routes user requests to the optimal OBServer node, maximizing the overall high-performance operation of OceanBase Database.
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 ODP in real time by using various internal commands, which greatly facilitates O&M operations.
License
ODP Community Edition is fully open source under Mulan PubL-2.0. You can copy and use the source code free of charge. When you modify or distribute the source code, you must comply with the Mulan license.