-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PD: supports multiple level meta data space #87
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Multi-level Meta Data Space | ||
|
||
## Summary | ||
|
||
PD can handle multiple users' meta data, each user only see its own meta data. | ||
|
||
## Motivation | ||
|
||
PD is the mata data center of TiKV Cluster, the meta data contains TiKV instances' addr, user data range(region) | ||
information, the number of replicas of data, etc. | ||
|
||
But PD currently only can handle the key space [min-key, max-key], it means that PD only can handle one user's | ||
meta data, it is not possible when multiple users want share the same PD cluster as their meta system. There are | ||
two different scenarios that require PD can handle multiple user' meta data: | ||
|
||
1. Multiple TiKV Cluster share the same PD cluster. Because the minimal demplyment of a TiKV Cluster is 3 TiKV 3 PD, | ||
but it is not cost-effect if every small cluster has 3 dedicated meta data node. | ||
2. There are Multiple tenant in the same TiKV Cluster, each tenant has it own meta data, each tenant's key range can | ||
contains any key in the range of [min-key, max-key]. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make it practical, every APIs need to be accept a In my opinion, using prefix is more straightforward and simpler. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is what I expected. After TiKV implemented the Multiple-RocksDB feature, data from different tenant should stored in the different RocksDB instance. Tenant is the meta data, include the meta data in very row of data is redundant, we can store the tenant id to the RocksDB instance's directory name, like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using prefix can also achieve the same improvement. The difference of using prefix and using a separate explicit meta is that PD/TiKV/TiDB needs to take good care about meta in the later case. |
||
|
||
## Detailed design | ||
|
||
Change the meta data from | ||
``` | ||
{meta data} | ||
``` | ||
to | ||
``` | ||
user1 {meta data} | ||
user2 {meta data} | ||
user3 {meta data} | ||
... | ||
``` | ||
|
||
### Compatibility | ||
|
||
When upgrade from old version, all legacy meta data belongs to the default meta data space. | ||
``` | ||
{meta data} | ||
``` | ||
``` | ||
default {meta data} | ||
user1 {meta data} | ||
user2 {meta data} | ||
... | ||
``` | ||
|
||
## Alternatives | ||
|
||
In the multi-tenant scenario, tenant can add a {tenant-id} prefix for each data key, but tenant-id | ||
nolouch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
is a meta data esstionally, each data key has a tenant-id prefix may cost more disk space & memory | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any perf stats to show the cost? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The insert QPS of having prefix has 4% regression compare with no prefix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The bigger key size will consume more raftlog or wal and more CPU when comparing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What prefix is used for testing? Note a two byte prefix can support 32768 tenants already. |
||
in TiKV. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the keyspace in API v2 match this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, v2 API can not satisfy multiple TiDB tenants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When there are multiple TiDB tenants, each TiDB should has its own
ddl-owner
,gc-safepoint
and other meta data, these meta data should be stored in PD separately. This RFC is more about how PD store multiple user's meta data.