DEV.co
Open-Source Databases · XiaoMi

Gaea

Gaea is a MySQL proxy middleware developed by Xiaomi that provides database routing, sharding, and read-write separation. It is production-deployed across Xiaomi's consumer, automotive, IoT, fintech, and internet businesses and supports multi-tenant, multi-cluster configurations.

Source: GitHub — github.com/XiaoMi/Gaea
2.8k
GitHub stars
451
Forks
Go
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
RepositoryXiaoMi/Gaea
OwnerXiaoMi
Primary languageGo
LicenseApache-2.0 — OSI-approved
Stars2.8k
Forks451
Open issues67
Latest releasev2.4.2 (2024-09-20)
Last updated2026-03-18
Sourcehttps://github.com/XiaoMi/Gaea

What Gaea is

Go-based MySQL protocol proxy implementing sharding (mycat-compatible partitioning, kingshard-compatible table sharding), connection pooling, SQL routing, slow query fingerprinting, and load balancing. Uses TiDB parser for SQL analysis and etcd + gaea-cc for centralized cluster configuration management.

Quickstart

Get the Gaea source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/XiaoMi/Gaea.gitcd Gaea# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Large-scale MySQL sharding deployments

Organizations managing large datasets across multiple MySQL instances benefit from transparent sharding with mycat and kingshard routing compatibility, aggregation functions, and join support across shards.

Read-write separation at scale

Systems requiring replica load balancing and primary-replica routing can leverage built-in read-write separation with configurable replica selection and connection pooling.

Multi-tenant SaaS platforms

Gaea's explicit multi-tenant support, namespace-based isolation, and centralized configuration management via etcd suit platforms serving multiple isolated customer databases.

Implementation considerations

  • etcd cluster and gaea-cc service are required for centralized configuration and must be deployed, monitored, and backed up alongside Gaea instances.
  • Sharding key selection and routing rules must be carefully designed during schema planning; resharding and data rebalancing are manual processes not yet fully automated.
  • Connection pool tuning, slow query fingerprinting, and SQL filtering rules should be tested in staging to avoid production query rejection or performance regression.
  • Prepare statement support and transaction semantics differ from direct MySQL; comprehensive testing of application ORM/driver compatibility is essential.
  • Documentation is primarily in Chinese; non-Chinese teams should allow time for translation and deeper design document review.

When to avoid it — and what to weigh

  • No distributed transaction support — Applications requiring ACID guarantees across shards should not rely on Gaea; distributed transactions are on the roadmap but not yet implemented.
  • Early-stage products with minimal ops — Small teams without dedicated database operations expertise may find the multi-cluster, etcd, and gaea-cc operational overhead excessive for single-cluster deployments.
  • Non-MySQL databases required — Gaea is MySQL-protocol-specific; it cannot proxy PostgreSQL, MongoDB, or other database systems.
  • Extreme low-latency requirements — Proxy overhead and routing logic add latency; use cases demanding sub-millisecond query response times should benchmark carefully or use direct database connections.

License & commercial use

Licensed under Apache License 2.0, a permissive OSI-approved license permitting commercial use, modification, and distribution with appropriate attribution.

Apache-2.0 is a permissive open-source license allowing commercial use and derivative works. However, conduct an internal review to confirm compliance with your organization's open-source policies and ensure proper attribution.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityModerate
DEV.co fitGood
Assessment confidenceHigh
Security considerations

IP/IP-segment whitelist and custom SQL interception/filtering are available for access control and query validation. No third-party security audit findings disclosed. Gaea-cc HTTP API requires careful network isolation. SQL fingerprinting and slow query logging may expose query patterns in logs; log access should be restricted. etcd cluster security (TLS, authentication) must be independently configured and maintained.

Alternatives to consider

Vitess (YouTube's MySQL proxy)

Mature, widely adopted, supports resharding automation and more advanced distributed transaction semantics; steeper learning curve and heavier operational footprint.

MySQL Router

Oracle-backed, simpler setup for read-write separation and basic routing without custom sharding; less flexible for multi-tenant or complex sharding scenarios.

ProxySQL

Lightweight, rule-based SQL routing with lower overhead; suitable for read-write splitting and simple traffic management but lacks native sharding intelligence.

Software development agency

Build on Gaea with DEV.co software developers

Gaea is a production-proven MySQL proxy for complex sharding and multi-tenant deployments. Contact our team to discuss architecture fit, integration planning, and operational readiness for your use case.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Gaea FAQ

Does Gaea support distributed transactions?
Not yet. Distributed transactions are listed as a planned feature. Current deployments must handle transaction logic at the application level or use single-shard transactions only.
Can I migrate from mycat or kingshard?
Yes. Gaea routing is intentionally compatible with mycat (sharding) and kingshard (table sharding) configurations, easing migration. Refer to compatibility documentation and test thoroughly in staging.
What is the performance overhead?
Gaea 2.3.7 performance test report is available in the repository. Proxy latency depends on routing complexity, connection pool efficiency, and underlying MySQL performance; benchmark with your workload.
Is gaea-cc required for single-cluster deployments?
gaea-cc and etcd provide centralized configuration management and hot-reload; single-cluster deployments benefit from these but can operate with local configuration files if etcd unavailability is acceptable.

Work with a software development agency

Need help beyond evaluating Gaea? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and open-source databases integrations — and maintain them long-term.

Ready to evaluate Gaea for your infrastructure?

Gaea is a production-proven MySQL proxy for complex sharding and multi-tenant deployments. Contact our team to discuss architecture fit, integration planning, and operational readiness for your use case.