README.md 2.0 KB
Newer Older
J
Jiawei Wang 已提交
1 2
## Criteo CTR with Sparse Parameter Server

J
Jiawei Wang 已提交
3
([简体中文](./README_CN.md)|English)
J
Jiawei Wang 已提交
4 5

### Get Sample Dataset
W
wangjiawei04 已提交
6 7 8 9 10

```
sh get_data.sh
```

J
Jiawei Wang 已提交
11
### Train and Save Model
W
wangjiawei04 已提交
12 13 14
```
python local_train.py
```
J
Jiawei Wang 已提交
15
the trained model will be in ./ctr_server_model and ./ctr_client_config, and ctr_server_model_kv, ctr_client_conf_kv。
W
wangjiawei04 已提交
16

J
Jiawei Wang 已提交
17
### Start Sparse Parameter Server
W
wangjiawei04 已提交
18 19 20 21 22 23
```
cp ../../../build_server/core/predictor/seq_generator seq_generator
cp ../../../build_server/output/bin/cube* ./cube/
sh cube_prepare.sh &
```

J
Jiawei Wang 已提交
24
Here, the sparse parameter is loaded by cube sparse parameter server,for more details please read [Cube: Sparse Parameter Indexing Service (Local Mode)](../../../doc/CUBE_LOCAL.md)
J
Jiawei Wang 已提交
25

J
Jiawei Wang 已提交
26
### Start RPC Predictor, the number of serving thread is 4(configurable in test_server.py)
W
wangjiawei04 已提交
27 28 29 30 31

```
python test_server.py ctr_serving_model_kv 
```

J
Jiawei Wang 已提交
32
### Run Prediction
W
wangjiawei04 已提交
33 34 35 36 37 38 39

```
python test_client.py ctr_client_conf/serving_client_conf.prototxt ./raw_data
```

### Benchmark

J
Jiawei Wang 已提交
40
CPU :Intel(R) Xeon(R) CPU 6148 @ 2.40GHz 
W
wangjiawei04 已提交
41

J
Jiawei Wang 已提交
42
Model :[Criteo CTR](https://github.com/PaddlePaddle/Serving/blob/develop/python/examples/ctr_criteo_with_cube/network_conf.py)
W
wangjiawei04 已提交
43

J
Jiawei Wang 已提交
44
server core/thread num : 4/8
W
wangjiawei04 已提交
45

J
Jiawei Wang 已提交
46
Run
W
wangjiawei04 已提交
47 48 49
```
bash benchmark.sh
```
J
Jiawei Wang 已提交
50
1000 batches will be sent by every client
W
wangjiawei04 已提交
51

52
| client  thread num | prepro | client infer | op0    | op1   | op2    | postpro | avg_latency | qps   |
W
wangjiawei04 已提交
53
| ------------------ | ------ | ------------ | ------ | ----- | ------ | ------- | ----- | ----- |
J
Jiawei Wang 已提交
54 55 56 57 58
| 1                  | 0.035  | 1.596        | 0.021  | 0.518 | 0.0024 | 0.0025  | 6.774 | 147.7 |
| 2                  | 0.034  | 1.780        | 0.027  | 0.463 | 0.0020 | 0.0023  | 6.931 | 288.3 |
| 4                  | 0.038  | 2.954        | 0.025  | 0.455 | 0.0019 | 0.0027  | 8.378 | 477.5 |
| 8                  | 0.044  | 8.230        | 0.028  | 0.464 | 0.0023 | 0.0034  | 14.191 | 563.8 |
| 16                 | 0.048  | 21.037       | 0.028  | 0.455 | 0.0025 | 0.0041  | 27.236 | 587.5 |
W
wangjiawei04 已提交
59

J
Jiawei Wang 已提交
60
the average latency of threads
W
wangjiawei04 已提交
61 62 63

![avg cost](../../../doc/criteo-cube-benchmark-avgcost.png)

J
Jiawei Wang 已提交
64
The QPS is 
W
wangjiawei04 已提交
65 66

![qps](../../../doc/criteo-cube-benchmark-qps.png)