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

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

J
Jiawei Wang 已提交
5 6 7 8 9
### Compile Source Code
in the root directory of this git project
```
mkdir build_server
cd build_server
J
Jiawei Wang 已提交
10
cmake -DPYTHON_INCLUDE_DIR=$PYTHONROOT/include/python2.7/ -DPYTHON_LIBRARIES=$PYTHONROOT/lib64/libpython2.7.so -DPYTHON_EXECUTABLE=$PYTHONROOT/bin/python -DSERVER=ON ..
J
Jiawei Wang 已提交
11 12 13 14
make -j10
make install -j10
```

J
Jiawei Wang 已提交
15
### Get Sample Dataset
W
wangjiawei04 已提交
16

J
Jiawei Wang 已提交
17
go to directory `python/examples/criteo_ctr_with_cube`
W
wangjiawei04 已提交
18 19 20 21
```
sh get_data.sh
```

J
Jiawei Wang 已提交
22
### Download Model and Sparse Parameter Sequence Files
W
wangjiawei04 已提交
23
```
J
Jiawei Wang 已提交
24
wget https://paddle-serving.bj.bcebos.com/unittest/ctr_cube_unittest.tar.gz
J
Jiawei Wang 已提交
25 26 27 28
tar xf ctr_cube_unittest.tar.gz
mv models/ctr_client_conf ./
mv models/ctr_serving_model_kv ./
mv models/data ./cube/
W
wangjiawei04 已提交
29
```
J
Jiawei Wang 已提交
30
the model will be in ./ctr_server_model_kv and ./ctr_client_config.
W
wangjiawei04 已提交
31

J
Jiawei Wang 已提交
32
### Start Sparse Parameter Indexing Service
W
wangjiawei04 已提交
33
```
34 35 36
wget https://paddle-serving.bj.bcebos.com/others/cube_app.tar.gz
tar xf cube_app.tar.gz
mv cube_app/cube* ./cube/
W
wangjiawei04 已提交
37 38 39
sh cube_prepare.sh &
```

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

J
Jiawei Wang 已提交
42
### Start RPC Predictor, the number of serving thread is 4(configurable in test_server.py)
W
wangjiawei04 已提交
43 44 45 46 47

```
python test_server.py ctr_serving_model_kv 
```

J
Jiawei Wang 已提交
48
### Run Prediction
W
wangjiawei04 已提交
49 50 51 52 53 54 55

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

### Benchmark

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

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

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

J
Jiawei Wang 已提交
62
Run
W
wangjiawei04 已提交
63 64 65
```
bash benchmark.sh
```
J
Jiawei Wang 已提交
66
1000 batches will be sent by every client
W
wangjiawei04 已提交
67

68
| client  thread num | prepro | client infer | op0    | op1   | op2    | postpro | avg_latency | qps   |
W
wangjiawei04 已提交
69
| ------------------ | ------ | ------------ | ------ | ----- | ------ | ------- | ----- | ----- |
J
Jiawei Wang 已提交
70 71 72 73 74
| 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 已提交
75

J
Jiawei Wang 已提交
76
the average latency of threads
W
wangjiawei04 已提交
77 78 79

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

J
Jiawei Wang 已提交
80
The QPS is 
W
wangjiawei04 已提交
81 82

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