Closed wsky closed 11 years ago
endpoint should support schedule certain type of task by msg.messageType
// dispatch
this.scheduler.schedule(msgFrom, new Runnable() {
@Override
public void run() {
try {
internalOnMessage(context, msg, msgFrom);
} catch (LinkException e) {
logger.error(e);
}
}
});
scheduler's job looks like actor does. :)
TODO: test perf on batched lightweight task
in EndpointPerf test, using BatchedScheduler, server will have low cpu cost, but if batchSize is so large, 1000, client got execution timeout
in some case, it's about balance problem, that server have fixed biz threadpool, 400 e.g.
lightweight request maybe fill them at moment, then other request maybe hold or reject, batch maybe make it more balanced,
or, maybe we need add different thread pool for differentr request, make it easy.
if we provided async io operation to task, like nix_lua coroutine does,
some kind of task is lightweight and has many,
process one task per thread will course large cost at thread switch, threadpool size will alwasy not enough.
so, we need batch them, process more than one task per thread