File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change
1
+ ------
2
+ Async Http Client - Limiting the number of connections to improve raw performance
3
+ ------
4
+ Jeanfrancois Arcand
5
+ ------
6
+ 2012
7
+
8
+ Limiting the number of connections to improve raw performance
9
+
10
+ By default the library uses a connection pool and re-use connections as needed. It is important to not let the
11
+ connection pool grow too large as it takes resources in memory. One way consist of setting the maximum number of
12
+ connection per host or in total:
13
+
14
+ +-----+
15
+ AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder()
16
+ .setMaximumConnectionsPerHost(10)
17
+ .setMaximumConnectionsTotal(100)
18
+ .build();
19
+ AsyncHttpClient c = new AsyncHttpClient(config);
20
+ +-----+
21
+
22
+ There is no magic number, so you will need to try it and decide which one gives the best result.
You can’t perform that action at this time.
0 commit comments