Mikael Ståldal
09/01/2023, 8:56 AMNetty
server.)s4nchez
09/01/2023, 9:00 AMs4nchez
09/01/2023, 9:01 AMMikael Ståldal
09/01/2023, 9:02 AMs4nchez
09/01/2023, 9:18 AMhttpHandler.asServer(Jetty(port, Server(QueuedThreadPool(100))))
fredrik.nordin
09/01/2023, 10:01 AMs4nchez
09/01/2023, 10:11 AMMikael Ståldal
09/01/2023, 10:44 AMNetty
if you configure the workerGroup
with a custom size:
https://github.com/http4k/http4k/blob/master/http4k-server/netty/src/main/kotlin/org/http4k/server/Netty.kt#L38
private val workerGroup = NioEventLoopGroup(4)
Mikael Ståldal
09/01/2023, 10:45 AMNetty
perhaps?s4nchez
09/01/2023, 11:36 AMMikael Ståldal
09/01/2023, 1:21 PMs4nchez
09/01/2023, 1:37 PMMikael Ståldal
09/01/2023, 1:40 PMclass Netty(val port: Int = 8000, override val stopMode: StopMode, workerGroup: NioEventLoopGroup = NioEventLoopGroup())
s4nchez
09/01/2023, 1:52 PMMikael Ståldal
09/01/2023, 1:54 PMworkerGroup
you might want to customize, such as ThreadFactory to give threads nice names.)s4nchez
09/01/2023, 1:54 PMMikael Ståldal
09/01/2023, 1:55 PMs4nchez
09/01/2023, 1:55 PMMikael Ståldal
09/01/2023, 2:36 PMMikael Ståldal
09/01/2023, 2:56 PMdave
09/01/2023, 2:59 PMs4nchez
09/01/2023, 3:23 PMJetty
is an exceptional case we want to get rid of, actually):
Each of the server backends implement an interface ServerConfig, which is written with sensible defaults for the server in questions, but is also designed to be used as a starting point for tweaking to API user needs. To customize, simply use the relevant ServerConfig class as a starting point and reimplement as required. See the how-to guides for an example of this in use.
The way to go for your use case is to create a custom ServerConfig (e.g. NettyWithLimitedConcurrency
), which you can configure with the parameters you need.
Again, please accept my apologies for lead you in the wrong path.Mikael Ståldal
09/01/2023, 3:29 PMJetty
configurability is not an example to be followed?s4nchez
09/01/2023, 3:35 PMServer
parameter from Jetty
in the future. Meanwhile, I'll stop recommending its use like I did above to avoid this kind of confusion.Mikael Ståldal
09/01/2023, 3:36 PMJetty
server parameter?