fixed proxy server performance

This commit is contained in:
Maxksim Fomenkov
2022-09-02 17:18:55 +03:00
parent 09ff044b67
commit 3ad0c73d6a
2 changed files with 5 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ import io.micrometer.core.instrument.Metrics
import io.micrometer.core.instrument.Timer
import io.netty.channel.ChannelHandler
import io.netty.channel.ChannelHandlerContext
import io.netty.channel.nio.NioEventLoopGroup
import org.slf4j.LoggerFactory
import reactor.netty.http.server.HttpServer
import reactor.netty.http.server.HttpServerRoutes
@@ -107,6 +108,7 @@ class ProxyServer(
serverBuilder
.route(this::setupRoutes)
.runOn(NioEventLoopGroup())
.bindNow()
}

View File

@@ -119,7 +119,9 @@ open class WsConnection(
.multicast()
.directBestEffort<Instant>()
private val sendIdSeq = AtomicInteger(IDS_START)
private val sendExecutor = Executors.newSingleThreadExecutor()
private val sendExecutor = Executors.newFixedThreadPool(
1.coerceAtLeast(Runtime.getRuntime().availableProcessors() / 2)
)
private var keepConnection = true
private var connection: Disposable? = null
private val reconnecting = AtomicBoolean(false)