You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tz...@apache.org on 2020/09/10 14:25:39 UTC

[flink-statefun] 03/03: [FLINK-19192] Set connection pool size to 1024

This is an automated email from the ASF dual-hosted git repository.

tzulitai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-statefun.git

commit b86daab2b2836a98fe8cd1fbd9288db50fe71811
Author: Igal Shilman <ig...@gmail.com>
AuthorDate: Thu Sep 10 13:13:49 2020 +0200

    [FLINK-19192] Set connection pool size to 1024
    
    This commits increase the max size of the http connection pool to
    1024. The connection pool holds connections to the various endpoints
    and possibly various endpoint instances. The remote server can decide
    that they will not keep the connection alive. An idle connection
    would be evicted after 1 minute of inactivity.
    
    This closes #146.
---
 .../org/apache/flink/statefun/flink/core/httpfn/OkHttpUtils.java     | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/statefun-flink/statefun-flink-core/src/main/java/org/apache/flink/statefun/flink/core/httpfn/OkHttpUtils.java b/statefun-flink/statefun-flink-core/src/main/java/org/apache/flink/statefun/flink/core/httpfn/OkHttpUtils.java
index 2775667..e1f3814 100644
--- a/statefun-flink/statefun-flink-core/src/main/java/org/apache/flink/statefun/flink/core/httpfn/OkHttpUtils.java
+++ b/statefun-flink/statefun-flink-core/src/main/java/org/apache/flink/statefun/flink/core/httpfn/OkHttpUtils.java
@@ -16,6 +16,7 @@
 
 package org.apache.flink.statefun.flink.core.httpfn;
 
+import java.util.concurrent.TimeUnit;
 import okhttp3.ConnectionPool;
 import okhttp3.Dispatcher;
 import okhttp3.OkHttpClient;
@@ -28,9 +29,11 @@ final class OkHttpUtils {
     dispatcher.setMaxRequestsPerHost(Integer.MAX_VALUE);
     dispatcher.setMaxRequests(Integer.MAX_VALUE);
 
+    ConnectionPool connectionPool = new ConnectionPool(1024, 1, TimeUnit.MINUTES);
+
     return new OkHttpClient.Builder()
         .dispatcher(dispatcher)
-        .connectionPool(new ConnectionPool())
+        .connectionPool(connectionPool)
         .followRedirects(true)
         .followSslRedirects(true)
         .retryOnConnectionFailure(true)