Raising socket limit again, should be neligible for performance.

We need people getting Gbit/s traffic to see if this works :hmm:
This commit is contained in:
Amos Ng 2020-06-12 05:23:05 +08:00
parent 69151d058f
commit 3706bdaee8
No known key found for this signature in database
GPG Key ID: 89086414F634D123
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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<Statistics>): 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())