-
Notifications
You must be signed in to change notification settings - Fork 59
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
[App Performance] Profile the time it takes for the app to load the configs and patient data from the local DB. #2066
Comments
How do we close this? How about through a new test that fails if this request takes longer than some very lenient amount of time |
Makes sense. I think we add that. We also want to record the times and device resources and then use that as a baseline in order to validate improvements made to the code. |
Cool nb if we need to add example FHIR resources into this repo to support content for testing, I think that is appropriate |
@pld @dubdabasoduba is this ticket about profiling to get the current metrics or about writing the integration test such that it passes or fails if it exceeds some period x? |
I think it should be about the latter, which would also mean we have to do the former, at least for a specific code path, does that make sense? |
Loading times as tested on the Blu G60 with 3 GB RAM, 64 GB ROM, Octa-core 1.6 GHz and running on Android 9 The family register page currently takes at least 60 seconds and a maximum of 3 minutes to show 25 family items. Time taken to load the register
Time taken to load profile pages
Optimizations tried/made on the household page
Time taken after improvements (household register only)
Table to store the RegisterFamilies and their data
INDEX TO SPEED UP SORT BY lastUpdated
QUERY TO UPDATE THE lastUpdated in RegisterFamilies
======
======= QUERY TO GET Family Member resourceUuid's
Query to get Family resourceUuid
QUERY TO GET THE TASK COUNT FOR A PATIENT
QUERY TO GET THE CHILD COUNT IN A FAMILY
QUERY TO GET THE NUMBER OF PREGNANT WOMEN IN A FAMILY
=== SPEEDUP FOR FETCH MEMBERS QUERY ===
|
On measuring performance on CI, we have a number of options that we can evaluate
We can get more ideas on this before commiting to an idea |
With the optimisations done by the team @ellykits and @ndegwamartin , performance has improved by 50% Time taken to load the register
These times were taken with the device wifi turned off meaning background syncing jobs were not running. This also used the previous ECBIS preview instance data used during the first benchmark |
@ekigamba is this from the latest RC? what branch/PR are these results based on? |
@pld This is based on the latest |
Results after revInclude integrationLooks good for the profile pages, general improvement. Household profile ~2 sec No change in the performance of the household, children and sick child register. Respectively times are 24 sec, 3 sec and 3 sec. The bug fixes done yesterday by @kitoto did fix the performance degradation on child and sick child registers |
Results after forward include integration into FHIR CoreHousehold register = ~20 secs Household profile = ~ 2 secs |
@ekigamba any more insight into why household register is slow? how can we help now that we have tried rev and forward include? aditya's gonna merge those two changes soon. |
@jingtang10 We are actively working on improving the household register performance. We identified a few issues with the code used to fetch the register data that we are optimizing leveraging the recent functionalities from search APIs.
We'll share updated stats after the above issues are addressed. Aditya mentioned:
Do we have any plans to support filters on accompanying resources via rev/forward to reduce the amount of data to process? I understand this may not be available on the server _include/ _revinclude which the inspiration for the client implementation. |
Thanks Elly. I'm identifying 3 asks from your update: 1) implement filter
in forward and reverse included 2) implement basic aggregate functions in
search 3) optimise parsing
For 1) you're right, this is not included in the fhir spec. But as I have
said, our search API is inspired by the fhir restful search API, but does
not have to follow it to the letter (and we don't). The reason is that our
search is on-device and not a client-server search and has different
requirements and constraints. So in principle I think we can definitely
provide filter in the forward and rev include. Aditya and I discussed this
briefly and please share your exact query and create an issue so we can
design this in detail.
For 2) this again is a reasonable request :) We will need to take a look
after the search result refactoring following Aditya's rev include pr. This
is because the aggregate result need to be included in a search result
wrapper. I discussed this with Bashir as well and will pull him in where
necessary.
3) possibly quite hard to actually improve the performance of the actual
parsing. But I wonder if we can parse lazily as an optimisation. As the
moment we parse everything eagerly as soon as they're returned from the DB.
I've not tried myself but I'd like to explore.
…On Sat, 13 May 2023, 00:19 Elly Kitoto, ***@***.***> wrote:
@jingtang10 <https://github.com/jingtang10> We are actively working on
improving the household register performance. We identified a few issues
with the code used to fetch the register data that we are optimizing
leveraging the recent functionalities from search APIs.
1. Aggregating all counts for household members retrieved via forward
include. At the moment we run count for each member then sum all in code.
2. Retrieve all household members accompanying resources all at once,
we'd been handling this recursively for each member before forward include
implementation.
We'll share updated stats after the above issues are addressed.
Aditya mentioned:
1.
"A plan to refactor the api's to be just search and have include and
revInclude just like has in the current search api.". Current
implementation requires different calls for forward and reverse include.
(Internally from our last discussion both functionalities run two queries
one to fetch the primary resources and then another query to retrieve the
accompanying resources)
2.
Parsing resources taking longer any details on this do we expect any
improvements in future?
Do we have any plans to support filters on accompanying resources via
rev/forward to reduce the amount of data to process? I understand this may
not be available on the server _include/ _revinclude which the inspiration
for the client implementation.
—
Reply to this email directly, view it on GitHub
<#2066 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG3M2XG3DPVS53OAYLIJ5VDXFZIHFANCNFSM6AAAAAAVCKEEUU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Thanks for your response @jingtang10 In agreement with you for the asks (priority in the order they are listed).
|
@ekigamba let's a add a perf test to close this out with |
thinking same pattern here, which looks in line w/the draft pr, #2067 (comment) |
@ekigamba Whats the ETA for this ticket ? |
The remaining fixes might take 1 - 2 FTE days. I'll create issues any unresolved and potential issues originating from this ticket |
Summary of performance testing implementationTools used
Possible issues
Possible improvements
... |
Cool, so I am 100% fine w/all of those I guess my question is, when you say flakey, how flakey, like are you seeing 10x changes between runs? I think what we can test for is that it's staying within the expected order of magnitude, like if you're seeing 2-5x changes, we can fail the test if we see a 10x change, if you're seeing 20-50x changes, we can fail the test if we see a 100x change -- we're only trying to put a wide envelope on it for now, in follow-up we'll tighten it |
I'd think that I wouldn't expect it to be flaky initially given that the tests are isolated and emulator barely has any other interaction when the tests are running, but any changes in infrastructure that we might not know off will become noticeable. I have set to limit to ~1.5x based on this assumption and we can change this if the assumption is wrong. The library manages stability of results by running the tests until the results are consistent and then it uses the results from the stable iterations |
Describe the enhancement
Implementation
Device configuration
Expected results.
The text was updated successfully, but these errors were encountered: