winshining / nginx-http-flv-module

A media streaming server based on nginx-rtmp-module. In addtion to the features nginx-rtmp-module provides, HTTP-FLV, GOP cache, VHosts (one IP for multi domain names) and JSON style statistics are supported now.
BSD 2-Clause "Simplified" License
2.73k stars 569 forks source link

[bug] Abnormal CPU, Memory usage within Ubuntu 24.04(noble-20240605), Nginx 1.24.0 #267

Open HeeJoon-Kim opened 1 month ago

HeeJoon-Kim commented 1 month ago

When upgrade a os and nginx version, server's performance was badly low. A cpu and memory usage increased, especially memory usage dramatically increased. And load average, %iowait had a bad status.

I don't know why, but when killed a nginx, server was back to normal.

Expected behavior

Normal cpu, memory usage - Ubuntu 23.04(lunar-20230615, Nginx 1.22.0)

08B50B7D-5BF2-48DD-B1C5-274147F5F036

Actual behavior

High cpu and memory usage with high %iowait. And very high load average.

CC0EBF45-43EF-4518-8CEC-5B37FACE55EF

OS and Nginx version

Normal: OS Ubuntu 23.04 lunar-20230615(Docker), Nginx 1.22.0(installed by apt)
Abnormal: OS Ubuntu 24.04 noble-20240605(Docker), Nginx 1.24.0(installed by apt)

Configuration file

user www-data;

# Set number of worker processes automatically based on number of CPU cores.
worker_processes auto;

# Enables the use of JIT for regular expressions to speed-up their processing.
pcre_jit on;

# Configures default error logger.
error_log /var/log/nginx/1/error.log warn;

# Includes files with directives to load dynamic modules.
include /etc/nginx/modules-enabled/*.conf;

# Uncomment to include files with config snippets into the root context.
# NOTE: This will be enabled by default in Alpine 3.15.
#include /etc/nginx/conf.d/*.conf;

events {
    # The maximum number of simultaneous connections that can be opened by
    # a worker process.
    worker_connections 204800;
    use epoll;
    multi_accept on;
}

# Multi-worker live streaming
rtmp_auto_push on;

rtmp {
    server {
        listen 19350;
        chunk_size 60000;
        access_log /var/log/nginx/1/access.log;

        application broadcast {
            live on;

            hls on;
            hls_path /broadcast/1;
            hls_fragment 10s;
            hls_playlist_length 30s;
            hls_continuous on;
            hls_nested on;
            hls_base_url /broadcast/;
            drop_idle_publisher 30s;

            exec_publish /bin/bash /makeln.sh $name;
        }
    }
}

Steps to reproduce the behavior

  1. run docker container and install files
    • docker run --name edge -p1935:1935 -p8080:8080 ubuntu:noble-20240605
    • (in container) # apt update && DEBIAN_FRONTEND=noninteractive apt install -y nginx logrotate cron tzdata wget curl ffmpeg libavcodec-extra60 libavformat-extra60 libnginx-mod-rtmp
  2. nginx-http-flv-module compile and install
  3. connect many(about 300) to nginx rtmp port and monitoring

Error log if any

No error logs.