Nginx 服务器性能Bug和优化方案(真实经历)

Posted Tinywan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Nginx 服务器性能Bug和优化方案(真实经历)相关的知识,希望对你有一定的参考价值。

一、遇到的问题

1、问题:本应该是3个ffmpeg ,但是怎么会有5个ffmpeg出现?

2、Lua脚本问题,一直写入日志,导致有大量的日志,这里的错误日志是直接写进nginx的error.log 日志文件的

(1)日志文件

total 1.8G
-rw-r--r-- 1 root root  11M May  9 21:47 access.log
-rw-r--r-- 1 root root 3.1K May  9 21:46 error.log
-rw-r--r-- 1 root root 705M May  9 21:44 live_access.log
-rw-r--r-- 1 root root 1.1G May  9 21:44 nginx_error.log

2017/05/09 21:43:05 时间段详细记录:

2017/05/09 21:43:05 [notice] 154005#0: *2276339 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2276301 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255428 "\\.m3u8" matches "/live/C
2017/05/09 21:43:05 [notice] 154005#0: *2255382 "\\.m3u8" matches "/live/C
2017/05/09 21:43:05 [notice] 154005#0: *2276989 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2276946 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255373 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2277509 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255426 "\\.m3u8" matches "/live/C
2017/05/09 21:43:05 [notice] 154005#0: *2276852 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2276850 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2276811 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2276416 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2276558 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2276495 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255454 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2280641 "\\.m3u8" matches "/live/C
2017/05/09 21:43:05 [notice] 154005#0: *2255417 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255401 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2257856 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255428 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255372 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255426 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255396 "\\.m3u8" matches "/live/C
2017/05/09 21:43:05 [notice] 154005#0: *2276402 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2254567 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255436 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255387 "\\.m3u8" matches "/live/C
2017/05/09 21:43:05 [notice] 154005#0: *2276423 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255460 "\\.m3u8" matches "/live/C
2017/05/09 21:43:05 [notice] 154005#0: *2255443 "\\.m3u8" matches "/live/C
2017/05/09 21:43:05 [notice] 154005#0: *2277380 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2276203 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2276375 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255467 "\\.m3u8" matches "/live/C
2017/05/09 21:43:05 [notice] 154005#0: *2255404 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255485 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2276709 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255473 "\\.m3u8" matches "/live/C
2017/05/09 21:43:05 [notice] 154005#0: *2255419 "\\.m3u8" matches "/live/C
2017/05/09 21:43:05 [notice] 154005#0: *2255443 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255456 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255480 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255460 "\\.m3u8" does not match "
2017/05/09 21:43:05 [notice] 154005#0: *2255467 "\\.m3u8" does not match "

2017/05/09 21:36:43 时间段详细记录,太恐怖了,1s写入日志多大240条,难怪nginx的负载飙到54%

2017/05/09 21:36:42 [notice] 143984#0: *2210297 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2106253 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2186550 "\\.m3u8"
2017/05/09 21:36:43 [error] 143984#0: *2186550 [lua] hls
2017/05/09 21:36:43 [notice] 143984#0: *2204373 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2178827 "\\.m3u8"
2017/05/09 21:36:43 [error] 143984#0: *2178827 [lua] hls
2017/05/09 21:36:43 [notice] 143984#0: *2174075 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2192938 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2184738 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2178702 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2178827 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2164479 "\\.m3u8"
2017/05/09 21:36:43 [error] 143984#0: *2164479 [lua] hls
2017/05/09 21:36:43 [notice] 143984#0: *2207950 "\\.m3u8"
2017/05/09 21:36:43 [error] 143984#0: *2207950 [lua] hls
2017/05/09 21:36:43 [notice] 143984#0: *2206807 "\\.m3u8"
2017/05/09 21:36:43 [error] 143984#0: *2206807 [lua] hls
2017/05/09 21:36:43 [notice] 143984#0: *2147325 "\\.m3u8"
2017/05/09 21:36:43 [error] 143984#0: *2147325 [lua] hls
2017/05/09 21:36:43 [notice] 143984#0: *2146090 "\\.m3u8"
2017/05/09 21:36:43 [error] 143984#0: *2146090 [lua] hls
2017/05/09 21:36:43 [notice] 143984#0: *2202243 "\\.m3u8"
2017/05/09 21:36:43 [error] 143984#0: *2202243 [lua] hls
2017/05/09 21:36:43 [notice] 143984#0: *2159677 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2181228 "\\.m3u8"
2017/05/09 21:36:43 [error] 143984#0: *2181228 [lua] hls
2017/05/09 21:36:43 [notice] 143984#0: *2199544 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2129089 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2147325 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2164479 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2144525 "\\.m3u8"
2017/05/09 21:36:43 [error] 143984#0: *2144525 [lua] hls
2017/05/09 21:36:43 [notice] 143984#0: *2202243 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2128282 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2146090 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2209153 "\\.m3u8"
2017/05/09 21:36:43 [error] 143984#0: *2209153 [lua] hls
2017/05/09 21:36:43 [notice] 143984#0: *2151087 "\\.m3u8"
2017/05/09 21:36:43 [error] 143984#0: *2151087 [lua] hls
2017/05/09 21:36:43 [notice] 143984#0: *2087849 "\\.m3u8"
2017/05/09 21:36:43 [error] 143984#0: *2087849 [lua] hls
2017/05/09 21:36:43 [notice] 143984#0: *2180084 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2194164 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2149424 "\\.m3u8"
2017/05/09 21:36:43 [error] 143984#0: *2149424 [lua] hls
2017/05/09 21:36:43 [notice] 143984#0: *2132295 "\\.m3u8"
2017/05/09 21:36:43 [notice] 143984#0: *2086470 "\\.m3u8"
2017/05/09 21:36:Web性能优化——代理(nginx)

高流量站点NGINX与PHP-fpm配置优化

高流量站点NGINX与PHP-fpm配置优化

x86服务器虚拟化的资源划分和性能优化

(功能篇)回顾Bug管理系统Mantis优化改造经历

Nginx优化之服务性能优化