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

Performance optimizations in Analysis Request creation #237

Merged
merged 4 commits into from
Aug 30, 2017

Conversation

xispa
Copy link
Member

@xispa xispa commented Aug 29, 2017

This Pull Request contains very small changes, but it makes ~185 analyses from a Profile or Template get populated in less than 3s in AR Add form, even with the creation of 4 Analysis Request at once. With this PR, a delay because of BatchUID reindexing on analyses has been fixed too. As a result, the process of creation of an Analysis Request is significantly faster than before:

  • Creation of 1 Analysis Request with 184 analyses: before ~3m, after ~1m5s.
  • Creation of 1 Analysis Request with 94 analyses: before ~2m, after ~30s.

For these numbers, a laptop has been used, with a standalone instance, started in fg mode and with other applications (email, firefox, openoffice and PyCharm) running, so the numbers should be better in a dedicated server with an instance with zeo mode.

Breakdown of processes that take more than 1s during the creation of an AR with 94 analyses:
a) Submission of form: ~15s
b) Transition of AR to sampled : ~8s
c) Transition of AR to sample_due: ~8s

The most time-consuming task is the creation of the AR by using the ar.processForm(REQUEST=request, values=values) https://github.com/naralabs/bika.lims/blob/d827845190fd78ba55fe2359dee73152ae61cfb7/bika/lims/utils/analysisrequest.py#L75, but don't think there is too much room for improvement here unless we remove fields from the Schema and ensure there is no Created/ModifiedEventHandlers that makes the system to be slow. In any case, worth to review in detail.

Regarding transitions, there is still window for improvement, specially because the Analysis Request object (as well as Sample, Partitions and Analyses) needs to be transitioned several times (sample_received -> sampled -> sample_received) before reaching the desired state. There is some overhead because of transitions cascading and promotion, and there is work going on to address these shortcomings already.

@xispa xispa requested a review from Espurna August 29, 2017 21:17
@Espurna Espurna merged commit 8abf209 into wip Aug 30, 2017
@xispa xispa deleted the ar-creation-optimizations branch August 30, 2017 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants