分布式 KV 存储系统 Cellar 演进之路
分布式KV存储Cellar演进之路 美团点评·基础架构 齐泽斌 美团点评基础架构部,存储研发团队负责人 • Cellar:分布式KV存储服务 • Databus:数据库变更实时传输服务 • Venus:图片服务 11年毕业于天津大学 11 年到 14 年任职于百度,负责分布式文件系统和 KV 存储系统研发 有多年分布式存储研发经验 个人简介 • Cellar起源 • 中心节点架构演进 • 一样,越 存越香。 Cellar起源 • 14年初 美团引入阿里Tair作为NoSQL存储 • 14年底 大范围应用,并对Tair修修补补,积累领域问题 • 16年初 基于开源版本研发新一代KV存储系统Cellar • Now Cellar日请求量达万亿级,美团点评最大NoSQL存储 Cellar起源 Cellar起源—Tair架构 路由表 Cellar起源—Tair架构0 码力 | 34 页 | 1.66 MB | 1 年前3peewee Documentation Release 3.5.0
SqliteExtDatabase(':memory:') >>> class KV(Model): ... key = TextField() ... value = JSONField() ... class Meta: ... database = db ... >>> KV.create_table() Storing data works as you Peewee: >>> KV.create(key='a', value={'k1': 'v1'}) <KV: 1> >>> KV.get(KV.key == 'a').value {'k1': 'v1'} We can access specific parts of the JSON data using dictionary lookups: >>> KV.get(KV.value['k1'] update a JSON value in-place using the update() method: >>> KV.update(value=KV.value.update({'k1': 'v1-x', 'k2': 'v2'})).execute() 1 >>> KV.get(KV.key == 'a').value {'k1': 'v1-x', 'k2': 'v2'} We can also0 码力 | 347 页 | 380.80 KB | 1 年前3peewee Documentation Release 3.5.0
>>> db = SqliteExtDatabase(':memory:') >>> class KV(Model): ... key = TextField() ... value = JSONField() ... class Meta: ... database = db ... >>> KV.create_table() Storing data works as you might Peewee: >>> KV.create(key='a', value={'k1': 'v1'}) <KV: 1> >>> KV.get(KV.key == 'a').value {'k1': 'v1'} We can access specific parts of the JSON data using dictionary lookups: >>> KV.get(KV.value['k1'] update a JSON value in-place using the update() method: >>> KV.update(value=KV.value.update({'k1': 'v1-x', 'k2': 'v2'})).execute() 1 >>> KV.get(KV.key == 'a').value {'k1': 'v1-x', 'k2': 'v2'} We can also0 码力 | 282 页 | 1.02 MB | 1 年前3peewee Documentation Release 3.6.0
SqliteExtDatabase(':memory:') >>> class KV(Model): ... key = TextField() ... value = JSONField() ... class Meta: ... database = db ... >>> KV.create_table() Storing data works as you Peewee: >>> KV.create(key='a', value={'k1': 'v1'}) <KV: 1> >>> KV.get(KV.key == 'a').value {'k1': 'v1'} We can access specific parts of the JSON data using dictionary lookups: >>> KV.get(KV.value['k1'] the update() method. Note that “k1=v1” is preserved: >>> KV.update(value=KV.value.update({'k2': 'v2', 'k3': 'v3'})).execute() 1 >>> KV.get(KV.key == 'a').value {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} We0 码力 | 377 页 | 399.12 KB | 1 年前3peewee Documentation Release 3.6.0
extension: >>> from playhouse.sqlite_ext import * >>> db = SqliteExtDatabase(':memory:') >>> class KV(Model): ... key = TextField() ... value = JSONField() (continues on next page) 178 Chapter 1. Contents: database = db ... >>> KV.create_table() Storing data works as you might expect. There’s no need to serialize dictionaries or lists as JSON, as this is done automatically by Peewee: >>> KV.create(key='a', value={'k1': value={'k1': 'v1'}) <KV: 1> >>> KV.get(KV.key == 'a').value {'k1': 'v1'} We can access specific parts of the JSON data using dictionary lookups: >>> KV.get(KV.value['k1'] == 'v1').key 'a' It’s possible0 码力 | 302 页 | 1.02 MB | 1 年前3Performance Engineering: Being Friendly to Your Hardware
Possible OOB! Possible OOB! Possible OOB!Example - hashing 98 00000000000012a0 <_Z4hash_extP2kv>: 12a0: 55 push rbp 12a1: 41 56 push r14 12a3: ret struct kv { uint32_t key1; uint16_t key2; uint64_t key3; void *value; } kv; uint32_t hash_ext(struct kv *kv) { uint32_t fnv1a_hash {}; fnv1a_hash += hash_fnv1a_ext((const char *)&kv->key1, sizeof(kv->key1)); sizeof(kv->key1)); fnv1a_hash += hash_fnv1a_ext((const char *)&kv->key2, sizeof(kv->key2)); fnv1a_hash += hash_fnv1a_ext((const char *)&kv->key3, sizeof(kv->key3)); return fnv1a_hash; } 00000000000000000 码力 | 111 页 | 2.23 MB | 5 月前3DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model
and DeepSeekMoE. MLA guarantees efficient inference through significantly compressing the Key-Value (KV) cache into a latent vector, while DeepSeekMoE enables training strong models at an economical cost achieves significantly stronger performance, and meanwhile saves 42.5% of training costs, reduces the KV cache by 93.3%, and boosts the maximum generation throughput to 5.76 times. We pretrain DeepSeek-V2 Training Costs (K GPU Hours/T Tokens) 0 100 200 300 400 DeepSeek-V2 DeepSeek 67B reducing KV cache by 93.3% KV Cache for Generation (KB/Token) 0 10000 20000 30000 40000 50000 DeepSeek-V2 DeepSeek 67B0 码力 | 52 页 | 1.23 MB | 1 年前3peewee Documentation Release 3.4.0
The following extensions are no longer included in the playhouse: berkeleydb csv_utils djpeewee gfk kv pskel read_slave SQLite Extension The SQLite extension module’s VirtualModel class accepts slightly declaration: class KV(LSMTable): key = TextField(primary_key=True) value = TextField() class Meta: database = db filename = 'kv.ldb' db.create_tables([KV]) For tables consisting examples: >>> KV['k0'] = 'v0' >>> print(KV['k0']) 'v0' >>> data = [{'key': 'k%d' % i, 'value': 'v%d' % i} for i in range(20)] >>> KV.insert_many(data).execute() >>> KV.select().count() 20 >>> KV['k8'] 'v8'0 码力 | 349 页 | 382.34 KB | 1 年前3peewee Documentation Release 3.3.0
extensions are no longer included in the playhouse: • berkeleydb • csv_utils • djpeewee • gfk • kv • pskel • read_slave SQLite Extension The SQLite extension module’s VirtualModel class accepts key/value model declaration: class KV(LSMTable): key = TextField(primary_key=True) value = TextField() class Meta: database = db filename = 'kv.ldb' db.create_tables([KV]) For tables consisting of a single examples: >>> KV['k0'] = 'v0' >>> print(KV['k0']) 'v0' >>> data = [{'key': 'k%d' % i, 'value': 'v%d' % i} for i in range(20)] >>> KV.insert_many(data).execute() >>> KV.select().count() 20 >>> KV['k8'] 'v8'0 码力 | 280 页 | 1.02 MB | 1 年前3peewee Documentation Release 3.4.0
extensions are no longer included in the playhouse: • berkeleydb • csv_utils • djpeewee • gfk • kv • pskel • read_slave SQLite Extension The SQLite extension module’s VirtualModel class accepts key/value model declaration: class KV(LSMTable): key = TextField(primary_key=True) value = TextField() class Meta: database = db filename = 'kv.ldb' db.create_tables([KV]) For tables consisting of a single examples: >>> KV['k0'] = 'v0' >>> print(KV['k0']) 'v0' >>> data = [{'key': 'k%d' % i, 'value': 'v%d' % i} for i in range(20)] >>> KV.insert_many(data).execute() >>> KV.select().count() 20 >>> KV['k8'] 'v8'0 码力 | 284 页 | 1.03 MB | 1 年前3
共 327 条
- 1
- 2
- 3
- 4
- 5
- 6
- 33