From 3706bdaee8aa3249b67b395fda1b9a5e8d083506 Mon Sep 17 00:00:00 2001 From: Amos Ng Date: Fri, 12 Jun 2020 05:23:05 +0800 Subject: [PATCH] Raising socket limit again, should be neligible for performance. We need people getting Gbit/s traffic to see if this works :hmm: --- CHANGELOG.md | 1 + src/main/kotlin/mdnet/base/Application.kt | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7cc0f6..def210a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [2020-06-12] Added CHANGELOG.md by [@lflare]. ### Changed +- [2020-06-12] Raised ApacheClient socket limit to `2**18` by [@lflare]. ### Deprecated diff --git a/src/main/kotlin/mdnet/base/Application.kt b/src/main/kotlin/mdnet/base/Application.kt index fbb8957..78459e5 100644 --- a/src/main/kotlin/mdnet/base/Application.kt +++ b/src/main/kotlin/mdnet/base/Application.kt @@ -39,6 +39,7 @@ import javax.crypto.CipherOutputStream import javax.crypto.spec.SecretKeySpec private val LOGGER = LoggerFactory.getLogger("Application") +private val THREADS_TO_ALLOCATE = 2**18 // Honestly, no reason to not just let 'er rip. Inactive connections will expire on their own :D fun getServer(cache: DiskLruCache, serverSettings: ServerSettings, clientSettings: ClientSettings, statistics: AtomicReference): Http4kServer { val executor = Executors.newCachedThreadPool() @@ -54,8 +55,8 @@ fun getServer(cache: DiskLruCache, serverSettings: ServerSettings, clientSetting .setSocketTimeout(3000) .setConnectionRequestTimeout(3000) .build()) - .setMaxConnTotal(65535) - .setMaxConnPerRoute(65535) + .setMaxConnTotal(THREADS_TO_ALLOCATE) + .setMaxConnPerRoute(THREADS_TO_ALLOCATE) // Have it at the maximum open sockets a user can have in most modern OSes. No reason to limit this, just limit it at the Netty side. .build())