An on-line HTTP interface call does not pass the related resolution procedure

Source: Internet
Author: User

2016-05-25 08:58:34

Yesterday, the white system because the call external HTTP interface, timeout does not release, resulting in a slow page response, a long time, reported 502 error.

On the Internet to check the next, 502 error is because the service for the customer's request did not get a timely response, query log, found a lot of HTTP interface exception, the page response is also very slow.

Instantly think of shortening the HTTP client call HTTP interface Timeout time, search this blog http://blog.csdn.net/xinying0424/article/details/36006383 thanks

HttpClient 4: Connection timeout: Connection timeout httpclient.getparams (). Setparameter (coreconnectionpnames.connection_timeout,60000);// or Httpconnectionparams.setconnectiontimeout (params,6000); Read timeout: Httpclient.getparams (). Setparameter ( coreconnectionpnames.so_timeout,60000);//or Httpconnectionparams.setsotimeout (params,60000); HttpClient 3: Connection timeout: Httpclient.gethttpconnectionmanager (). Getparams (). Setconnectiontimeout (60000); Read timeout: Httpclient.gethttpconnectionmanager (). Getparams (). Setsotimeout (60000);

Found that I wrote this in the code, but the time is too long to configure

private static Multithreadedhttpconnectionmanager ConnectionManager = null;    private static int connectiontimeout = 2000;t    private static int sockettimeout = 10000;    private static int maxconnectionperhost =;    private static int maxtotalconnections =;    private static HttpClient client;    static {        ConnectionManager = new Multithreadedhttpconnectionmanager ();        Connectionmanager.getparams (). Setconnectiontimeout (connectiontimeout);        Connectionmanager.getparams (). Setsotimeout (sockettimeout);        Connectionmanager.getparams (). Setdefaultmaxconnectionsperhost (maxconnectionperhost);        Connectionmanager.getparams (). Setmaxtotalconnections (maxtotalconnections);        Client = new HttpClient (ConnectionManager);    }

Then I adjusted the Sockettimeout to 2000, the local want to test, the result ...

Java.lang.IllegalArgumentException:host parameter is null call interface error

Checked the next http://wang371134086.iteye.com/blog/1688458 unexpectedly call HTTP interface did not write HTTP.//, plus this paragraph resolution

Problem solving record, thanks for the blog.

http://blog.csdn.net/xinying0424/article/details/36006383
http://wang371134086.iteye.com/blog/1688458

Http://blog.sina.com.cn/s/blog_a577563c01013tlz.html

http://jinnianshilongnian.iteye.com/blog/2089792

http://www.zhihu.com/question/21647204

An on-line HTTP interface call does not pass the related resolution procedure

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.