-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why always [reactor-tcp-nio-2] #65
Comments
That's how netty dispatches connections across threads. This is not a problem, it is a consequence of the default |
Sorry, I don't understand it clearly. Why not @Override
public EventLoop next() {
EventLoop loop = nextInternal();
return loop != null ? loop : eventLoopGroup.next();
}
|
Here is my solution. I custom a @Bean
public ConnectionFactoryOptionsBuilderCustomizer customizer() {
return builder -> {
NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup(6, new ThreadFactory() {
private final AtomicInteger i = new AtomicInteger(0);
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r);
thread.setName("r2dbc-tcp-nio-" + i.getAndIncrement());
return thread;
}
});
LoopResources loopResources = useNative -> eventLoopGroup;
builder.option(LOOP_RESOURCES, loopResources);
};
} |
Leaving another reference: r2dbc/r2dbc-pool#190 |
I've created a new project,
pom.xml
is as followsThis
controller
gets me some data from DB,getTest
retruns first record,getTest2
returns all records. There are about 10000 records in DB.application.yml
Here is my question, I request
/test2
first, then/test1
,/test1
will be wait until/test2
is complete.log
file shows that only 1 thread is handling my request, which isreactor-tcp-nio-2
.I tried to custom
LoopResources
, but I got the same result.This problem has been bothering me for a long time. Could someone help me about it?
😭😭😭
The text was updated successfully, but these errors were encountered: