尝试调用20个线程去调用REST_API进行语音识别,要好久才能返回识别结果
20...8@qq.com 发布于2016-10-27 浏览:1343 回复:7
0
收藏

调用2个线程去调用REST_API进行语音识别,要好久才能返回识别结果,请问是不能进行并发么?而且有些线程还不能返回识别结果,代码应该是没问题的,我将线程数减为1是正常的报错如下:

java.io.IOException: Error writing to server

at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:625)

at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:637)

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1320)

at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)

at cn.ihkappweb.web.test.autid.Sample.printResponse(Sample.java:104)

at cn.ihkappweb.web.test.autid.Sample.method1(Sample.java:78)

at cn.ihkappweb.web.test.autid.Sample.run(Sample.java:234)

at java.lang.Thread.run(Thread.java:722)

java.net.SocketTimeoutException: Read timed out

at java.net.SocketInputStream.socketRead0(Native Method)

at java.net.SocketInputStream.read(SocketInputStream.java:150)

at java.net.SocketInputStream.read(SocketInputStream.java:121)

at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)

at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)

at java.io.BufferedInputStream.read(BufferedInputStream.java:334)

at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:633)

at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:579)

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1322)

at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)

at cn.ihkappweb.web.test.autid.Sample.printResponse(Sample.java:104)

at cn.ihkappweb.web.test.autid.Sample.method1(Sample.java:78)

at cn.ihkappweb.web.test.autid.Sample.run(Sample.java:234)

at java.lang.Thread.run(Thread.java:722)

java.io.IOException: Error writing to server

at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:625)

at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:637)

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1320)

at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)

at cn.ihkappweb.web.test.autid.Sample.printResponse(Sample.java:104)

at cn.ihkappweb.web.test.autid.Sample.method1(Sample.java:78)

at cn.ihkappweb.web.test.autid.Sample.run(Sample.java:234)

at java.lang.Thread.run(Thread.java:722)


收藏
点赞
0
个赞
共7条回复 最后由xieymxj回复于2016-11-14
#8xieymxj回复于2016-11-14

多谢支持

0
#720...8@qq.com回复于2016-10-31

好的谢谢

0
#6hedang_hd回复于2016-10-31

20...8@qq.com:

回复xieymxj:可以有qq或者电话或者别的联系方式直接沟通联系的么?这样申请起来比较方便

回复20...8@qq.comvoice_feedback@baidu.com,麻烦请把使用场景和并发量情况发至反馈邮箱,我们评估一下,谢谢

0
#520...8@qq.com回复于2016-10-31

xieymxj:

回复20...8@qq.com:这个我们就要评估了,不是说任何并发需求都能无限满足的。

回复xieymxj:可以有qq或者电话或者别的联系方式直接沟通联系的么?这样申请起来比较方便

0
#4xieymxj回复于2016-10-31

20...8@qq.com:

我觉得应该是你们的吞吐量和并发量有限制的原因,我要如何才能申请提高吞吐量和并发量呢?发邮件去申请好久都没见回邮件

回复20...8@qq.com:这个我们就要评估了,不是说任何并发需求都能无限满足的。

0
#320...8@qq.com回复于2016-10-31

我觉得应该是你们的吞吐量和并发量有限制的原因,我要如何才能申请提高吞吐量和并发量呢?发邮件去申请好久都没见回邮件

0
#2xieymxj回复于2016-10-31

因为您使用的是API,所以语音识别的时间跟语音的长度有关,比如1s的语音需要0.3s进行识别,加上网络交互的时间(300~500ms),请问是否符合您的描述?

0
TOP
切换版块