连接到16万左右报错

xc6163355

SendBufferToWorker fail. May be the send buffer are overflow. See http://wiki.workerman.net/Error2 for detail
提示这个 按照流程 去strace -p 查找其中一个端口 发现

ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "SendBufferToWorker fail. May be "..., 110) = 110
open("/data/website/onlinekf/online/websocket-php/linux/workerman-chat/vendor/workerman/workerman.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 111
fstat(111, {st_mode=S_IFREG|0622, st_size=170306694472, ...}) = 0
lseek(111, 0, SEEK_CUR)                 = 0
lseek(111, 0, SEEK_CUR)                 = 0
flock(111, LOCK_EX)                     = 0
write(111, "2017-09-15 15:36:46 pid:21107 Se"..., 140) = 140
close(111)                              = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "SendBufferToWorker fail. May be "..., 110) = 110
open("/data/website/onlinekf/online/websocket-php/linux/workerman-chat/vendor/workerman/workerman.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 111
fstat(111, {st_mode=S_IFREG|0622, st_size=170306695452, ...}) = 0
lseek(111, 0, SEEK_CUR)                 = 0
lseek(111, 0, SEEK_CUR)                 = 0
flock(111, LOCK_EX)                     = 0
write(111, "2017-09-15 15:36:46 pid:21107 Se"..., 140) = 140
close(111)                              = 0
recvfrom(12438, "\201\217\247OL\243\334m8\332\327*n\231\205?#\315\300m1\201\217g\304\256A\34\346\3328\27"..., 65535, 0, NULL, NULL) = 420
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "SendBufferToWorker fail. May be "..., 110) = 110
open("/data/website/onlinekf/online/websocket-php/linux/workerman-chat/vendor/workerman/workerman.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 111
fstat(111, {st_mode=S_IFREG|0622, st_size=170306696572, ...}) = 0
lseek(111, 0, SEEK_CUR)                 = 0
lseek(111, 0, SEEK_CUR)                 = 0
flock(111, LOCK_EX)                     = 0
write(111, "2017-09-15 15:36:46 pid:21107 Se"..., 140) = 140
close(111)                              = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "SendBufferToWorker fail. May be "..., 110) = 110
open("/data/website/onlinekf/online/websocket-php/linux/workerman-chat/vendor/workerman/workerman.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 111
fstat(111, {st_mode=S_IFREG|0622, st_size=170306697972, ...}) = 0
lseek(111, 0, SEEK_CUR)                 = 0
lseek(111, 0, SEEK_CUR)                 = 0

一直输出这个 大神 求解答

3401 1 0
1个回答

walkor 打赏

报错的意思是gateway收到消息转发给businessWorker处理,但是向businessWorker发送数据的发送缓冲区已经满了,无法发送。

如果客户端发送请求的速度大于businessWorker的处理速度,并且这种情况持续一段时间后就会报这个错。比如客户端每秒发送10000个请求给服务端,gateway收到请求后给businessWorker处理,businessWorker每秒只能处理9000个请求,那么请求就会积压在缓冲区,最终缓冲区满了就报这个错了。

出现这个问题这个一般是businessWorker处理不过来了导致的,看看Events.php里是否有处理很慢的业务,businessWorker进程数是否足够(进程数一般是cpu的3倍)。如果业务都ok,那么说明此服务器配置+你的业务代码无法支持这么大的请求量,可以通过分布式多服务器部署水平扩展服务器来解决。

  • xc6163355 2017-09-15

    请问这个缓冲区可以扩大吗 客户端每10秒会给我发送心跳 我会记录一些东西 可能是这个地方堵死了吗?

  • xc6163355 2017-09-15

    进程数是CPU的3倍?我看gateway进程数建议与cpu核数相同 bussinessWorker进程数量 和这个不一样吗?

  • walkor 2017-09-15

    bussinessWorker 不一样,要比cpu多一些

  • walkor 2017-09-15

    start_gateway.php中 $gateway->sendToWorkerBufferSize来设置这个缓冲区大小,默认10M

年代过于久远,无法发表回答
×
🔝