line / armeria

Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
https://armeria.dev
Apache License 2.0
4.74k stars 899 forks source link

Make sure all tests pass when io_uring is enabled #5635

Open trustin opened 2 months ago

trustin commented 2 months ago

Armeria allows a user to choose the underlying transport type between nio, epoll and io_uring, defaulting to epoll on Linux and nio on other OSes. Armeria does not select io_uring even if the current Linux kernel has io_uring support, mainly because there were some test failures when we switched to io_uring.

We need to fix any test failures that occur when io_uring is used, and make it the default transport type on Linux for potentially better performance.

Currently, you can enable io_uring for all tests by inserting two lines in /build.gradle:

def isCi = System.getenv("CI") != null
allprojects {
    // Add common JVM options such as max memory and leak detection.
    tasks.withType(JavaForkOptions) {
        ...
        // Enable io_uring by default (only effective in Linux kernel 5.1+) // šŸ‘ˆšŸ‘ˆšŸ‘ˆ
        systemProperties 'com.linecorp.armeria.transportType': 'io_uring'   // šŸ‘ˆšŸ‘ˆšŸ‘ˆ
    }
    ...

You can confirm io_uring is actually in use from the log message like the following:

INFO  com.linecorp.armeria.common.Flags - transportType: IO_URING (sysprops)

Also, the event loop thread names will have -io_uring, e.g. armeria-common-worker-io_uring-3-6.

trustin commented 2 months ago

@dachshu, you told me you're interested in this issue last week, right? :wink: