Dear everyone,

In my work, I encountered one problem. I used NIO in my Server code, the server 
need to communicate wtih 100 thousand devices.
When all the 100 thousand deviced connected my server, the cpu rate of the 
computer deployed the Server code will come to 90%+.
I found the cause is that Java NIO will start (total channels/1024) thread to 
handler the 100 thousand channels. Now, I want a way to solve this problem 
which the cpu rate is to high.


The way I got is to extend the class[sun.nio.ch.SelectorImpl], but it's 
modifier is default. Than I try to modify the variable[MAX_SELECTABLE_FDS] in 
the class[sun.nio.ch.WindowsSelectorImpl], but it's modifier is 'private final 
static int'. Than I use reflection to modified it, but it does not work.


Please provide me a way to decrease the thread numbers, or other way to reduce 
the cpu rate. 


Thank you very much.




note: The compute deployed the code has 16 cpus.

Reply via email to