TiDB Cloud Branching (Beta) Overview
TiDB Cloud lets you create branches for TiDB Cloud Starter and TiDB Cloud Essential instances. A branch for a TiDB Cloud Starter or Essential instance is a separate instance that contains a diverged copy of data from the original TiDB Cloud Starter or Essential instance. It provides an isolated environment, allowing you to experiment freely without worrying about affecting the original TiDB Cloud Starter or Essential instance.
With branches, developers can work in parallel, iterate rapidly on new features, troubleshoot issues without affecting the production database, and easily revert changes if needed. This feature streamlines the development and deployment process while ensuring a high level of stability and reliability for the production database.
Implementations
When a branch for a TiDB Cloud Starter or Essential instance is created, the data in the branch diverges from the original TiDB Cloud Starter or Essential instance or its parent branch at a specific point in time. This means that subsequent changes made in either the parent or the branch will not be synchronized with each other.
To ensure fast and seamless branch creation, TiDB Cloud uses a copy-on-write technique for sharing data between the original TiDB Cloud Starter or Essential instance and its branches. This process usually completes within a few minutes and is imperceptible to users, ensuring that it does not affect the performance of your original TiDB Cloud Starter or Essential instance.
Scenarios
You can create branches easily and quickly to get isolated data environments. Branches are beneficial in the following scenarios where multiple developers or teams need to work independently, test changes, fix bugs, experiment with new features, or roll out updates without disrupting the production database.
Feature development: Developers can work on new features in isolation without affecting the production database. Each feature can have its own branch, allowing quick iteration and experimentation without affecting other ongoing work.
Bug fixing: Developers can create a branch dedicated to fixing a specific bug, test the fix, and then merge it back once verified, without introducing new issues to the production database.
Experimentation: While developing new features or making changes, developers can create branches to experiment with different approaches or configurations. This allows them to compare various options, gather data, and make informed decisions before the changes are merged into the production database.
Performance optimization: Database changes are sometimes made to enhance performance. With branching, developers can experiment and fine-tune various configurations, indexes, or algorithms in isolated environments to identify the most efficient solution.
Testing and staging: Teams can create branches for testing and staging purposes. It provides a controlled environment for quality assurance, user acceptance testing, or staging customizations before the changes are merged into the production database.
Parallel development: Different teams or developers can work on separate projects simultaneously. Each project can have its own branch, enabling independent development and experimentation, while still being able to merge changes back into the production database.
Limitations and quotas
Currently, TiDB Cloud branches are in beta and free of charge.
For each organization in TiDB Cloud, you can create a maximum of five branches by default across all TiDB Cloud Starter and Essential instances. The branches of a TiDB Cloud Starter or Essential instance will be created in the same region as the instance, and you cannot create branches for a TiDB Cloud Starter or Essential instance that is throttled or larger than 100 GiB.
For each branch of a free TiDB Cloud Starter instance, 10 GiB storage is allowed. For each branch of a TiDB Cloud Starter instance with spending limit > 0, 100 GiB storage is allowed. Once the storage is reached, the read and write operations on this branch will be throttled until you reduce the storage.
Branches are intended for short-term feature development and functional testing. Because branches lack auto-scaling capability, they are not suitable for performance testing.
If your TiDB Cloud Starter or Essential instance has tables with TiFlash replicas, these replicas will be temporarily unavailable in the new branch after you create it, because TiFlash needs to rebuild the replica data.
When creating a branch from a specific point in time:
- For a free TiDB Cloud Starter instance, you can select any time within the last 24 hours.
- For a TiDB Cloud Starter (with spending limit > 0) or TiDB Cloud Essential instance, you can select any time within the last 14 days.
If you need more quotas, contact TiDB Cloud Support.