Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After stopping the stress test, the CPU and memory have remained consistently high. #1507

Closed
2k9laojia opened this issue Dec 9, 2019 · 4 comments
Assignees
Labels
TransByAI Translated by AI/GPT.
Milestone

Comments

@2k9laojia
Copy link

2k9laojia commented Dec 9, 2019

Description
Describe the problem you encountered.

Environment

  1. Operating System: CentOS 7.5
  2. Encoder (Tool and Version): ...
  3. Player (Tool and Version): ...
  4. SRS Version: SRS/2.0.248
  5. SRS Log is as follows:
......

Reproduction
The steps to reproduce the bug are as follows:

  1. Start SRS and run ...
  2. Push 500 streams and use http-flv to play each stream on the frontend player, with a bitrate of 1Mb/s for each stream.
  3. Keep playing the 500 streams on the frontend for 1 hour, then close the push and play ends. Wait for 1 minute and repeat step 2.
  4. After the stress test is finished, close all push and play connections. The memory usage of SRS is 3.4G and CPU usage is 60.3%. The memory and CPU usage remain high and do not decrease.
...

Expected Behavior
After the stress test is finished, the CPU and memory usage should decrease.

Preliminary determination is that the issue is caused by the failure to clean up the srsSource objects. Each time a stream is pushed, there is a unique sourceID, so a large number of source objects are stored in the static global pool of srs, leading to increased memory usage. Moreover, in the coroutine, it is necessary to continuously loop through this pool and process each source object. Having too many source objects may result in high CPU usage for this coroutine.

I hope the experts can provide a solution.

TRANS_BY_GPT3

@2k9laojia
Copy link
Author

2k9laojia commented Dec 10, 2019

In each source member variable, multiple coroutines are started, which ultimately leads to the generation of a large number of coroutines in SRS. The switching of coroutines consumes a significant amount of CPU time, which may be the reason why the CPU remains high even after stopping the stress test.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Jan 19, 2020

The coroutine issue has been resolved, and the coroutine will stop after stopping the stream.
We are still considering the best solution for the memory problem.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Jan 19, 2020

Will be fixed in #1579 to support hot upgrade or smooth upgrade. Upgrade smoothly.

TRANS_BY_GPT3

@winlinvip winlinvip self-assigned this Sep 6, 2021
@winlinvip winlinvip added this to the 3.0 milestone Sep 6, 2021
@winlinvip winlinvip changed the title srs停止压测后,CPU和内存一直居高不下 After stopping the stress test, the CPU and memory have remained consistently high. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
@winlinvip
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

2 participants