Skip to content

Commit 3dbda44

Browse files
committed
docs: update readme
1 parent f1a3e3d commit 3dbda44

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

readme.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,25 @@ English | [简体中文](readme-cn.md)
1010
[![Release](https://img.shields.io/github/v/release/kevwan/mapreduce.svg?style=flat-square)](https://github.com/kevwan/mapreduce)
1111
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
1212

13-
## Why we have this repo?
13+
## Why we have this repo
1414

1515
`mapreduce` is part of [go-zero](https://github.com/zeromicro/go-zero), but a few people asked if mapreduce can be used separately. But I recommend you to use `go-zero` for many more features.
1616

17+
## Why MapReduce is needed
18+
19+
In practical business scenarios we often need to get the corresponding properties from different rpc services to assemble complex objects.
20+
21+
For example, to query product details.
22+
23+
1. product service - query product attributes
24+
2. inventory service - query inventory properties
25+
3. price service - query price attributes
26+
4. marketing service - query marketing properties
27+
28+
If it is a serial call, the response time will increase linearly with the number of rpc calls, so we will generally change serial to parallel to optimize response time.
29+
30+
Simple scenarios using `WaitGroup` can also meet the needs, but what if we need to check the data returned by the rpc call, data processing, data aggregation? The official go library does not have such a tool (CompleteFuture is provided in java), so we implemented an in-process data batching MapReduce concurrent tool based on the MapReduce architecture.
31+
1732
## Design ideas
1833

1934
Let's try to put ourselves in the author's shoes and sort out the possible business scenarios for the concurrency tool:

0 commit comments

Comments
 (0)