由于需要批量处理一批数据,写好脚本,就开始跑任务了,结果前端同学找到说发布接口报错
经过定位是接口在插入数据时,没有返回ID,导致提示失败
继续追踪,发现 服务器上连接MySQL开始有报错信息
查询nginx -error日志发现
2023/04/03 18:08:04 [error] 977867#0: *8106362 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: , server: , request: "POST /delPush HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-74.sock:", host: "", referrer: "http://localhost:/"
2023/04/03 18:18:04 [error] 977867#0: *8113135 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: , server: , request: "POST /callbackVideo HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-74.sock:", host: ""
结果一看MySQ的CPU飙升到100%,紧急停止批量任务,杀掉相关进程,临时提高MySQL配置,增大磁盘扩容,降级不必要的业务请求,开启重要接口限流,渐渐业务恢复了正常