If Netty is a requirement, what are the tradeoffs when bringing virtual threads into the design? Would a virtual thread per connection be a simpler option?
How would you integrate Netty with Java virtual threads?
Answers
A virtual thread per connection is a reasonable design to consider, but it is a different architecture from keeping Netty as the networking layer and integrating virtual threads with it. If Netty is mandatory, the integration has to work within that constraint rather than just replace it.
Reply to this answer
Virtual threads make this style more accessible in Java, but the underlying idea is not new. Fibers and other stackful lightweight thread models have been around for a long time.
Reply to this answer
Be careful with performance comparisons across systems that use different concurrency models. For example, a comparison with PostgreSQL does not by itself tell you whether a virtual thread per connection would perform well, since PostgreSQL does not use lightweight threads.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions