twilio / twilio-chat-demo-android

Chat API Demo Application for Android
MIT License
63 stars 51 forks source link

Channel synchronisation is taking more than 20 seconds with 143 live channels #155

Closed niliyam closed 3 years ago

niliyam commented 3 years ago

Description

Hi,

We have 143 channels live in our production app using Twilio Programmable Chat.

Earlier channel synchronization time was around 2 seconds when we had <10 channels, but now with 143 channels, this synchronization time has increased to 22-24 seconds.

We have integrated the latest SDK version. What is the issue here? This increased synchronization time is causing major business problems.

Expected Behavior

Channel synchronization should take than 2-3 seconds even if number of channels increase multi-folds.

Actual Behavior

Channel synchronization is taking 23-24 seconds.

Reproduces how Often

100%

Logs

2020-12-28 23:47:28.733 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > app created 2020-12-28 23:47:31.461 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > createClient() 2020-12-28 23:47:32.152 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > setChannelListener() > true 2020-12-28 23:47:36.117 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > onSuccess() 2020-12-28 23:47:36.117 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > tokenCreated() 2020-12-28 23:47:36.123 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > tokenCreated() 2 2020-12-28 23:47:36.126 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > getChannels() 2020-12-28 23:47:36.331 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > setChannelDatatoDb 2020-12-28 23:47:36.333 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > getOfflineMessages() 2020-12-28 23:47:36.334 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > setChannelListener() > false 2020-12-28 23:47:36.336 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > synchronized channels 2020-12-28 23:47:36.340 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > CSYNC - IDENTIFIER 2020-12-28 23:47:59.097 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > CSYNC - ALL 2020-12-28 23:47:59.097 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > checkLocalMessageCount() 2020-12-28 23:47:59.099 30293-30293/com.pristyncare.hospitalchat.debug D/Hospital: AISS > TWILIO > getOfflineMessages()

Or attach it as a file.

Chat Android SDK

6.2.0

Android API

30

rusmonster commented 3 years ago

Hi! Thanks a lot for bringing this issue to our attention. In general, Programmable Chat Client synchronization time depends on the number of factors during the initial SDK startup, in particular:

When user has only several userChannels and good network expected synchronization time is few seconds. If the user is a member of numerous channels, the synchronization time increases. It’s a little bit unclear how many same users are in these 147 channels, but the startup time shouldn’t be that long as according to our tests 1000 channels x 1 member each with a good network takes about ~10 sec to synchronize.

At the moment, we are working on several solutions to improve the startup time, but significant improvements are not expected before the second half of 2021.

berkus commented 3 years ago

We will revisit this after we implement the optimizations as proposed in second half of 2021. Closing for now.