mirror of
https://gitlab.com/mangadex-pub/mangadex_at_home.git
synced 2024-01-19 02:48:37 +00:00
Made more changes to the numbers used for threading
This commit is contained in:
parent
c87a0c0041
commit
ac682e98c3
|
@ -45,7 +45,7 @@ fun getServer(cache: DiskLruCache, serverSettings: ServerSettings, clientSetting
|
||||||
val executor = Executors.newCachedThreadPool()
|
val executor = Executors.newCachedThreadPool()
|
||||||
|
|
||||||
if (LOGGER.isInfoEnabled) {
|
if (LOGGER.isInfoEnabled) {
|
||||||
LOGGER.info("Starting ApacheClient with {} threads", THREADS_TO_ALLOCATE)
|
LOGGER.info("Starting image retriever")
|
||||||
}
|
}
|
||||||
|
|
||||||
val client = ApacheClient(responseBodyMode = BodyMode.Stream, client = HttpClients.custom()
|
val client = ApacheClient(responseBodyMode = BodyMode.Stream, client = HttpClients.custom()
|
||||||
|
@ -144,7 +144,6 @@ fun getServer(cache: DiskLruCache, serverSettings: ServerSettings, clientSetting
|
||||||
if (LOGGER.isTraceEnabled) {
|
if (LOGGER.isTraceEnabled) {
|
||||||
LOGGER.trace("Upstream query for $sanitizedUri errored with status {}", mdResponse.status)
|
LOGGER.trace("Upstream query for $sanitizedUri errored with status {}", mdResponse.status)
|
||||||
}
|
}
|
||||||
mdResponse.close()
|
|
||||||
Response(mdResponse.status)
|
Response(mdResponse.status)
|
||||||
} else {
|
} else {
|
||||||
if (LOGGER.isTraceEnabled) {
|
if (LOGGER.isTraceEnabled) {
|
||||||
|
@ -195,7 +194,6 @@ fun getServer(cache: DiskLruCache, serverSettings: ServerSettings, clientSetting
|
||||||
}
|
}
|
||||||
respondWithImage(mdResponse.body.stream, contentLength, contentType, lastModified)
|
respondWithImage(mdResponse.body.stream, contentLength, contentType, lastModified)
|
||||||
}
|
}
|
||||||
mdResponse.close()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,11 +35,12 @@ import java.util.concurrent.atomic.AtomicReference
|
||||||
import javax.net.ssl.SSLException
|
import javax.net.ssl.SSLException
|
||||||
|
|
||||||
private val LOGGER = LoggerFactory.getLogger("Application")
|
private val LOGGER = LoggerFactory.getLogger("Application")
|
||||||
|
private val THREADS_TO_ALLOCATE = Runtime.getRuntime().availableProcessors() * 32 / 2
|
||||||
|
|
||||||
class Netty(private val tls: ServerSettings.TlsCert, private val clientSettings: ClientSettings, private val stats: AtomicReference<Statistics>) : ServerConfig {
|
class Netty(private val tls: ServerSettings.TlsCert, private val clientSettings: ClientSettings, private val stats: AtomicReference<Statistics>) : ServerConfig {
|
||||||
override fun toServer(httpHandler: HttpHandler): Http4kServer = object : Http4kServer {
|
override fun toServer(httpHandler: HttpHandler): Http4kServer = object : Http4kServer {
|
||||||
private val masterGroup = NioEventLoopGroup(Runtime.getRuntime().availableProcessors() * 30 / 2)
|
private val masterGroup = NioEventLoopGroup(THREADS_TO_ALLOCATE)
|
||||||
private val workerGroup = NioEventLoopGroup(Runtime.getRuntime().availableProcessors() * 30 / 2)
|
private val workerGroup = NioEventLoopGroup(THREADS_TO_ALLOCATE)
|
||||||
private lateinit var closeFuture: ChannelFuture
|
private lateinit var closeFuture: ChannelFuture
|
||||||
private lateinit var address: InetSocketAddress
|
private lateinit var address: InetSocketAddress
|
||||||
|
|
||||||
|
@ -52,6 +53,10 @@ class Netty(private val tls: ServerSettings.TlsCert, private val clientSettings:
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun start(): Http4kServer = apply {
|
override fun start(): Http4kServer = apply {
|
||||||
|
if (LOGGER.isInfoEnabled) {
|
||||||
|
LOGGER.info("Starting webserver with {} threads", THREADS_TO_ALLOCATE)
|
||||||
|
}
|
||||||
|
|
||||||
val (mainCert, chainCert) = getX509Certs(tls.certificate)
|
val (mainCert, chainCert) = getX509Certs(tls.certificate)
|
||||||
val sslContext = SslContextBuilder
|
val sslContext = SslContextBuilder
|
||||||
.forServer(getPrivateKey(tls.privateKey), mainCert, chainCert)
|
.forServer(getPrivateKey(tls.privateKey), mainCert, chainCert)
|
||||||
|
|
Loading…
Reference in a new issue