Code Monkey home page Code Monkey logo

Comments (14)

winshining avatar winshining commented on May 21, 2024

怎么复现?
你这图哪儿显示了内存占用14G?

from nginx-http-flv-module.

luckywur avatar luckywur commented on May 21, 2024

image

就只是用srs-bench并发推送很多路流。

from nginx-http-flv-module.

winshining avatar winshining commented on May 21, 2024

只推流没播放?
推流和nginx都运行在本机还是分离的?

from nginx-http-flv-module.

luckywur avatar luckywur commented on May 21, 2024

只是推流
推流和nginx是分离的。

from nginx-http-flv-module.

winshining avatar winshining commented on May 21, 2024

我按照你说的试了,暂时复现不出来,推100路流,内存一直稳定在224M左右
另外,你用的是release里1.2.4的包还是源代码编译的?

from nginx-http-flv-module.

luckywur avatar luckywur commented on May 21, 2024

用的是release里1.2.4包编译的。等一下我用最新代码编译试一下

from nginx-http-flv-module.

winshining avatar winshining commented on May 21, 2024

@luckywur 最新代码测试有问题么?

from nginx-http-flv-module.

luckywur avatar luckywur commented on May 21, 2024

要好很多,但是内存还是占用很高
image

`#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
    location /live {
        flv_live on;
        chunked_transfer_encoding  on; #open 'Transfer-Encoding: chunked' response

        add_header 'Access-Control-Allow-Origin' '*'; #add additional HTTP header
        add_header 'Access-Control-Allow-Credentials' 'true'; #add additional HTTP header
    }

    location /stat {

        rtmp_stat all;
        rtmp_stat_stylesheet stat.xsl;
    }

    location /stat.xsl {
        root /var/www/rtmp; 
    }

    location /control {
        rtmp_control all;
    }
}

}

rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;
rtmp_socket_dir /tmp;

rtmp {
out_queue 4096;
out_cork 8;
max_streams 400;

server {
    listen 1935;

    application hls {
        live on;
        hls on;
        hls_path /tmp/hls;
        gop_cache on; #open GOP cache for reducing the wating time for the first picture of video
        on_publish        http://127.0.0.1:8080/nvrEvent/live/publish;
        on_publish_done   http://127.0.0.1:8080/nvrEvent/live/publishDone;
        on_play           http://127.0.0.1:8080/nvrEvent/live/play; 
        on_play_done      http://127.0.0.1:8080/nvrEvent/live/playDone;
    }
}

} `

这个是我的配置。目前测试方法是在on_play中调用其他应用进行推流,然后在on_play_done判断是否有其他用户,没有则停止推流,所以在测试的时候不停的推流、断开、再推流。

from nginx-http-flv-module.

luckywur avatar luckywur commented on May 21, 2024

发现疑似和hls有关系,我将配置的hls设置为off,内存占用才400M

from nginx-http-flv-module.

winshining avatar winshining commented on May 21, 2024

你用nginx-rtmp-module对比测试一下吧,hls部分的功能我没动过,如果有同样的问题,就不是nginx-http-flv-module的bug了

from nginx-http-flv-module.

luckywur avatar luckywur commented on May 21, 2024

发现在未开hls情况下,推流时间长了后,不停的停止推流再推流,内存会不断上涨。没有推流数据后内存仍然没有回收
image

from nginx-http-flv-module.

winshining avatar winshining commented on May 21, 2024

方便提供on_publish,on_publish_done,on_play和on_play_done的url内容么?

from nginx-http-flv-module.

luckywur avatar luckywur commented on May 21, 2024

代码有点多,
主要实现是on_play会判断该路流是否已经推送,推送了就直接返回ok,未推送则调用推送流程,返回ok
on_play_done是判断是否还有其他client在,如果没有则调用停止推送流程
on_publish则是简单的判断推送流的来源合法性
on_publish_done则是调用停止推送流程

目前测试的是通过解码器压力测试,同时播放90路左右的流,并发高的情况下,可能会存在不停的调用on_play、on_play_done

from nginx-http-flv-module.

winshining avatar winshining commented on May 21, 2024

那你自己调试吧

from nginx-http-flv-module.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.