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()
|
||||
|
||||
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()
|
||||
|
@ -144,7 +144,6 @@ fun getServer(cache: DiskLruCache, serverSettings: ServerSettings, clientSetting
|
|||
if (LOGGER.isTraceEnabled) {
|
||||
LOGGER.trace("Upstream query for $sanitizedUri errored with status {}", mdResponse.status)
|
||||
}
|
||||
mdResponse.close()
|
||||
Response(mdResponse.status)
|
||||
} else {
|
||||
if (LOGGER.isTraceEnabled) {
|
||||
|
@ -195,7 +194,6 @@ fun getServer(cache: DiskLruCache, serverSettings: ServerSettings, clientSetting
|
|||
}
|
||||
respondWithImage(mdResponse.body.stream, contentLength, contentType, lastModified)
|
||||
}
|
||||
mdResponse.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,11 +35,12 @@ import java.util.concurrent.atomic.AtomicReference
|
|||
import javax.net.ssl.SSLException
|
||||
|
||||
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 {
|
||||
override fun toServer(httpHandler: HttpHandler): Http4kServer = object : Http4kServer {
|
||||
private val masterGroup = NioEventLoopGroup(Runtime.getRuntime().availableProcessors() * 30 / 2)
|
||||
private val workerGroup = NioEventLoopGroup(Runtime.getRuntime().availableProcessors() * 30 / 2)
|
||||
private val masterGroup = NioEventLoopGroup(THREADS_TO_ALLOCATE)
|
||||
private val workerGroup = NioEventLoopGroup(THREADS_TO_ALLOCATE)
|
||||
private lateinit var closeFuture: ChannelFuture
|
||||
private lateinit var address: InetSocketAddress
|
||||
|
||||
|
@ -52,6 +53,10 @@ class Netty(private val tls: ServerSettings.TlsCert, private val clientSettings:
|
|||
}
|
||||
|
||||
override fun start(): Http4kServer = apply {
|
||||
if (LOGGER.isInfoEnabled) {
|
||||
LOGGER.info("Starting webserver with {} threads", THREADS_TO_ALLOCATE)
|
||||
}
|
||||
|
||||
val (mainCert, chainCert) = getX509Certs(tls.certificate)
|
||||
val sslContext = SslContextBuilder
|
||||
.forServer(getPrivateKey(tls.privateKey), mainCert, chainCert)
|
||||
|
|
Loading…
Reference in a new issue