From 6b775bdd2d5cd7ddcf3c731a3d3123a889f871b3 Mon Sep 17 00:00:00 2001 From: wangguibao Date: Tue, 2 Apr 2019 20:00:49 +0800 Subject: [PATCH] BENCHMARKING.md --- doc/BENCHMARKING.md | 595 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 595 insertions(+) create mode 100644 doc/BENCHMARKING.md diff --git a/doc/BENCHMARKING.md b/doc/BENCHMARKING.md new file mode 100644 index 00000000..d24f66e9 --- /dev/null +++ b/doc/BENCHMARKING.md @@ -0,0 +1,595 @@ +本文以文本分类任务为例搭建Serving预测服务,给出Serving框架性能数据: + +1) 不同模型下预测服务响应时间、QPS、准确率等指标和单机模式的对比 + +2) 不同模型下Serving扩展能力对比 + +3) Serving框架净开销测试 + +# 1. Serving单次请求时间分解 + +下图是一个对serving请求的耗时阶段的不完整分析。图中对brpc的开销,只列出了bthread创建和启动开销。 + +![](http://wiki.baidu.com/download/attachments/724028035/serving-timings.png?version=1&modificationDate=1553657169000&api=v2) + +试与单机模式对比: + +1) 从原始样例填充PaddleTensor (几us到几十us) + +2) 从PaddleTensor填充LoDTensor (几us到几十us) + +3) inference (几十us到几百ms) + +4) 从LoDTensor填充PaddleTensor (几us到几十us) + +5) 从Paddletensor读取预测结果 (几us到几十us) + +与单机模式相比,serving模式增加了: + +1) protobuf数据构造和序列化与反序列化 (几us到几十us) + +2) 网络通信 (单机十几us,远程500us到几十ms) + +3) 和bthread创建于调度等。(十几us) + +从client端看(图中total time T2),serving模式增加的时间,与inference时间的比例,对整个client端观察到的系统吞吐关系密切: + +1) 当inference时间达到10+ms到几百ms (例如,文本分类的CNN模型和LSTM模型),而serving模式增加的时间只有几ms,则client端观察到的吞吐与单机模式几乎一致 + +2) 当inference时间只有几个us到几十个us (例如,文本分类的BOW模型),而serving模式增加了几个ms,则client端观察到的吞吐与单机模式相比,会下降到单机模式的20%甚至更低。 + +**为了验证上述假设,文本分类任务的serving模式测试,需要在几个不同模型上分别进行,分别记录serving模式下,client端吞吐量的变化情况。** + +# 2. 测试环境 + +| | CPU型号、核数 | 内存 | +| --- | --- | --- | +| Serving所在机器 | Intel(R) Xeon(R) CPU E5-2650 v3 @ 2.30GHz 40核 | 128G | +| Client所在机器 | Intel(R) Xeon(R) CPU E5-2650 v3 @ 2.30GHz 40核 | 128G | + +Serving端与Client端通信时延:0.102 ms + +# 3. 预测服务单线程响应时间、QPS、准确率等指标与单机模式的对比 + +本测试用来确定Serving的准确率、QPS和响应时间等指标与单机模式相比是否无明显异常 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
模型 Serving(client与serving同机器) 单机
QPSLatency (ms)AccuracyQPSLatency (ms)Accuracy
BOW 265.393 30.84348715.9733661.3967000.843480
CNN23.3002420.896225.37269339.4124500.896200
LSTM5.195781920.857845.321040187.933202 0.857840
+可以看到,在预测时间很短的BOW模型上,通过serving进行服务,QPS下降为单机模式下的1/3左右,而在预测时间较长的CNN和LSTM模型上,QPS几乎与单机模式持平。这也验证了第1节的预期。 + +# 4. Serving扩展能力 + +Serving扩展能力的测试是指,在不同模型上: + +1) 固定serving端brpc使用的系统线程数 + +2) 不断增加client端并发请求数 + +3) 运行一段时间后,client端记录当前设定下QPS、平均响应时间和各个分位点的响应时间等信息 + +4)serving与client在不同机器上,Serving端与Client端通信时延:0.102 ms + +## 4.1 BOW模型 + +### Serving 4线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 561.325 | 3563 | 7.1265 | 9 | 11 | 23 | 62 | +| 8 | 807.428 | 4954 | 9.9085 | 7 | 10 | 24 | 31 | +| 12 | 894.721 | 6706 | 13.4123 | 18 | 22 | 41 | 61 | +| 16 | 993.542 | 8052 | 16.1057 | 22 | 28 | 47 | 75 | +| 20 | 834.725 | 11980 | 23.9615 | 32 | 40 | 64 | 81 | +| 24 | 649.316 | 18481 | 36.962 | 50 | 67 | 149 | 455 | +| 28 | 709.975 | 19719 | 39.438 | 53 | 76 | 159 | 293 | +| 32 | 661.868 | 24174 | 48.3495 | 62 | 90 | 294 | 560 | +| 36 | 551.234 | 32654 | 65.3081 | 83 | 129 | 406 | 508 | +| 40 | 525.155 | 38084 | 76.1687 | 99 | 143 | 464 | 567 | + +### Serving 8线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 397.693 | 5029 | 10.0585 | 11 | 15 | 75 | 323 | +| 8 | 501.567 | 7975 | 15.9515 | 18 | 25 | 113 | 327 | +| 12 | 598.027 | 10033 | 20.0663 | 24 | 33 | 125 | 390 | +| 16 | 691.384 | 11571 | 23.1427 | 31 | 42 | 105 | 348 | +| 20 | 468.099 | 21363 | 42.7272 | 53 | 74 | 232 | 444 | +| 24 | 424.553 | 28265 | 56.5315 | 67 | 102 | 353 | 448 | +| 28 | 587.692 | 23822 | 47.6457 | 61 | 83 | 287 | 494 | +| 32 | 692.911 | 23091 | 46.1833 | 66 | 94 | 184 | 389 | +| 36 | 809.753 | 22229 | 44.4581 | 59 | 76 | 256 | 556 | +| 40 | 762.108 | 26243 | 52.4869 | 74 | 98 | 290 | 475 | + +### Serving 12线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 442.478 | 4520 | 9.0405 | 12 | 15 | 31 | 46 | +| 8 | 497.884 | 8034 | 16.0688 | 19 | 25 | 130 | 330 | +| 12 | 797.13 | 7527 | 15.0552 | 16 | 22 | 162 | 326 | +| 16 | 674.707 | 11857 | 23.7154 | 30 | 42 | 229 | 455 | +| 20 | 489.956 | 20410 | 40.8209 | 49 | 68 | 304 | 437 | +| 24 | 452.335 | 26529 | 53.0582 | 66 | 85 | 341 | 414 | +| 28 | 753.093 | 18590 | 37.1812 | 50 | 65 | 184 | 421 | +| 32 | 932.498 | 18278 | 36.5578 | 48 | 62 | 109 | 337 | +| 36 | 932.498 | 19303 | 38.6066 | 54 | 70 | 110 | 164 | +| 40 | 921.532 | 21703 | 43.4066 | 59 | 75 | 125 | 451 | + +### Serving 16线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 559.597 | 3574 | 7.1485 | 9 | 11 | 24 | 56 | +| 8 | 896.66 | 4461 | 8.9225 | 12 | 15 | 23 | 42 | +| 12 | 1014.37 | 5915 | 11.8305 | 16 | 20 | 34 | 63 | +| 16 | 1046.98 | 7641 | 15.2837 | 21 | 28 | 48 | 64 | +| 20 | 1188.64 | 8413 | 16.8276 | 23 | 31 | 55 | 71 | +| 24 | 1013.43 | 11841 | 23.6833 | 34 | 41 | 63 | 86 | +| 28 | 933.769 | 14993 | 29.9871 | 41 | 52 | 91 | 149 | +| 32 | 930.665 | 17192 | 34.3844 | 48 | 60 | 97 | 137 | +| 36 | 880.153 | 20451 | 40.9023 | 57 | 72 | 118 | 142 | +| 40 | 939.144 | 21296 | 42.5938 | 59 | 75 | 126 | 163 | + +### Serving 20线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 686.813 | 2912 | 5.825 | 7 | 9 | 18 | 54 | +| 8 | 1016.26 | 3936 | 7.87375 | 10 | 13 | 24 | 33 | +| 12 | 1282.87 | 4677 | 9.35483 | 12 | 15 | 35 | 73 | +| 16 | 1253.13 | 6384 | 12.7686 | 17 | 23 | 40 | 54 | +| 20 | 1276.49 | 7834 | 15.6696 | 22 | 28 | 53 | 90 | +| 24 | 1273.34 | 9424 | 18.8497 | 26 | 35 | 66 | 93 | +| 28 | 1258.31 | 11126 | 22.2535 | 31 | 41 | 71 | 133 | +| 32 | 1027.95 | 15565 | 31.1308 | 43 | 54 | 81 | 103 | +| 36 | 912.316 | 19730 | 39.4612 | 52 | 66 | 106 | 131 | +| 40 | 808.865 | 24726 | 49.4539 | 64 | 79 | 144 | 196 | + +### Serving 24线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 635.728 | 3146 | 6.292 | 7 | 10 | 22 | 48 | +| 8 | 1089.03 | 3673 | 7.346 | 9 | 11 | 21 | 40 | +| 12 | 1087.55 | 5056 | 10.1135 | 13 | 17 | 41 | 51 | +| 16 | 1251.17 | 6394 | 12.7898 | 17 | 24 | 39 | 54 | +| 20 | 1241.31 | 8056 | 1241.31 | 21 | 29 | 51 | 72 | +| 24 | 1327.29 | 9041 | 18.0837 | 24 | 33 | 59 | 77 | +| 28 | 1066.02 | 13133 | 26.2664 | 37 | 47 | 84 | 109 | +| 32 | 1034.33 | 15469 | 30.9384 | 41 | 51 | 94 | 115 | +| 36 | 896.191 | 20085 | 40.1708 | 55 | 68 | 110 | 168 | +| 40 | 701.508 | 28510 | 57.0208 | 74 | 88 | 142 | 199 | + +### Serving 28线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 592.944 | 3373 | 6.746 | 8 | 10 | 21 | 56 | +| 8 | 1050.14 | 3809 | 7.619 | 9 | 12 | 22 | 41 | +| 12 | 1220.75 | 4915 | 9.83133 | 13 | 16 | 26 | 51 | +| 16 | 1178.38 | 6789 | 13.579 | 19 | 24 | 41 | 65 | +| 20 | 1184.97 | 8439 | 16.8789 | 23 | 30 | 51 | 72 | +| 24 | 1234.95 | 9717 | 19.4341 | 26 | 34 | 53 | 94 | +| 28 | 1162.31 | 12045 | 24.0908 | 33 | 40 | 70 | 208 | +| 32 | 1160.35 | 13789 | 27.5784 | 39 | 47 | 75 | 97 | +| 36 | 991.79 | 18149 | 36.2987 | 50 | 61 | 91 | 110 | +| 40 | 952.336 | 21001 | 42.0024 | 58 | 69 | 105 | 136 | + +### Serving 32线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 654.879 | 3054 | 6.109 | 7 | 9 | 18 | 39 | +| 8 | 959.463 | 4169 | 8.33925 | 11 | 13 | 24 | 39 | +| 12 | 1222.99 | 4906 | 9.81367 | 13 | 16 | 30 | 39 | +| 16 | 1314.71 | 6085 | 12.1704 | 16 | 20 | 35 | 42 | +| 20 | 1390.63 | 7191 | 14.3837 | 19 | 24 | 40 | 69 | +| 24 | 1370.8 | 8754 | 17.5096 | 24 | 30 | 45 | 62 | +| 28 | 1213.8 | 11534 | 23.0696 | 31 | 37 | 60 | 79 | +| 32 | 1178.2 | 13580 | 27.1601 | 38 | 45 | 68 | 82 | +| 36 | 1167.69 | 15415 | 30.8312 | 42 | 51 | 77 | 92 | +| 40 | 950.841 | 21034 | 42.0692 | 55 | 65 | 96 | 137 | + +### Serving 36线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 611.06 | 3273 | 6.546 | 7 | 10 | 23 | 63 | +| 8 | 948.992 | 4215 | 8.43 | 10 | 13 | 38 | 87 | +| 12 | 1081.47 | 5548 | 11.0972 | 15 | 18 | 31 | 37 | +| 16 | 1319.7 | 6062 | 12.1241 | 16 | 21 | 35 | 64 | +| 20 | 1246.73 | 8021 | 16.0434 | 22 | 28 | 41 | 47 | +| 24 | 1210.04 | 9917 | 19.8354 | 28 | 34 | 54 | 70 | +| 28 | 1013.46 | 13814 | 27.6296 | 37 | 47 | 83 | 125 | +| 32 | 1104.44 | 14487 | 28.9756 | 41 | 49 | 72 | 88 | +| 36 | 1089.32 | 16524 | 33.0495 | 45 | 55 | 83 | 107 | +| 40 | 940.115 | 21274 | 42.5481 | 58 | 68 | 101 | 138 | + +### Serving 40线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 610.314 | 3277 | 6.555 | 8 | 11 | 20 | 57 | +| 8 | 1065.34 | 4001 | 8.0035 | 10 | 12 | 23 | 29 | +| 12 | 1177.86 | 5632 | 11.2645 | 14 | 18 | 33 | 310 | +| 16 | 1252.74 | 6386 | 12.7723 | 17 | 22 | 40 | 63 | +| 20 | 1290.16 | 7751 | 15.5036 | 21 | 27 | 47 | 66 | +| 24 | 1153.07 | 10407 | 20.8159 | 28 | 36 | 64 | 81 | +| 28 | 1300.39 | 10766 | 21.5326 | 30 | 37 | 60 | 78 | +| 32 | 1222.4 | 13089 | 26.1786 | 36 | 45 | 75 | 99 | +| 36 | 1141.55 | 15768 | 31.5374 | 43 | 52 | 83 | 121 | +| 40 | 1125.24 | 17774 | 35.5489 | 48 | 57 | 93 | 190 | + +下图是Paddle Serving在BOW模型上QPS随serving端线程数增加而变化的图表。可以看出当线程数较少时(4线程/8线程/12线程),QPS的变化规律非常杂乱;当线程数较多时,QPS曲线又基本趋于一致,基本无线性增长关系。 + +![](https://paddle-serving.bj.bcebos.com/doc/qps-threads-bow.png) + +## 4.2 CNN模型 + +### Serving 4线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 81.9437 | 24407 | 47 | 55 | 64 | 80 | 91 | +| 8 | 142.486 | 28073 | 53 | 65 | 71 | 86 | 106 | +| 12 | 173.732 | 34536 | 66 | 79 | 86 | 105 | 126 | +| 16 | 174.894 | 45742 | 89 | 101 | 109 | 131 | 151 | +| 20 | 172.58 | 57944 | 113 | 129 | 138 | 159 | 187 | +| 24 | 178.216 | 67334 | 132 | 147 | 158 | 189 | 283 | +| 28 | 171.315 | 81721 | 160 | 180 | 192 | 223 | 291 | +| 32 | 178.17 | 89802 | 176 | 195 | 208 | 251 | 288 | +| 36 | 173.762 | 103590 | 204 | 227 | 241 | 278 | 309 | +| 40 | 177.335 | 112781 | 223 | 246 | 262 | 296 | 315 | + +### Serving 8线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 86.2999 | 23175 | 44 | 50 | 54 | 72 | 92 | +| 8 | 143.73 | 27830 | 53 | 65 | 71 | 83 | 91 | +| 12 | 178.471 | 33619 | 65 | 77 | 85 | 106 | 144 | +| 16 | 180.485 | 44325 | 86 | 99 | 108 | 131 | 149 | +| 20 | 180.466/s | 55412 | 108 | 122 | 131 | 153 | 170 | +| 24 | 174.452 | 68787 | 134 | 151 | 162 | 189 | 214 | +| 28 | 174.158 | 80387 | 157 | 175 | 186 | 214 | 236 | +| 32 | 172.857 | 92562 | 182 | 202 | 214 | 244 | 277 | +| 36 | 172.171 | 104547 | 206 | 228 | 241 | 275 | 304 | +| 40 | 174.435 | 114656 | 226 | 248 | 262 | 306 | 338 | + +### Serving 12线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 85.6274 | 23357 | 45 | 50 | 55 | 75 | 105 | +| 8 | 137.632 | 29063 | 55 | 67 | 73 | 88 | 134 | +| 12 | 187.793 | 31950 | 61 | 73 | 79 | 94 | 123 | +| 16 | 211.512 | 37823 | 73 | 87 | 94 | 113 | 134 | +| 20 | 206.624 | 48397 | 93 | 109 | 118 | 145 | 217 | +| 24 | 209.933 | 57161 | 111 | 128 | 137 | 157 | 190 | +| 28 | 198.689 | 70462 | 137 | 154 | 162 | 186 | 205 | +| 32 | 214.024 | 74758 | 146 | 165 | 176 | 204 | 228 | +| 36 | 223.947 | 80376 | 158 | 177 | 189 | 222 | 282 | +| 40 | 226.045 | 88478 | 174 | 193 | 204 | 236 | 277 | + +### Serving 16线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 82.9119 | 24122 | 45 | 52 | 60 | 79 | 99 | +| 8 | 145.82 | 27431 | 51 | 63 | 69 | 85 | 114 | +| 12 | 193.287 | 31042 | 59 | 71 | 77 | 92 | 139 | +| 16 | 240.428 | 33274 | 63 | 76 | 82 | 99 | 127 | +| 20 | 249.457 | 40087 | 77 | 91 | 99 | 127 | 168 | +| 24 | 263.673 | 45511 | 87 | 102 | 110 | 136 | 186 | +| 28 | 272.729 | 51333 | 99 | 115 | 123 | 147 | 189 | +| 32 | 269.515 | 59366 | 115 | 132 | 140 | 165 | 192 | +| 36 | 267.4 | 67315 | 131 | 148 | 157 | 184 | 220 | +| 40 | 264.939 | 75489 | 147 | 164 | 173 | 200 | 235 | + +### Serving 20线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 85.5615 | 23375 | 44 | 49 | 55 | 73 | 101 | +| 8 | 148.765 | 26888 | 50 | 61 | 69 | 84 | 97 | +| 12 | 196.11 | 30595 | 57 | 70 | 75 | 88 | 108 | +| 16 | 241.087 | 33183 | 63 | 76 | 82 | 98 | 115 | +| 20 | 291.24 | 34336 | 65 | 66 | 78 | 99 | 114 | +| 24 | 301.515 | 39799 | 76 | 90 | 97 | 122 | 194 | +| 28 | 314.303 | 44543 | 86 | 101 | 109 | 132 | 173 | +| 32 | 327.486 | 48857 | 94 | 109 | 118 | 143 | 196 | +| 36 | 320.422 | 56176 | 109 | 125 | 133 | 157 | 190 | +| 40 | 325.399 | 61463 | 120 | 137 | 145 | 174 | 216 | + +### Serving 24线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 85.6568 | 23349 | 45 | 50 | 57 | 72 | 110 | +| 8 | 154.919 | 25820 | 48 | 57 | 66 | 81 | 95 | +| 12 | 221.992 | 27028 | 51 | 61 | 69 | 85 | 100 | +| 16 | 272.889 | 29316 | 55 | 68 | 74 | 89 | 101 | +| 20 | 300.906 | 33233 | 63 | 75 | 81 | 95 | 108 | +| 24 | 326.735 | 36727 | 69 | 82 | 87 | 102 | 114 | +| 28 | 339.057 | 41291 | 78 | 92 | 99 | 119 | 137 | +| 32 | 346.868 | 46127 | 88 | 103 | 110 | 130 | 155 | +| 36 | 338.429 | 53187 | 102 | 117 | 124 | 146 | 170 | +| 40 | 320.919 | 62321 | 119 | 135 | 144 | 176 | 226 | + +### Serving 28线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 87.8773 | 22759 | 43 | 48 | 52 | 76 | 112 | +| 8 | 154.524 | 25886 | 49 | 58 | 66 | 82 | 100 | +| 12 | 192.709 | 31135 | 59 | 72 | 78 | 93 | 112 | +| 16 | 253.59 | 31547 | 59 | 72 | 79 | 95 | 129 | +| 20 | 288.367 | 34678 | 65 | 78 | 84 | 100 | 122 | +| 24 | 307.653 | 39005 | 73 | 84 | 92 | 116 | 313 | +| 28 | 334.105 | 41903 | 78 | 90 | 97 | 119 | 140 | +| 32 | 348.25 | 45944 | 86 | 99 | 107 | 132 | 164 | +| 36 | 355.661 | 50610 | 96 | 110 | 118 | 143 | 166 | +| 40 | 350.957 | 56987 | 109 | 124 | 133 | 165 | 221 | + +### Serving 32线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 87.4088 | 22881 | 43 | 48 | 52 | 70 | 86 | +| 8 | 150.733 | 26537 | 50 | 60 | 68 | 85 | 102 | +| 12 | 197.433 | 30390 | 57 | 70 | 75 | 90 | 106 | +| 16 | 250.917 | 31883 | 60 | 73 | 78 | 94 | 121 | +| 20 | 286.369 | 34920 | 66 | 78 | 84 | 102 | 131 | +| 24 | 306.029 | 39212 | 74 | 85 | 92 | 110 | 134 | +| 28 | 323.902 | 43223 | 81 | 93 | 100 | 122 | 143 | +| 32 | 341.559 | 46844 | 89 | 102 | 111 | 136 | 161 | +| 36 | 341.077 | 52774 | 98 | 113 | 124 | 158 | 193 | +| 40 | 357.814 | 55895 | 107 | 122 | 133 | 166 | 196 | + +### Serving 36线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 86.9036 | 23014 | 44 | 49 | 53 | 72 | 112 | +| 8 | 158.964 | 25163 | 48 | 55 | 63 | 79 | 91 | +| 12 | 205.086 | 29256 | 55 | 68 | 75 | 91 | 168 | +| 16 | 238.173 | 33589 | 61 | 73 | 79 | 100 | 158 | +| 20 | 279.705 | 35752 | 67 | 79 | 86 | 106 | 129 | +| 24 | 318.294 | 37701 | 71 | 82 | 89 | 108 | 129 | +| 28 | 336.296 | 41630 | 78 | 89 | 97 | 119 | 194 | +| 32 | 360.295 | 44408 | 84 | 97 | 105 | 130 | 154 | +| 36 | 353.08 | 50980 | 96 | 113 | 123 | 152 | 179 | +| 40 | 362.286 | 55205 | 105 | 122 | 134 | 171 | 247 | + +### Serving 40线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 87.7347 | 22796 | 44 | 48 | 54 | 73 | 114 | +| 8 | 150.483 | 26581 | 50 | 59 | 67 | 85 | 149 | +| 12 | 202.088 | 29690 | 56 | 69 | 75 | 90 | 102 | +| 16 | 250.485 | 31938 | 60 | 74 | 79 | 93 | 113 | +| 20 | 289.62 | 34528 | 65 | 77 | 83 | 102 | 132 | +| 24 | 314.408 | 38167 | 72 | 83 | 90 | 110 | 125 | +| 28 | 321.728 | 43515 | 83 | 95 | 104 | 132 | 159 | +| 32 | 335.022 | 47758 | 90 | 104 | 114 | 141 | 166 | +| 36 | 341.452 | 52716 | 101 | 117 | 129 | 170 | 231 | +| 40 | 347.953 | 57479 | 109 | 130 | 143 | 182 | 216 | + +下图是Paddle Serving在CNN模型上QPS随serving端线程数增加而变化的图表。当线程数较少时,可以看出较为明显的线性增长关系;当线程数变大(20线程及以上),QPS变化曲线趋于一致。 + +![](https://paddle-serving.bj.bcebos.com/doc/qps-threads-cnn.png) + +## 4.3 LSTM模型 + +### Serving 4线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 18.8242 | 106246 | 208 | 230 | 254 | 353 | 448 | +| 8 | 31.4584 | 127152 | 242 | 283 | 337 | 448 | 536 | +| 12 | 35.6235 | 168428 | 328 | 384 | 455 | 601 | 732 | +| 16 | 38.2777 | 208999 | 412 | 457 | 505 | 675 | 806 | +| 20 | 39.3926 | 253855 | 503 | 551 | 589 | 751 | 902 | +| 24 | 40.0085 | 299936 | 595 | 650 | 698 | 870 | 1023 | +| 28 | 38.2019 | 366474 | 728 | 805 | 870 | 1076 | 1208 | +| 32 | 37.7817 | 423486 | 842 | 923 | 995 | 1231 | 1363 | +| 36 | 39.3513 | 457418 | 911 | 1018 | 1099 | 1351 | 1556 | +| 40 | 34.7731 | 575158 | 1144 | 1296 | 1395 | 1653 | 1836 | + +### Serving 8线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 16.9203 | 118201 | 232 | 264 | 292 | 418 | 653 | +| 8 | 32.8672 | 121702 | 237 | 279 | 351 | 458 | 530 | +| 12 | 43.9741 | 136444 | 270 | 307 | 330 | 399 | 472 | +| 16 | 43.4809 | 183989 | 364 | 403 | 430 | 566 | 769 | +| 20 | 42.4901 | 235349 | 467 | 517 | 552 | 689 | 815 | +| 24 | 46.0386 | 260651 | 519 | 566 | 597 | 686 | 758 | +| 28 | 45.0191 | 310979 | 619 | 672 | 715 | 841 | 991 | +| 32 | 47.9803 | 333470 | 664 | 713 | 745 | 837 | 953 | +| 36 | 47.518 | 378804 | 754 | 809 | 856 | 1017 | 1202 | +| 40 | 48.2631 | 414395 | 825 | 888 | 927 | 1048 | 1136 | + +### Serving 12线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 18.568 | 107712 | 212 | 236 | 264 | 396 | 496 | +| 8 | 28.7212 | 139270 | 268 | 331 | 389 | 478 | 531 | +| 12 | 37.1195 | 161640 | 315 | 411 | 444 | 523 | 580 | +| 16 | 38.6195 | 207149 | 406 | 511 | 556 | 654 | 722 | +| 20 | 39.8772 | 250770 | 490 | 599 | 652 | 758 | 840 | +| 24 | 41.1097 | 291902 | 578 | 691 | 747 | 861 | 930 | +| 28 | 39.5161 | 354286 | 699 | 822 | 875 | 979 | 1052 | +| 32 | 40.4252 | 395793 | 785 | 899 | 957 | 1090 | 1197 | +| 36 | 40.4617 | 444865 | 885 | 1011 | 1077 | 1215 | 1312 | +| 40 | 41.6045 | 480717 | 957 | 1083 | 1161 | 1322 | 1429 | + +### Serving 16线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 18.456 | 108366 | 211 | 240 | 266 | 372 | 449 | +| 8 | 29.3468 | 136301 | 265 | 319 | 367 | 454 | 510 | +| 12 | 40.3432 | 148724 | 289 | 368 | 410 | 487 | 535 | +| 16 | 46.0167 | 173850 | 336 | 429 | 459 | 535 | 577 | +| 20 | 52.8142 | 189343 | 372 | 475 | 517 | 619 | 689 | +| 24 | 49.9422 | 240278 | 475 | 581 | 625 | 728 | 805 | +| 28 | 49.0184 | 285607 | 564 | 676 | 720 | 822 | 889 | +| 32 | 49.3077 | 324493 | 642 | 760 | 807 | 912 | 977 | +| 36 | 49.2754 | 365294 | 724 | 838 | 884 | 985 | 1067 | +| 40 | 51.2923 | 389922 | 774 | 890 | 946 | 1065 | 1157 | + +### Serving 20线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 17.0678 | 117180 | 226 | 258 | 303 | 426 | 503 | +| 8 | 30.9986 | 129038 | 254 | 302 | 345 | 440 | 505 | +| 12 | 42.4962 | 141189 | 274 | 336 | 385 | 467 | 530 | +| 16 | 48.877 | 163676 | 316 | 398 | 433 | 507 | 555 | +| 20 | 55.1089 | 181459 | 350 | 432 | 463 | 539 | 596 | +| 24 | 57.4941 | 208717 | 412 | 503 | 540 | 623 | 695 | +| 28 | 57.1506 | 244967 | 483 | 577 | 614 | 702 | 779 | +| 32 | 58.0059 | 275834 | 545 | 641 | 681 | 773 | 847 | +| 36 | 56.8352 | 316705 | 628 | 725 | 765 | 856 | 929 | +| 40 | 57.1989 | 349657 | 693 | 792 | 833 | 925 | 994 | + +### Serving 24线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 17.7026 | 112978 | 223 | 261 | 293 | 403 | 491 | +| 8 | 26.8649 | 148893 | 288 | 377 | 414 | 492 | 556 | +| 12 | 42.2262 | 142092 | 279 | 348 | 392 | 463 | 518 | +| 16 | 50.3214 | 158978 | 310 | 391 | 427 | 503 | 568 | +| 20 | 56.5803 | 176740 | 345 | 422 | 452 | 526 | 583 | +| 24 | 63.9107 | 187762 | 367 | 443 | 472 | 546 | 595 | +| 28 | 64.5965 | 216730 | 427 | 506 | 540 | 623 | 690 | +| 32 | 63.4186 | 252292 | 497 | 578 | 614 | 701 | 770 | +| 36 | 65.5919 | 274424 | 543 | 634 | 669 | 757 | 818 | +| 40 | 65.4862 | 305408 | 605 | 695 | 731 | 824 | 898 | + +### Serving 28线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 18.6808 | 107062 | 209 | 235 | 257 | 338 | 444 | +| 8 | 31.966 | 125133 | 240 | 281 | 340 | 451 | 507 | +| 12 | 44.1527 | 135892 | 266 | 328 | 377 | 464 | 529 | +| 16 | 55.0464 | 145332 | 282 | 359 | 401 | 476 | 528 | +| 20 | 61.7234 | 162013 | 317 | 403 | 436 | 510 | 561 | +| 24 | 67.4385 | 177940 | 349 | 425 | 454 | 525 | 590 | +| 28 | 72.2096 | 193880 | 381 | 447 | 476 | 548 | 611 | +| 32 | 72.8617 | 219594 | 431 | 505 | 538 | 613 | 680 | +| 36 | 74.0488 | 243083 | 480 | 559 | 593 | 680 | 753 | +| 40 | 71.9171 | 278098 | 551 | 629 | 665 | 755 | 825 | + +### Serving 32线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 18.6911 | 107003 | 209 | 233 | 254 | 353 | 428 | +| 8 | 34.3059 | 116598 | 227 | 255 | 295 | 433 | 494 | +| 12 | 45.449 | 132016 | 257 | 313 | 363 | 454 | 508 | +| 16 | 56.7094 | 141070 | 275 | 347 | 392 | 471 | 522 | +| 20 | 62.2615 | 160613 | 315 | 398 | 431 | 503 | 553 | +| 24 | 66.4489 | 180590 | 354 | 423 | 453 | 523 | 570 | +| 28 | 73.1823 | 191303 | 376 | 438 | 467 | 538 | 584 | +| 32 | 77.7122 | 205888 | 405 | 463 | 491 | 562 | 621 | +| 36 | 76.4029 | 235593 | 464 | 527 | 560 | 652 | 763 | +| 40 | 77.7339 | 257288 | 509 | 576 | 609 | 692 | 779 | + +### Serving 36线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 18.745 | 106695 | 208 | 232 | 252 | 308 | 357 | +| 8 | 33.6047 | 119031 | 234 | 267 | 316 | 426 | 497 | +| 12 | 43.5076 | 137907 | 269 | 333 | 381 | 467 | 521 | +| 16 | 55.1968 | 144936 | 284 | 360 | 402 | 477 | 529 | +| 20 | 62.9188 | 158935 | 312 | 394 | 430 | 502 | 547 | +| 24 | 68.7411 | 174568 | 343 | 418 | 447 | 522 | 574 | +| 28 | 74.3033 | 188417 | 371 | 436 | 463 | 535 | 581 | +| 32 | 78.7723 | 203117 | 401 | 459 | 488 | 561 | 612 | +| 36 | 80.4861 | 223641 | 440 | 497 | 529 | 627 | 980 | +| 40 | 79.6733 | 251025 | 497 | 562 | 601 | 731 | 910 | + +### Serving 40线程 + +| 并发数 | QPS | 总时间 | 平均响应时间 | 80分位点响应时间 | 90分位点响应时间 | 99分位点响应时间 | 99.9分位点响应时间 | +| --- | --- | --- | --- | --- | --- | --- | --- | +| 4 | 17.0187 | 117518 | 231 | 267 | 302 | 416 | 505 | +| 8 | 28.4661 | 140518 | 276 | 360 | 407 | 479 | 548 | +| 12 | 37.6549 | 159342 | 312 | 398 | 429 | 500 | 553 | +| 16 | 53.7681 | 148787 | 291 | 366 | 407 | 486 | 532 | +| 20 | 60.6704 | 164825 | 321 | 402 | 435 | 511 | 564 | +| 24 | 67.2227 | 178511 | 351 | 422 | 452 | 526 | 585 | +| 28 | 71.6659 | 195351 | 384 | 446 | 474 | 551 | 618 | +| 32 | 77.2745 | 207054 | 408 | 465 | 495 | 576 | 643 | +| 36 | 80.0028 | 224992 | 445 | 502 | 538 | 636 | 705 | +| 40 | 80.9894 | 246946 | 486 | 554 | 601 | 767 | 1181 | + +下图是Paddle Serving在LSWM模型上QPS随serving端线程数增加而变化的图表。当线程数较少时,可以看出较为明显的线性增长关系;当线程数变大(28线程及以上),QPS变化曲线趋于一致。 + +![](https://paddle-serving.bj.bcebos.com/doc/qps-threads-lstm.png) + +# 6. 净开销测试 + +本测试是为了描画引入Serving框架后,在Serving端空转的情况下,每query消耗的时间,也就是框架引入的开销。 + +所谓空转是指,serving端去除实际执行预测的计算时间,但保留拆包和组包逻辑。 + +| 模型 | 净开销 (ms) | +| --- | --- | +| BOW | 1 | +| CNN | 1 | +| LSTM | 1 | -- GitLab