stream-chat-android
stream-chat-android copied to clipboard
CPU usage increases when events are received
Describe the bug I'm using client and offline only. (not stream-compose) I got some performance issue(ex. LazyColumn is laggy) when many users use our service. (in late night, I don't have any problem 😅)
First, I tried to optimize our application, however, It still has a problem. So, I tried to test compose sample application and found something to investigate.
👉CPU usage increases when events are received. (90% ~ 100%)
(UserWatchingStarted/StoppedEvent, TypingStarted/StoppedEvent and MessageReadEvent)
Sync and recovery is also one of the reason for high cpu usage. (It replays a lot of events which occurred when user is in background)
Watch screen record in Screenshots for details.
SDK version
- develop branch (dda4ba96a929c05eb5078b80a264be19955048a0)
- 4.30.0
To Reproduce Steps to reproduce the behavior:
- Prepare
stream-chat-android-compose-sampleto test - Prepare credential which is used in real service (20+ channels, 500+ active users. I can provide it if you need)
- Just stay in sample application
- Check cpu usage when events are arrived. (do nothing with test. Just keep screen on)
Expected behavior lower CPU usage
Device:
- Vendor and model: Samsung Galaxy S21 Ultra
- Android version: 12
Screenshots Screen Record (with develop branch app) (Android Studio - CPU profiler) (Application) (Logcat) https://youtu.be/QcJ5CH7hvUE
At first, I sent a message to @skydoves to describe this issue. After talking about this issue, he recommended to tag @adasiewiczr @filbabic to investigate this issue.
hey @workspace, thanks for reporting this. We'll investigate this and we'll come up with a solution as soon as possible.
Closing this as we've had a series of improvements around event handling.
We can look into it if it's still an issue with these changes.