Configure HttpClient correctly
References:
[1] http://dev.bizo.com/2013/04/sensible-defaults-for-apache-httpclient.html
We have hit an issue recently that the httpClient is too slow to send messages to the hosts. Finally, we found that we just use
CloseableHttpClient httpClient = HttpClients.custom().build();
to create a default httpClient and not even configure it. We shoud have set at least MaxTotal and MaxPerRoute.
MaxTotal is the maximum total number of connections in the pool. MaxPerRoute is the maximum number of connections to a particular host. If the client attempts to make a request and either of these maximums have been reached, then by default the client will block until a connection is free. Unfortunately the default for MaxTotal is 20 and the default MaxPerRoute is only 2.
Finally we solved th issue by setting
CloseableHttpClient httpClient = HttpClients.custom()
.setMaxConnTotal(threadpoolSize) // threadpoolSize = 100
.setMaxConnPerRoute(threadpoolSize)
.build();
Configure HttpClient correctly的更多相关文章
- HttpClient(4.3.5) - HTTP Authentication
HttpClient provides full support for authentication schemes defined by the HTTP standard specificati ...
- 【ASP.NET Web API教程】3.2 通过.NET客户端调用Web API(C#)
原文:[ASP.NET Web API教程]3.2 通过.NET客户端调用Web API(C#) 注:本文是[ASP.NET Web API系列教程]的一部分,如果您是第一次看本博客文章,请先看前面的 ...
- httpcomponents-client-4.4.x
Chapter 1. Fundamentals Prev Next Chapter 1. Fundamentals 1.1. Request execution The most essent ...
- httpcomponents-client-ga(4.5)
http://hc.apache.org/httpcomponents-client-ga/tutorial/html/ Chapter 1. Fundamentals Prev Next ...
- httpcomponents-client-4.3.x DOC
Chapter 1. Fundamentals Prev Next Chapter 1. Fundamentals 1.1. Request execution The most essent ...
- 通过.NET客户端调用Web API(C#)
3.2 Calling a Web API From a .NET Client (C#) 3.2 通过.NET客户端调用Web API(C#) 本文引自:http://www.asp.net/web ...
- Nginx - SSI Module
SSI, for Server Side Includes, is actually a sort of server-side programming language interpreted by ...
- Jetty开发指导:HTTP Client
介绍 Jetty HTTP client模块提供易用的API.工具类和一个高性能.异步的实现来运行HTTP和HTTPS请求. Jetty HTTP client模块要求Java版本号1.7或者更高,J ...
- 翻译一篇关于jedis的文章
翻译 自 http://www.baeldung.com/jedis-java-redis-client-libraryIntro to Jedis – the Java Redis Client L ...
随机推荐
- JS中的bind的实现以及使用
在讨论bind()方法之前我们先来看一道题目: var altwrite = document.write; altwrite("hello"); //1.以上代码有什么问题 // ...
- LoadRunner性能测试专项班隆重开班
LoadRunner性能测试专项班隆重开班 POPTEST首届高级性能测试提升强化班开课. 也许你只是看到成功者的光鲜,却没看到他们的努力和汗水.不要否定现在,要看到未来.提高自己.怎么自己.成就自己 ...
- UILabel的讲解
首先,我先自定义几个名词,方便接下来的讲解工作.如下图所示: 接下来,通过五个方面来讲解我们能对UILabel做出哪些改变或者称之为设置: 1.文字 1.1普通文字:内容text.字体大小font.字 ...
- 免费视频播放器videojs中文教程
Video.js是一款web视频播放器,支持html5和flash两种播放方式.更多关于video.js的介绍,可以访问官方网站介绍,我之前也写过一篇关于video.js的使用心得,有兴趣的可以点这里 ...
- jquery 中 eq()遍历方法 和:eq()选择器的区别
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- UVa/数组和字符串习题集
UVa-272. Description: TEX is a typesetting language developed by Donald Knuth. It takes source text ...
- JQuery分页插件封装(源码来自百度,自己封装)
最近由于项目的需要,做了一个基于JQuery的表格分页插件封装,部分源码来源百度,经由自己封装完成. 下面是具体代码和说明,仅供参考.第一步可以先将我的HTML,CSS,JS这三部分的代码创建好后先运 ...
- 深入理解css中vertical-align属性
一.为什么要写这篇文章 今天看到一个问题: 两个div 都设置 display:inline-block,正常显示:但是在第二个div中加一个块级元素或者内联元素,显示就变了个样,为什么? <m ...
- KEIL中逻辑分析仪的使用
本学期开了门嵌入式的课程,在实验课上用到了一款基于ARM Cortex-M3处理器的LPC1768的实验板.本来这种课程我觉得应该可以学到很多东西,可是我发现实验课上老师基本只是讲了xx实验课的要求, ...
- IO流中的Stream相关对象
流无处不在,只要是关于到文件的输入.输出.更新等,关于IO流,项目中还是经常用到的,写log日志免不了要与其打交道,现在需要用到,就顺道好好回顾一下进行整理,首先是几个需要用到的类的说明,其实说简单点 ...