This is an automated email from the ASF dual-hosted git repository.

wangdan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus-website.git


The following commit(s) were added to refs/heads/master by this push:
     new dd83c4a9 Update Chinese data-model doc (#39)
dd83c4a9 is described below

commit dd83c4a9d4d129584efc4a2c371a8341c37baf6e
Author: Yingchun Lai <[email protected]>
AuthorDate: Mon Dec 18 14:53:07 2023 +0800

    Update Chinese data-model doc (#39)
    
    https://github.com/apache/incubator-pegasus/issues/1715
---
 _overview/zh/data-model.md                  |  31 ++++++++++++++++------------
 assets/images/pegasus-data-model-sample.png | Bin 109912 -> 200272 bytes
 assets/images/pegasus-data-model.png        | Bin 73897 -> 383053 bytes
 3 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/_overview/zh/data-model.md b/_overview/zh/data-model.md
index 77305312..a70e1ff0 100644
--- a/_overview/zh/data-model.md
+++ b/_overview/zh/data-model.md
@@ -2,39 +2,44 @@
 permalink: /overview/data-model/
 ---
 
-## 模型介绍
+## 数据模型介绍
 
-Pegasus 的数据模型非常简单,就是 Key-Value 模型,不支持数据 Schema。但是为了增强其表达能力,我们将key分裂为 
**HashKey** 和 **SortKey**,即组合键(composite key),在这点上与 
[DynamoDB](https://aws.amazon.com/dynamodb/) 中提供的 [_composite primary 
key_](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.CoreComponents.html#HowItWorks.CoreComponents.PrimaryKey)(partition
 key and sort key)是很类似的。
+Pegasus 的数据模型非常简单,就是 Key-Value 模型,不支持复杂的 Schema。但是为了增强其表达能力,Key被分裂为 
**HashKey** 和 **SortKey**,即组合键(composite key, `[HashKey, SortKey] -> Value`),这与 
[DynamoDB](https://aws.amazon.com/dynamodb/) 中提供的 [_composite primary 
key_](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.CoreComponents.html#HowItWorks.CoreComponents.PrimaryKey)(partition
 key and sort key)是很类似的。
+
+这样设计的原因是:
+* Pegasus系统采用基于 Hash 的固定分片,必须通过一个方式计算数据的分片ID。最简单的办法就是让用户提供一个 
HashKey,然后通过hash函数计算获得。
+* 简单的 `HashKey -> Value` 方式,在表达能力上又偏弱,不方便业务使用。
 
 ### HashKey
 
-字节串,限制为64KB。类似于 DynamoDB 中的 partition key 概念,HashKey 用于计算数据属于哪个分片。Pegasus 
使用一个特定的 hash 函数,对HashKey 计算出一个hash值,然后对分片个数取模,就得到该数据对应的 **Partition ID** 
。HashKey 相同的数据总是存储在同一个分片中。
+字节串。类似于 DynamoDB 中的 partition key,HashKey 用于计算数据属于哪个分片。Pegasus 使用一个特定的 hash 
函数,对HashKey 计算出一个hash值,然后对分片个数取模,就得到该数据对应的 **Partition ID** 。因此,HashKey 
相同的数据总是存储在同一个分片中。
+> 
注意:在C++客户端侧,HashKey长度限制为64KB。在Java客户侧,如果开启了[WriteLimiter](https://github.com/apache/incubator-pegasus/blob/v2.5.0/java-client/src/main/java/org/apache/pegasus/client/ClientOptions.java#L360C12-L360C12),则限制为1KB。
+> 在Server侧,从Pegasus 2.0.0开始,如果设置 `[replication]max_allowed_write_size` 
为非0,则限制整个请求包的大小为该值,默认为1MB。
 
 ### SortKey
 
-字节串,长度无限制。类似于 DynamoDB 中的 sort key 概念,SortKey 用于数据在分片内的排序。HashKey 
相同的数据放在一起,并且按照 SortKey 的字节序排序。实际上,在内部存储到RocksDB时,我们将 HashKey 和 SortKey 拼在一起作为 
RocksDB 的 key。
+字节串。类似于 DynamoDB 中的 sort key,SortKey 用于数据在分片内的排序。HashKey 相同的数据放在一起,并且按照 
SortKey 的字节序排序。实际上,在内部存储到RocksDB时,我们将 HashKey 和 SortKey 拼在一起作为 RocksDB 的 key。
+> 
注意:在C++客户端侧,SortKey长度无限制。在Java客户侧,如果开启了[WriteLimiter](https://github.com/apache/incubator-pegasus/blob/v2.5.0/java-client/src/main/java/org/apache/pegasus/client/ClientOptions.java#L360C12-L360C12),则限制为1KB。
+> 在Server侧,从Pegasus 2.0.0开始,如果设置 `[replication]max_allowed_write_size` 
为非0,则限制整个请求包的大小为该值,默认为1MB。
 
 ### Value
 
-字节串,长度无限制。
+字节串。
+> 
注意:在C++客户端侧,Value长度无限制。在Java客户侧,如果开启了[WriteLimiter](https://github.com/apache/incubator-pegasus/blob/v2.5.0/java-client/src/main/java/org/apache/pegasus/client/ClientOptions.java#L360C12-L360C12),则限制为400KB。
+> 在Server侧,从Pegasus 2.0.0开始,如果设置 `[replication]max_allowed_write_size` 
为非0,则限制整个请求包的大小为该值,默认为1MB。
 
 
![pegasus-data-model](/assets/images/pegasus-data-model.png){:class="img-responsive
 docs-image"}
 
-之所以这样设计,是因为:
-
-* Pegasus系统采用基于 Hash 的固定分片,必须通过一个方式计算数据的分片ID。最简单的办法就是让用户提供一个 
HashKey,然后通过hash函数计算获得。
-* 如果直接采用 `HashKey -> Value` 方式,在表达能力上又偏弱,不方便业务使用。所以增加了一层 SortKey,变成了 
`[HashKey, SortKey] -> Value` 的形式。
-
 ## Pegasus vs. HBase
 
 虽然不及 HBase 的表格模型语义丰富,但是 Pegasus 也能满足大部分业务需求,这得益于其 HashKey+SortKey 组合键的设计。
 
-譬如用户可以将 HashKey 当作 row key,将 SortKey 当作 attribute name 或者 column name,这样同一 
HashKey 的多条数据可以看作一行,同样能表达出 HBase 中 row 的概念。正是考虑到这一点,Pegasus 除了提供存取单条数据的 
get/set/del 接口,还提供了存取同一 HashKey 数据的 multi_get/multi_set/multi_del 
接口,并且这些接口都是单行原子操作,让用户在使用时更加简单。
+譬如用户可以将 HashKey 当作 row key,将 SortKey 当作 attribute name 或者 column name,这样同一 
HashKey 的多条数据可以看作一行,同样能表达出 HBase 中 row 的概念。正是考虑到这一点,Pegasus 除了提供存取单条数据的 
`get`/`set`/`del` 接口,还提供了存取同一 HashKey 数据的 `multi_get`/`multi_set`/`multi_del` 
接口,并且这些接口都是单行原子操作,让用户在使用时更加简单。
 
 
![pegasus-data-model](/assets/images/pegasus-data-model-sample.png){:class="img-responsive
 docs-image"}
 
 ## Pegasus vs. Redis
 
-虽然不像Redis一样支持丰富的list/set/map等数据Schema,用户同样可以使用Pegasus实现类似的语义。
+虽然不像Redis一样支持丰富的`List`/`Set`/`Hash`等数据结构,但用户同样可以使用Pegasus实现类似的语义。
 
-譬如用户可以将 HashKey 等同于 Redis 的 key,将 SortKey 作为 map 的 key,实现 Redis 中 map 或者 set 
的语义。list 语义的支持稍微困难些,但是也可以基于 Key-Value 进行封装,譬如360开源的 
[Pika](https://github.com/Qihoo360/pika) 就做过 
[类似的事情](https://github.com/Qihoo360/pika/wiki/pika-nemo%E5%BC%95%E6%93%8E%E6%95%B0%E6%8D%AE%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F#3-list%E7%BB%93%E6%9E%84%E7%9A%84%E5%AD%98%E5%82%A8)。另一种解决方案就是,将
 map/set/list 数据结构通过某种方法(protobuf/thrift/json)序列化为一个字节串,然后直接作为一个整体存储在 value 
中,其缺点是用户需要在客户端增加序列化/反序列化开销,并且每次数据更新都需要对整个 value 读写一次。
+譬如用户可以将 HashKey 等同于 Redis 的 `key`,将 SortKey 作为 Hash 的 `field`(或 Set 
的`member`),实现 Redis 中 Hash (或 Set)。
diff --git a/assets/images/pegasus-data-model-sample.png 
b/assets/images/pegasus-data-model-sample.png
index 0aebf592..9571c725 100755
Binary files a/assets/images/pegasus-data-model-sample.png and 
b/assets/images/pegasus-data-model-sample.png differ
diff --git a/assets/images/pegasus-data-model.png 
b/assets/images/pegasus-data-model.png
old mode 100755
new mode 100644
index 319aa63b..8bbed9d7
Binary files a/assets/images/pegasus-data-model.png and 
b/assets/images/pegasus-data-model.png differ


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to