Introduction
OceanBase is a distributed relational database developed by Ant Group. It handles both transactional and analytical queries in a single engine, targeting financial services and large-scale enterprise environments that demand high availability and strong consistency.
What OceanBase Does
- Provides MySQL and partial Oracle SQL compatibility for migration ease
- Scales horizontally across commodity servers with automatic data sharding
- Delivers multi-tenant resource isolation for SaaS and cloud platforms
- Supports hybrid transactional and analytical processing (HTAP) in one engine
- Offers transparent failover with Paxos-based consensus and zero data loss
Architecture Overview
OceanBase partitions tables across multiple nodes using a range or hash strategy. Each partition is replicated via a Paxos group to ensure majority-commit durability. The SQL engine compiles queries into distributed execution plans, pushing predicates and aggregations to storage nodes. A compaction scheduler merges incremental writes from a MemTable (LSM-based) into baseline SSTable data, keeping read latency predictable.
Self-Hosting & Configuration
- Deploy via Docker for single-node evaluation or OBD (OceanBase Deployer) for clusters
- Minimum recommended: 4 CPU cores, 10 GB RAM, 50 GB disk per node for testing
- Configure tenant resources with CREATE RESOURCE POOL to control CPU and memory quotas
- Set primary_zone to control leader placement across availability zones
- Enable log archiving and backup with ALTER SYSTEM for disaster recovery
Key Features
- Paxos-based replication with automatic leader election and zero RPO failover
- Native multi-tenancy isolates CPU, memory, and I/O between workloads
- Online DDL allows schema changes without locking production traffic
- Built-in data compression reduces storage costs by 50-70% compared to MySQL
- TPC-C and TPC-H benchmark record holder demonstrating both OLTP and OLAP performance
Comparison with Similar Tools
- TiDB — Also MySQL-compatible distributed SQL; uses Raft instead of Paxos and separates storage (TiKV) from compute
- CockroachDB — PostgreSQL-compatible distributed SQL; stronger in global multi-region deployments but lacks Oracle compatibility mode
- YugabyteDB — PostgreSQL-compatible with Raft consensus; lighter operational footprint but smaller ecosystem
- Vitess — MySQL sharding middleware rather than a full database engine; requires more manual shard management
- StarRocks — Focused on OLAP analytics only; not designed for transactional workloads
FAQ
Q: Can OceanBase replace MySQL without code changes? A: OceanBase supports most MySQL 5.7/8.0 syntax and protocols. Applications using standard MySQL connectors typically work with minimal changes, though some MySQL-specific features like certain storage engine hints may differ.
Q: What is the minimum cluster size? A: A single-node Docker deployment works for development. Production clusters typically use three or more nodes for Paxos majority consensus and fault tolerance.
Q: How does multi-tenancy work? A: OceanBase creates isolated tenants within one cluster, each with its own resource pool (CPU, memory, disk). Tenants share the same physical infrastructure but cannot access each other's data.
Q: Is OceanBase fully open source? A: OceanBase Community Edition is released under MulanPubL-2.0, a license approved by OSI. The Enterprise Edition adds commercial features like Oracle compatibility mode and advanced tooling.