Jump to content
  • 0

High CPU usage on server


Divyanshu Kalra
 Share

Question

We have a conference app setup, and if 2 people connect, and i share my screen, and then unshare and share again a couple of times, CPU usage of server jumps to 50%+. (CPU config: 4cores, 16gb RAM, AWS). I am using ant-media-server-enterprise-2.1.1-20200902_1011. I am attaching the output of /rest/thread-dump-json if that helps. Also once we end the call, the CPU usage goes back to single digits.

 

dumpThread.json

Link to comment
Share on other sites

  • Answers 20
  • Created
  • Last Reply

Top Posters For This Question

20 answers to this question

Recommended Posts

  • 0

Hi,

Just a reminder,  media streaming and especially the WebRTC streaming is a process intensive operation. It's always good to use Computed Optimized Instance types.
For AWS, you can use C family. 

Secondly, t2 family provides variable CPU and each instance has some CPU credits. Its CPU credit is 54 per hour. 
A CPU Credit provides the performance of a full CPU core for one minute. So baseline performance of t2.xlarge is 54/60 of a CPU core. 
I mean its baseline is almost 1 core CPU. If you don't use the credits, it's accumulated and you can have some spike up to 4 core CPU. 
If you consume all the credits, you can get less CPU than the baseline.  For more information, please take a look the https://aws.amazon.com/ec2/instance-types/#Burstable_Performance_Instances

Please try with C5 or C6 type instance having 4 cores CPU and let us know the results.

Regards,
A. Oguz  

Link to comment
Share on other sites

  • 0
Thank you. 

I'll try to reproduce on my end. Let me confirm the reproduce scenario. There are some missing parts for me. 

1. Run Ant Media Server in a 4 Core CPU optimized instance in Digital Ocean
2. Deploy the files at antBug.zip to Ant Media Server
3. Turn screen sharing on and off a couple of times

Expected Behavior
CPU usage should be about (let's say) %15

Actual Behaviour
CPU usage goes to %60

I'm not sure about why and how to use ngrok in this scenario above.

Secondly, we encounter that TCP candidates sometimes cause high CPU usage.  Closing TCP cpu candidates resolves unexpected CPU usage. This issue will be investigated. As a workaround, you may try disabling TCP candidates by putting following properties in /usr/local/antmedia/webapps/{YOUR_APP}/WEB-INF/red5-web.properties file and restart the service

settings.webrtc.tcpCandidateEnabled=false

Regards,
A. Oguz

Link to comment
Share on other sites

  • 0

Before trying to it on my end. Just let me ask something. 

You're trying it on localhost are and you also capturing or playing the video on the same host? If yes, capturing video means rendering and encoding the video, playing the video means decoding and rendering the video. These are also process intensive operations for the processing unit. 

Regards,
A. Oguz

 

Link to comment
Share on other sites

  • 0
Yes, showing a local stream takes the server's CPU. 

Anyway,  I have not had time to test your case yet. Let's make things clear . So the following re-produce scenario is true for you? Because it's not clear for me to test on Digital Ocean or local computer or AWS. Let's agree the re-produce scenario 

1. Run Ant Media Server in a 4 Core CPU optimized instance in Digital Ocean
2. Deploy the files at antBug.zip to Ant Media Server
3. Turn screen sharing on and off a couple of times
4. Wait for 10-12 minutes

Expected Behavior
CPU usage should be about (let's say) %15

Actual Behaviour
CPU usage goes to %60


Link to comment
Share on other sites

  • 0

Hi kalradivyanshu,

Have a good day. I have tried your use case. But I couldn't achieve.

I need to clear about below things:
1- Are you sure about settings.webrtc.tcpCandidateEnabled=false with right application?
2- Did you restart AMS, when you added this parameter in settings?

Looing forward to hearing from you soon.

Best Regards,
Selim

 

Link to comment
Share on other sites

  • 0
Hey Selim,

Have you tried the exact same scenario with html and js files that Divyanshu provided? Maybe there is a problem in js files that trigger this problem. 

Could you also let us know the results of your tests and steps you've followed?

Regards,
A. Oguz

Link to comment
Share on other sites

  • 0

Hi Ahmet,

Yes, I tried with provided HTML and js files. 

Here are the steps:

1- I created 4 core Instance on Digital Ocean and Installed AMS 2.1.1 version(added settings.webrtc.tcpCandidateEnabled=false version).Also, I enabled SSL.
2- I installed and configured ngrok for publishing localhost HTML and js files.
3- I published the stream with ubuntu 18.04 and Windows 10 machines with 15 min.
4- I see everything seems normal. Also, I attached htop and other detail images.

 

 

 

 

error.log

1451104221_Screenshotfrom2020-10-1216-13-06.thumb.png.f9047570d0001e4e43d9b37774267c1f.png

958522133_Screenshotfrom2020-10-1216-13-13.thumb.png.1afa5b4e180c2d67bb1aeff679c1b670.png

console.log

2003525128_Screenshotfrom2020-10-1216-12-55.thumb.png.9147931192a1cac66f4e532dd9539a69.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...