-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
worker线程全部卡住时主动拒绝请求 #452
Comments
发表下个人的一些小见解。 |
|
了解了。其实我的疑问主要在第三点,上面说的“放宽些”也是指排队。 |
是。这是因为并发的物理含义就是能缓存下任务的槽位,worker之外还有很多不可控的“槽位”,如socket中的缓冲,框架里常见的分发队列,甚至广义地说,任何和任务分发相关的容器都负担了若干并发。所以如果只是按worker数来计算并发就少算了,一般会加上额外的部分。 |
最近看代码一直有这个疑问,之前一直觉得可能EventDispatcher是在单独的pthread里,看后面才发现是在某个worker的bthread 环境里,而bthread又不会主动yield和基于时间片调度,这样在worker忙的时候新请求会得不到调度。为什么“让EventDispatcher运行在独立的pthread中,就像TimerThread那样,可能会略微降低新请求的调度。” |
@Redfriday 即使把EventDispatcher放独立的pthread,worker全满时新bthread不还是调度不了么? |
@jamesge 关于”bthread层面汇报work是否用满”,具体统计哪些信息?比如 bthread在run_queue中的排队时间? |
最简单的“卡住”方式就是usleep或sleep(但不是bthread_usleep,并不会卡住worker)。当所有的worker都陷入sleep时,EventDispatcher也不会工作,直到某个worker醒来,相应的请求会被延迟,但server端无法感知到这点,因为请求处理的“起点”就是EventDispatcher中的epoll,它同样被延迟了。可能的改进有:
The text was updated successfully, but these errors were encountered: