Will和when Undertow使用单个IO线程处理所有传入请求

时间:2018-11-30 13:13:18

标签: spring-boot spring-webflux undertow

这是我的问题:

Please refer to the snapshot

snapshot of logs

2018-12-01 16:03:24.634  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.handler.ASRHandler      : 收到Up请求, id=76cfe0da-6f09-43ef-91a4-53c395387aa4, ak=ca5a1988599987899435bd51e76e2d5c73605519
2018-12-01 16:03:24.634  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.access.TokenManager     : 当前Token: ca5a1988599987899435bd51e76e2d5c73605519, 不存在: false
2018-12-01 16:03:24.650  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 1,  耗时: 16
2018-12-01 16:03:24.651  INFO 11528 --- [pool-1-thread-1] com.asrapi.service.HTTPService     : Up上行 POST-ASR开始:1543651404651
2018-12-01 16:03:24.793  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 2,  耗时: 159
2018-12-01 16:03:24.964  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 2,  耗时: 330
2018-12-01 16:03:25.138  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 2,  耗时: 504
2018-12-01 16:03:25.306  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 2,  耗时: 672
2018-12-01 16:03:25.470  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 2,  耗时: 836
2018-12-01 16:03:25.641  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 2,  耗时: 1007
2018-12-01 16:03:25.805  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 2,  耗时: 1171
2018-12-01 16:03:25.971  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 2,  耗时: 1337
2018-12-01 16:03:26.110  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.handler.ASRHandler      : 收到Down请求, id=76cfe0da-6f09-43ef-91a4-53c395387aa4, ak=ca5a1988599987899435bd51e76e2d5c73605519
2018-12-01 16:03:26.110  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.access.TokenManager     : 当前Token: ca5a1988599987899435bd51e76e2d5c73605519, 不存在: false
2018-12-01 16:03:26.110  INFO 11528 --- [pool-1-thread-1] com.asrapi.service.HTTPService     : Down下行 POST-ASR开始:1543651406110
2018-12-01 16:03:26.191  INFO 11528 --- [t.baidu.com/...] com.asrapi.service.HTTPService     : Down POST-ASR响应总耗时:81
2018-12-01 16:03:26.191  INFO 11528 --- [t.baidu.com/...] com.asrapi.service.HTTPService     : http://audiotest.baidu.com/open_asr_test/down?id=76cfe0da-6f09-43ef-91a4-53c395387aa4, resp_code:200
2018-12-01 16:03:26.191  INFO 11528 --- [t.baidu.com/...] com.asrapi.service.HTTPService     : http://audiotest.baidu.com/open_asr_test/down?id=76cfe0da-6f09-43ef-91a4-53c395387aa4, resp_message:OK
2018-12-01 16:03:26.191  INFO 11528 --- [t.baidu.com/...] com.asrapi.service.HTTPService     : http://audiotest.baidu.com/open_asr_test/down?id=76cfe0da-6f09-43ef-91a4-53c395387aa4, resp_encoding:chunked
2018-12-01 16:03:26.191  INFO 11528 --- [t.baidu.com/...] com.asrapi.service.HTTPService     : http://audiotest.baidu.com/open_asr_test/down?id=76cfe0da-6f09-43ef-91a4-53c395387aa4, resp_protocol:http/1.1
2018-12-01 16:03:26.191  INFO 11528 --- [t.baidu.com/...] com.asrapi.service.HTTPService     : ASR response, type: 4, time: 1543651406191
2018-12-01 16:03:36.090  INFO 11528 --- [t.baidu.com/...] com.asrapi.service.HTTPService     : ASR response, type: 5, time: 1543651416090
2018-12-01 16:03:36.090  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.utils.ASRUtil           : Web response type: 5
2018-12-01 16:03:36.091  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.utils.ASRUtil           : Last NLU response type: 5
id: "76cfe0da-6f09-43ef-91a4-53c395387aa4"
err_no: -3001
err_msg: "server read sdk error, not ltv struct"
last <
>

2018-12-01 16:03:36.093  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 2,  耗时: 11459
2018-12-01 16:03:36.093  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 2,  耗时: 11459
2018-12-01 16:03:36.093  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 2,  耗时: 11459
2018-12-01 16:03:36.093  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 2,  耗时: 11459
2018-12-01 16:03:36.093  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 2,  耗时: 11459
2018-12-01 16:03:36.093  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 2,  耗时: 11459
2018-12-01 16:03:36.093  INFO 11528 --- [   XNIO-1 I/O-1] com.asrapi.service.HTTPService     : receive msg: 3,  耗时: 11459
2018-12-01 16:03:36.110  INFO 11528 --- [t.baidu.com/...] com.asrapi.service.HTTPService     : http://audiotest.baidu.com/open_asr_test/down?id=76cfe0da-6f09-43ef-91a4-53c395387aa4, response text: 
2018-12-01 16:03:36.126  INFO 11528 --- [t.baidu.com/...] com.asrapi.service.HTTPService     : Up POST-ASR响应总耗时:11475
2018-12-01 16:03:36.126  INFO 11528 --- [t.baidu.com/...] com.asrapi.service.HTTPService     : http://audiotest.baidu.com/open_asr_test/up?id=76cfe0da-6f09-43ef-91a4-53c395387aa4, resp_code:200
2018-12-01 16:03:36.126  INFO 11528 --- [t.baidu.com/...] com.asrapi.service.HTTPService     : http://audiotest.baidu.com/open_asr_test/up?id=76cfe0da-6f09-43ef-91a4-53c395387aa4, resp_message:OK
2018-12-01 16:03:36.126  INFO 11528 --- [t.baidu.com/...] com.asrapi.service.HTTPService     : http://audiotest.baidu.com/open_asr_test/up?id=76cfe0da-6f09-43ef-91a4-53c395387aa4, resp_encoding:null
2018-12-01 16:03:36.126  INFO 11528 --- [t.baidu.com/...] com.asrapi.service.HTTPService     : http://audiotest.baidu.com/open_asr_test/up?id=76cfe0da-6f09-43ef-91a4-53c395387aa4, resp_protocol:http/1.1
2018-12-01 16:03:36.126  INFO 11528 --- [t.baidu.com/...] com.asrapi.service.HTTPService     : http://audiotest.baidu.com/open_asr_test/up?id=76cfe0da-6f09-43ef-91a4-53c395387aa4, response text: 

从上面的日志中,我们可以看到“ Down”请求挂断了“ Up”请求,并且在“ Dwon”请求完成后继续执行“ Up”请求。

问题1 :我想知道为什么挂起了请求。

问题2 :我想知道为什么要用同一个NIO线程处理两个请求。

问题3 :我想知道为什么Undertow仅剩一个NIO线程,而为什么阻止外部的“ dwon”请求,或者为什么Udertow做如果Undertow仍然有更多NIO线程,则不要使用两个NIO线程来处理“上”和“下”请求。

据我所知,Undertow NIO线程= CPU内核,所以我的spring-webflux项目中至少应有4个NIO线程。

0 个答案:

没有答案