Optimize performance when many new connections arrive#2837
Optimize performance when many new connections arrive#2837xiexin36 wants to merge 3 commits intospring-projects:5.1.xfrom
Conversation
|
Thanks for the contribution, but why not just increase the backlog? /**
* The number of sockets in the connection backlog. Default 5;
* increase if you expect high connection rates.
* @param backlog The backlog to set.
*/
public void setBacklog(int backlog) {Also, we don't accept code changes without test cases that exercise the new code. |
|
@garyrussell Yes, I also tried to set the backlog, even to 20, and I also set the nioHarvestInterval bigger than default, but it did not work. Everytime AbstractConnectionFactory.processNioSelections execute, there are too many things need to do , and the doAccept is the last one. |
@garyrussell With the current test ConnectionFactoryTests.testObtainConnectionIdsNio, the new code can be converaged, I have run the test. |
|
OK; thanks for the contribution. |
See spring-projects#2837 Give priority to accepting new connections over reading data from existing connections. Add a flag to allow users to revert to the previous behavior of giving reads priority. **cherry-pick to 5.1.x**
See spring-projects#2837 Give priority to accepting new connections over reading data from existing connections. Add a flag to allow users to revert to the previous behavior of giving reads priority. **cherry-pick to 5.1.x**
See spring-projects#2837 Give priority to accepting new connections over reading data from existing connections. Add a flag to allow users to revert to the previous behavior of giving reads priority. **cherry-pick to 5.1.x**
See #2837 Give priority to accepting new connections over reading data from existing connections. Add a flag to allow users to revert to the previous behavior of giving reads priority. **cherry-pick to 5.1.x**
See #2837 Give priority to accepting new connections over reading data from existing connections. Add a flag to allow users to revert to the previous behavior of giving reads priority. **cherry-pick to 5.1.x** # Conflicts: # spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioServerConnectionFactory.java # src/reference/asciidoc/whats-new.adoc # TcpNioConnectionTests.java
@garyrussell Great job ! And when the 5.1.4 version will be release? |
|
Currently scheduled for next Tuesday (April 2). |
When many new connections arrive at once, we should accept as soon as possible. accept connections in a for loop until no new connection is ready