Autonomous Database Technology: Architecture, Migration, and Selection Guide
This guide provides a comprehensive analysis of autonomous and controllable database systems, covering their five-layer kernel architecture, transaction isolation mechanisms, and high availability design. It offers a practical migration methodology and a structured evaluation framework to help engineering teams successfully assess, tune, and deploy database infrastructure while avoiding vendor lock-in and ensuring compliance.
I. Why “Autonomous and Controllable” Has Become a Core Issue in the Data Layer
Over the past two decades, enterprise data layers have heavily relied on a few mature commercial or open-source relational databases. With the expansion of business scale, increasing data compliance requirements, and a broader awareness of supply chain risks, database management systems with independent intellectual property rights and the ability to evolve their kernels autonomously have gradually shifted from “alternative options” to “mandatory choices in infrastructure planning.”
A common misunderstanding needs clarification: “autonomous and controllable” does not mean “the fewer features, the safer.” A mature domestic relational database typically possesses complete subsystems for SQL parsing, query optimization, transaction management, storage management, replication and high availability, and backup and recovery. It can support hybrid scenarios primarily oriented towards Online Transaction Processing (OLTP) while accommodating certain analytical workloads. Taking the current mainstream DM8 version as an example, its core value lies in providing enterprise-grade data management capabilities while maintaining standard SQL semantics, allowing users long-term usage under the premise of controllable source code and autonomous version evolution.
For developers, this implies three key benefits:
- The data layer is no longer an untouchable black box; problem diagnosis can delve into execution plans and kernel logs.
- The long-term evolution roadmap is in their own hands, avoiding vendor lock-in.
- Compliance audits and regulatory inspections are easier to pass.
II. A Layered Perspective on Kernel Architecture
The most effective way to understand a relational database is to break it down top-down into five layers:
1. Access and Protocol Layer
Responsible for listening for connections, completing authentication, parsing communication protocols, and maintaining session states. In engineering, the focus should be on maximum connection limits, connection pool coordination strategies, and timeout/heartbeat mechanisms. In high-concurrency scenarios, the application-side connection pool limit should be set below a reasonable proportion of the database’s maximum connections (typically reserving a margin of over 30% for operations and management connections); otherwise, a false phenomenon may occur where “the database isn’t full, but the application is queuing.”
2. SQL Compilation Layer
Includes lexical and syntax analysis, semantic checking, view expansion, logical optimization, and physical optimization. This layer determines the quality of the execution plan. Controllable methods for developers include: keeping statistics fresh, avoiding functions or implicit type conversions on indexed columns, and reducing unnecessary subquery nesting.
3. Execution Engine
Produces result sets per operator using the Volcano model (iterator) or vectorized model, coordinated with sorting, aggregation, join, and parallel scan operators. Bottlenecks during execution usually fall on sort spills, insufficient join memory, and improper parallelism settings.
4. Storage Layer
Organizes data in pages (Page) as the I/O unit, reduces disk access via the Buffer Pool, and ensures durability through data files, log files, temporary files, and checkpoint mechanisms. The planning of tablespaces and data files directly impacts scaling and backup strategies.
5. Transaction and Recovery Layer
Achieves isolation levels through locking mechanisms and Multi-Version Concurrency Control (MVCC), and achieves crash recovery and point-in-time recovery through Write-Ahead Logging (WAL).
III. Transactions, Concurrency, and Isolation Levels
Isolation levels are the most common pitfall during migration. Standard SQL defines four levels: Read Uncommitted, Read Committed, Repeatable Read, and Serializable. However, different products have variations in the implementation details of “Repeatable Read” (whether snapshots are used, whether write skew occurs). During migration evaluation, it is recommended to perform specialized verification on the following logic:
- Balance deduction and inventory deduction logic relying on “query-then-update”;
- Idempotent writes relying on unique constraints as a safety net;
- Long transactions and cursor usage in batch tasks;
- Deadlock detection and retry strategies.
The following schematic pseudo-code demonstrates a robust deduction approach to avoid read-modify-write race conditions:
-- Recommended: Single-statement conditional update relying on row locks and affected row countsUPDATE accountSET balance = balance - :amount,version = version + 1WHERE id = :idAND balance >= :amount;-- Application checks affected row count; if 0, roll back and return a business error
cur.execute(UPDATE_SQL, {"id": acc_id, "amount": amt})if cur.rowcount == 0:conn.rollback()raise BusinessError("Insufficient balance or concurrent conflict")conn.commit()
IV. High Availability and Disaster Recovery Architecture
Enterprise-grade deployments typically adopt a real-time archived replication architecture of “one primary, multiple standbys”: the primary database writes logs and synchronously or asynchronously transmits them to standby databases, which replay the logs to maintain data consistency. Key design points include:
- Synchronization Level Selection: The highest availability mode guarantees zero data loss but increases commit latency; real-time asynchronous mode balances latency and RPO. Core transaction and reporting traffic can be separated into different synchronization strategies.
- Automatic Failover and Arbitration: Requires an independent arbitration node or third-party witness to prevent dual-primary scenarios (split-brain) caused by network partitions.
- Read/Write Separation: When standby databases handle read-only traffic, the impact of replication delay on business consistency must be evaluated. Strongly consistent read requests should be forcibly routed to the primary database.
- Backup System: Full backups + incremental/archive logs constitute point-in-time recovery capability. Recovery drills should be conducted at least once per quarter.
V. Compatibility and Migration Methodology
The essence of migration is “semantic equivalence verification,” not mere syntax replacement. A five-step approach is recommended:
- Object Inventory: Export lists of tables, indexes, constraints, views, stored procedures, triggers, sequences, and synonyms, marking incompatible items.
- Type and Character Set Mapping: Focus on length semantics of variable-length strings (by byte or by character), numeric precision, precision and time zone handling of temporal types, and semantic differences between empty strings and NULL.
- SQL Rewriting: Pagination syntax, string concatenation, date functions, hierarchical queries, window functions, and MERGE-like statements must be aligned item by item.
- Application Layer Transformation: Driver and connection string replacement, standardizing parameter placeholder styles, and adjusting batch commit and retry strategies.
- Dual-Track Verification: Use sanitized production data for full comparison and shadow traffic replay. Compare result set hashes and key metrics until the difference converges to zero.
Migration Checklist (Excerpt)[ ] Object quantities and definitions verified line by line[ ] Large table row counts and checksums are consistent[ ] Execution plans for Top 50 slow SQLs reviewed[ ] Stored procedures/triggers behavior covered by use cases[ ] Primary/standby switch and switchback drills passed[ ] Backup recovery RTO/RPO meets targets
VI. Priority Sequence for Performance Tuning
Tuning should follow the sequence of “locate first, act later” to avoid blindly adding indexes:
- Identify the bottleneck type: CPU, memory, disk I/O, network, or lock wait;
- Capture slow jobs and wait events to locate Top resource-consuming SQLs;
- Review execution plans to determine if the wrong index was used, or if a full table scan or sort spill occurred;
- Adjust indexes and statistics; introduce partitioned tables if necessary to reduce scan ranges;
- Adjust parameters: buffer pool size, concurrency, log commit strategy, and temporary tablespace;
- Hardware scaling or read/write separation should be considered last.
VII. Cloud Deployment and Observability
In a cloud environment, the data layer usually does not need to build all capabilities from scratch. It can combine general cloud product categories: compute and container platforms host database instances and support elastic scaling; block or object storage hosts data files and backup archives; log services aggregate slow jobs and audit logs; and monitoring and alerting systems set threshold alerts for connections, buffer pool hit rates, replication latency, and disk watermarks. If adopting a combination of general cloud products like Baidu AI Cloud, centralized observation of the data layer can be achieved through unified monitoring and log collection. However, specific specifications and strategies should be determined based on your own load stress testing and should not blindly copy others’ parameters.
VIII. Selection Evaluation Framework and Common Pitfalls
It is recommended to score across six dimensions: feature completeness, SQL and ecosystem compatibility, performance and stability, high availability and disaster recovery capabilities, operations and observability, and autonomy in service and version evolution.
Three common pitfalls should be noted:
- Considering migration complete when it “installs and runs,” ignoring semantic differences;
- Conducting validation only during off-peak hours without peak stress testing;
- Neglecting personnel capability building, resulting in inability to independently diagnose issues during failures.
The autonomation of the data layer is a simultaneous upgrade of engineering and organizational capabilities. Only by institutionalizing verification, drills, and knowledge accumulation can long-term, stable technical benefits be truly realized.
