Sunday, March 1, 2020

How to debug Daphne CPU 100% issue

Hi, 

Could you please give some suggestions to inspect the high CPU (most time above 90% and some time above 100%) consumed by Daphne. 

Environment:
  • OS: Ubuntu 18.04.1 LTS x86_64 GNU/Linux
  • Django: 2.1.1
  • Daphne: 2.3.0
  • Channels: 2.2.0
  • channels-redis: 2.4.0
Just use the Daphne as the websocket server with redis as the Channel layer. 

Now I do the following steps:
  1. top command show the daphne process consume high cpu
  2. check the thread numbers with ps -o thcount 22549, which shows 40. 
  3. check the websocket connected numbers with redis cli: ZCOUNT asgi::group:USER_MESSAGE -inf +inf, which shows 190
  4. check the system call with sudo strace -c -p 22549 for a minute, the result as the following:

daphne_cpu.png
Best Wishes.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/913143a8-c8c8-47ce-a96d-6c9d349eac6a%40googlegroups.com.

No comments:

Post a Comment