Experiments on how to add Loom support for Netty

Overview

Netty Loom Experiment

This repository contains Project Loom and Netty related test code.

Contents / Goals

I created these examples since I was curious about Project Loom and what it would mean for my Netty based Vert.x projects.

Netty

In my first test I created a regular netty server which makes use of the NioEventLoopGroup. A custom thread factory is used to enable Netty to use VirtualThreads instead of platform threads.

I went further down the rabbit hole since I wanted to check whether it would be possible to use on-demand virtual threads instead of pooling virtual threads. I thus created the LoomNioEventLoopGroup. Unfortunatly my knowledge of selector based IO is very limited and I did not yet find a way to change the request handling.

For comparison I also created the #testPlatformThreads variant which uses regular platform threads.

NIO

In order to further experiment with NIO Server handling I created a few additional testcases to check whether there are other potential ways to make use of virtualthreads.

The SimpleAsyncSocketServerTest contains a basic NIO server which only uses platform threads. I started from here to learn more about AsynchronousServerSocketChannel.

In the NioServerExampleTest I use virtual threads to handle previously accepted connections. Actually I'm a bit surprised that this example even works since the selector in the thread is registered after the connection has been accepted.

Next I had the idea to use the AsynchronousServerSocketChannel which has the benefit that it can accept callbacks for request handling. The #testServerWithFork test forks a dedicated virtual thread in the accept handler for each connection. The #testServerWithGroup uses the option to setup a AsynchronousChannelGroup to handle threading internally. This is similar to Netty as it works with a dedicated thread pool.

Loom

During my testing I noticed that Netty would not be able to process requests when I configured a thread pool size of 500+. I created the LoomThreadTest to replicate this issue and found that the JVM would not run / start a virtual thread of 400+ previous threads were calling new Selector().select(). I'm not yet sure why this is the case.

Used Versions:

openjdk version "18-loom" 2022-03-15
OpenJDK Runtime Environment (build 18-loom+5-274)
OpenJDK 64-Bit Server VM (build 18-loom+5-274, mixed mode, sharing)
You might also like...

A networking library for LibGDX utilizing Netty allowing easy creation of multiplayer games.

Lunar What is Lunar? Lunar is a networking library for LibGDX. With lunar you can easily create multiplayer games quickly and efficiently. Lunar provi

Nov 25, 2022

✈A high-performance RPC based on Java & Netty.

bRPC README 中文版本 一个基于netty的RPC框架 基于netty NIO、IO多路复用。 client与server端建立心跳包保活机制。发生未知断连时,重连保证可靠长连接。 使用kryo序列化,自定义传输包,及传输格式,避免TCP沾包问题。 支持zookeeper或nacos做服务

Dec 16, 2022

A implementation of shadowsocks that base on java's netty framework

Shadowsocks shadowsocks is a fast tunnel proxy that helps you bypass firewalls. shadowsocks-java is a implementation of shadowsocks protocol that base

Oct 17, 2022

Add something to Minecraft LAN Server List

DiscoverMe Make a fortune... in Minecraft Server List! 0 dependencies, Java 8 compatible. Usage Example: DiscoverMe.INSTANCE.addEntry(SimpleChatColor.

Oct 13, 2021

NPM Package - A react native component that let you to add a wavy background UI.

NPM Package - A react native component that let you to add a wavy background UI.

react-native-wavy-background A react native component that let you to add a wavy background UI. Installation npm install react-native-wavy-background

Oct 19, 2022

Add custom auth options (e.g. face unlock) to your phone using Xposed.

UniversalAuth This project aims to bring a variety of custom authentication options to various Android ROMs. Your phone needs to have Xposed (or EdXpo

Dec 29, 2022

Program that allows employees to clock in and clock out of work. Employees who are managers can add, edit and delete employees and shifts from the database.

Program that allows employees to clock in and clock out of work. Employees who are managers can add, edit and delete employees and shifts from the database.

Clock-In-Clock-Out-System Created by: Kennedy Janto, Taylor Vandenberg, Duc Nguyen, Alex Gomez, Janista Gitbumrungsin This is a semester long project

Nov 5, 2022

This repository is totally dedicated to Hacktoberfest 2021, feel free to add your project.

This repository is totally dedicated to Hacktoberfest 2021, feel free to add your project.

push-it-hacktoberfest This repository is totally dedicated to Hacktoberfest 2021, feel free to add your project. HacktoberFest21 Hello Hackers, Contri

Oct 31, 2021

Ti.googlepay - Add Google Pay to your app

Ti.googlepay - Add Google Pay to your app

Google Pay Add Google Pay to your app: Events available success canceled error Methods setupPaymentGateway: name, apiKey createPaymentRequest: environ

Nov 7, 2022
Owner
Johannes Schüth
Johannes Schüth
First experiments to try to render the Doom WAD maps using only standard libraries. Test 004 - https://youtu.be/-6mePgg7gXE

JavaDoomWADMapRendererTests Test 001 (07/set/2022) - https://youtu.be/MpY0PICdcwM First experiments to try to render the Doom WAD maps using only stan

Leo 6 Oct 17, 2022
Async-Await support for Vertx using Project Loom

Vertx-Async-Await Async-Await support for Vertx using Project Loom. import static com.augustnagro.vertx.loom.AsyncAwait.async; import static com.augus

August Nagro 21 Jun 9, 2022
Patches for the old minecraft official launcher to add microsoft account support

MSA4Legacy Patches for the old minecraft official launcher to add microsoft account support My code here is quite atrocious in some parts (for example

Nep Nep 26 Nov 3, 2022
Echo client-server components to evaluate Project Loom virtual threads.

Overview Project Loom is the OpenJDK initiative to introduce user-mode threads in Java. The purpose of this repository is to compare Project Loom virt

Elliot Barlas 15 Nov 1, 2022
The first Java Actor System supporting fibers from Project Loom

Fibry Fibry is an experimental Actor System built to be simple and flexible. Hopefully, it will also be fun to use. Fibry is the first Java Actor Syst

Luca Venturi 196 Dec 26, 2022
A spring boot application for providing loom-ld services

LOOM-LD Structures sparql_based-linking It is a java project using maven to manage dependencies. loom-ld It is a spring boot application for providing

Ontology Engineering Group (UPM) 2 Apr 19, 2022
Experimenting with Project Loom

Project Loom Lab Experiments with Project Loom's features based on these JEP(draft)s: Structured Concurrency Virtual Threads Experiments For these exp

Nicolai Parlog 86 Dec 23, 2022
Use Quilt Mappings on Loom

Quilt Mappings on Loom The time has finally arrived! Quilt Mappings are now usable in Loom! Ever wanted to use mappings other than Yarn or MojMap? Qui

null 15 Dec 7, 2022
Helidon Níma Example - Loom based webserver

helidon-nima-example Helidon Níma Example - Loom based webserver This example is built on top of an ALPHA-1 release of Helidon 4. Alpha releases serve

Tomas Langer 30 Dec 16, 2022
High performance RPC framework based on netty

RPC(Remote Procedure Call)实战 @desc: 仅用于个人学习、了解RPC @date: 2021/01/16 技术组成: 版本一 版本二 版本三 传输层 Netty4 * * 编码层 Kryo * * 应用层 JDK动态代理 * * 服务注册与发现 手动注册+guava缓存

XDD 10 Nov 22, 2022