Merge branch 'fix/increase-thread-limit-again' into 'master'

Raising socket limit again, should be neligible for performance.

See merge request mangadex/mangadex_at_home!15
This commit is contained in:
Amos (LFlare) N 2020-06-12 09:21:38 +00:00
commit e107bf72ec
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())