[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-jdk7u-dev
Subject:    A question in Java NIO programming
From:       "=?gb18030?B?wfXR3Mfs?=" <herry_liu () foxmail ! com>
Date:       2019-01-02 7:00:40
Message-ID: tencent_1705519BD029693ECAE6D01572ECD2235F06 () qq ! com
[Download RAW message or body]

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.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic