OceanBase Database is a distributed database. This makes it different from traditional standalone databases. In OceanBase Database, each table or table partition may be stored on a different server. To read data from or write data to a table, the system must first locate the leader and follower replicas of the table or partition that contains the data, and then execute the SQL DML statement. This is almost impossible to implement at the application level. OBProxy is a reverse proxy designed for OceanBase Database. Its core feature is to route the data requests from the client to the right OBServer.
The following figure shows how a client request accesses OceanBase Database through OBProxy. The user sends a request from a client. The request is forwarded by a load-balancing module to a stateless OBProxy, which then forwards the request to the optimal OBServer in the backend OceanBase cluster. Note
The load-balancing module can be any common product, such as SLB and F5.
OBProxy is just a reverse proxy. It is not responsible for sharding. It does not generate or schedule execution plans as an SQL engine does.
Each OBServer contains a complete SQL engine and a storage engine. These engines are used to parse the SQL statements that you executed to generate and execute physical execution plans for these statements. The distributed OBServers use the Paxos protocol to ensure high availability. In this architecture design, OBProxy only performs routing and provides disaster recovery capabilities. OBSever incorporates all the database features. This division of responsibilities is clear and simple. It increases the performance of each component and helps OceanBase Database perform almost as well as a standalone database.
OBProxy can accurately forward a request to a leader. You can also configure OBProxy to support write/read splitting or read data first from a follower. In addition, when an OBServer is down, being upgraded, or is undergoing a major compaction, OBProxy uses its blacklist mechanism to forward requests to a functioning OBServer.