1
0
Fork 1
mirror of https://gitlab.com/mangadex-pub/mangadex_at_home.git synced 2024-01-19 02:48:37 +00:00

Make Netty naive-multithreaded too

Hopefully we can replace this that intelligently scales to a user
setting next time...
This commit is contained in:
Amos Ng 2020-06-12 00:55:47 +08:00
parent 5dbe29c8e9
commit da47b86d97
No known key found for this signature in database
GPG key ID: 89086414F634D123
2 changed files with 3 additions and 3 deletions

View file

@ -39,7 +39,7 @@ import javax.crypto.CipherOutputStream
import javax.crypto.spec.SecretKeySpec
private val LOGGER = LoggerFactory.getLogger("Application")
private val THREADS_TO_ALLOCATE = Runtime.getRuntime().availableProcessors() * 30 / 2
private val THREADS_TO_ALLOCATE = Runtime.getRuntime().availableProcessors() * 30
fun getServer(cache: DiskLruCache, serverSettings: ServerSettings, clientSettings: ClientSettings, statistics: AtomicReference<Statistics>): Http4kServer {
val executor = Executors.newCachedThreadPool()

View file

@ -38,8 +38,8 @@ private val LOGGER = LoggerFactory.getLogger("Application")
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()
private val workerGroup = NioEventLoopGroup()
private val masterGroup = NioEventLoopGroup(Runtime.getRuntime().availableProcessors() * 30 / 2)
private val workerGroup = NioEventLoopGroup(Runtime.getRuntime().availableProcessors() * 30 / 2)
private lateinit var closeFuture: ChannelFuture
private lateinit var address: InetSocketAddress