harlanc / xiu

A simple,high performance and secure live media server in pure Rust (RTMP[cluster]/RTSP/WebRTC[whip/whep]/HTTP-FLV/HLS).🦀
https://rustxiu.com
MIT License
1.77k stars 187 forks source link

Extreme CPU usage #16

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hello, I'm not sure if anybody else is experiencing this, but after the update that fixes HLS, the CPU usage skyrockets after I stop streaming from OBS. Screenshot_20211222_144247

The console output says: [2021-12-22T19:51:00Z ERROR rtmp::channels::channels] event_loop Unpublish err: no stream name

The same error shows up in 0.0.5 but the CPU usage problem occurs only in 0.0.8

Another thing that I found is that it's definitely HLS issue, as the problem doesn't occur with hls enabled set to false

My config.toml file looks like this

[rtmp]
enabled = true
port = 1935

[hls]
enabled = true
port = 8080

[httpflv]
enabled = true
port = 8081

[log]
level = "info"
harlanc commented 2 years ago

Hi @Aslan2142

fixed in xiu v0.0.9 and try again.

thanks.

Harlan

harlanc commented 2 years ago

I'm a little confused why 5 xiu processes are displayed on the console?

ghost commented 2 years ago

The issue seems to be fixed.

Xiu always launches 5 processes for me. I have no idea why, I was thinking it's just multithreaded and running core count + 1 threads.

harlanc commented 2 years ago

it's strange, could you check the listening ports,if you start the 5 xiu processes,then you must use 5 different ports for each funtionality like rtmp,else it shouldn't be run successfully. I think the correct using way is only one process in which multiple threads can be run…

ghost commented 2 years ago

There is just one port for RTMP.

I think it's just how htop shows threads. There is a lot of processes listed like 10-20 times. https://unix.stackexchange.com/questions/10362/why-does-htop-show-more-process-than-ps