Conversation
|
there is somthing wrong with the code ,let me correct it first |
ok2c
left a comment
There was a problem hiding this comment.
Most importantly, what are the benefits of starting I/O reactor threads lazily. I see absolutely none.
| }))) { | ||
| if (status.compareAndSet(Status.READY, Status.RUNNING)) { | ||
| ioReactorRef.get().start(); | ||
| if(this instanceof AsyncServer){ |
There was a problem hiding this comment.
@xiaohu-zhang This is terrible. Even for test classes we should not be doing things like that.
| public void start() { | ||
| ioReactor.start(); | ||
| public void start(final int i) { | ||
| throw new RuntimeException("can not call start(i) method with AsyncServer class,maybe call serverStart method?"); |
|
when use few connections,for example ,use always one connection in connection pool each time(), or no http connection used when project started.framework can use less thread ,that will reduce the thread number and load in computer. |
IOReactor thread can be lazy started
2d89050 to
3327319
Compare
|
@xiaohu-zhang If you anticipate few connections and want fewer threads you really should configure fewer workers. Overall, I think this change-set causes more problems than it solves. |
|
what if can not anticipate ?lazy init is little useful in performance。Also the code can be modified do not use instanceof .after all , it depends on you. |
|
@xiaohu-zhang Why? The I/O reactor distributes sessions across all available workers equally. If you have n worker threads, all of them will get started after n connections. |
|
yes.it has a little useful only when connections less than worker thread,and is not anticipate by user before. |
|
@xiaohu-zhang Please close this PR. |
IOReactor thread can be lazy started