Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boresha Afya Fixes: Saving a Family takes more than 5mins #2077

Closed
samkanga opened this issue Jul 1, 2022 · 5 comments · Fixed by opensrp/opensrp-client-chw-hf#137
Closed
Labels
BA bug Something isn't working Size: Medium (2-3)

Comments

@samkanga
Copy link

samkanga commented Jul 1, 2022

APK - Kituoni (Health Facility)
Android version 7

Steps to reproduce:
a) Click add family
b) Fill in the fields
c) Click Submit

See attached video

20220701_102536.mp4

.

@samkanga samkanga added bug Something isn't working BA labels Jul 1, 2022
@samkanga samkanga changed the title Boresha Afya Fixes: Saving a Family creation more than 5mins Boresha Afya Fixes: Saving a Family takes more than 5mins Jul 1, 2022
@owais-vd
Copy link

owais-vd commented Jul 7, 2022

processClient method is synchronized in CoreClientProcessor class.

https://github.com/opensrp/opensrp-client-chw-core/blob/0ad08cde606d7759bb29f6b04852859f6ef28a58/opensrp-chw-core/src/main/java/org/smartregister/chw/core/sync/CoreClientProcessor.java#L125

and initially when we launch the app the processClient method is blocked by thread IntentService[SyncClientEventsPerTaskIntentService].

cc: @samkanga

@owais-vd
Copy link

a suggestion here, can we remove synchronized keyword from the processClient method so other threads cannot block it.
cc: @ekigamba

@hilpitome
Copy link

hilpitome commented Jul 13, 2022

@owais-vd we can do that but there could be repercussions. The main question would be, why was the synchronized modifier added in the first place. I have traced it to this commit by @raihan-mpower. It would be a good place to start. cc @samkanga

@ekigamba
Copy link
Contributor

ekigamba commented Jul 14, 2022

I agree with @hilpitome.

I'd prefer we leave it as-is, unless there's a better alternative and good reason to remove it given that it relates to synchronizing multiple-threads.

@owais-vd Are there other performance improvements that you can suggest or identified causes for slowness?

Follow this documentation that will help you investigate further and implement previous fixes:

Here is a checklist

  • Updates to the latest core libraries to fix issues
  • Make sure the event-client tables and other details tables have the base-entity-id index. Some migrations that required recreating these tables did not recreate the indexes.
  • Investigate illegal operations on the app by running the app with StrictMode enabled
  • Check for memory leaks using Leak Canary
  • Check for long-running queries, disable or optimize them
  • Check for long-running operations on the main thread
  • Disable report generation running and make it ad-hoc

Other performance-related discussions for reference and perusal:

cc @samkanga

@faith-mutua
Copy link

@samkanga @owais-vd the issue has been resolved. Saving a family now takes less than a minute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BA bug Something isn't working Size: Medium (2-3)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants