Skip to content

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

@2k9laojia

Description

@2k9laojia

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

Metadata

Metadata

Assignees

Labels

TransByAITranslated by AI/GPT.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions