mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-18 11:25:50 +00:00
4108f86177
* Changed database implementation. Removed static objects. * Fix Logs * Fix 40 errors from checkstyle plugin run. 139 left)) * Fix CacheStore errors from checkstyle plugin 107 left * Fix last errors in checkstyle. * Fix sonar issues * Fix issues in VALIDATE phase * Fix Bug with mongo connection. Used "Try with resources" * Add test * Added docker-compose for mongo db. MongoDb db work fixed. * Provided missing tests * Comments to start Application with mongo. * Fix some broken links * Remove extra space * Update filename * Fix some links in localization folders * Fix link * Update frontmatters * Work on patterns index page * Work on index page * Fixes according PR comments. Mainly Readme edits. * fix frontmatter * add missing png * Update pattern index.md * Add index.md for Chinese translation * update image paths * update circuit breaker image paths * Update image paths for localizations * add generated puml * Add missing image * Update img file extensions * Update the rest of the EN and ZH patterns to conform with the new website Co-authored-by: Victor Zalevskii <zvictormail@gmail.com>
28 lines
1.0 KiB
Markdown
28 lines
1.0 KiB
Markdown
---
|
|
title: Sharding
|
|
category: Behavioral
|
|
language: zh
|
|
tags:
|
|
- Performance
|
|
- Cloud distributed
|
|
---
|
|
|
|
## 含义
|
|
分片模式是指将数据存储划分为水平分区或分片。每个分片都有相同的模式,但持有自己独特的数据子集。
|
|
|
|
一个分片本身就是一个数据存储(它可以包含许多不同类型的实体的数据),运行在作为存储节点的服务器上。
|
|
|
|
## 类图
|
|

|
|
|
|
## 适用场景
|
|
这种设计模式提供了一下的好处:
|
|
|
|
- 你可以通过增加在额外的存储节点上,运行的更多分片来实现系统扩容。
|
|
- 系统可以使用现成的廉价硬件,而不是为每个存储节点使用专门(或者昂贵)的服务器硬件。
|
|
- 你可以通过平衡各分片之间的工作负载来减少竞争,以提高性能。
|
|
- 在云环境中,分片可以在物理上靠近访问该节点数据的用户。
|
|
|
|
## 引用
|
|
|
|
* [Sharding pattern](https://docs.microsoft.com/en-us/azure/architecture/patterns/sharding) |