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

Large memory usage #9

Open
derosm2 opened this issue Jan 13, 2020 · 0 comments
Open

Large memory usage #9

derosm2 opened this issue Jan 13, 2020 · 0 comments

Comments

@derosm2
Copy link

derosm2 commented Jan 13, 2020

Taking a look at memory usage using, I was able to see that fhir_stu3_models comes in at 31 MiB (for comparison Rails is at 28 MiB).

Specifically I was using https://github.com/schneems/derailed_benchmarks and running bundle exec derailed bundle:mem

bundle exec derailed bundle:mem
TOP: 175.75 MiB
  fhir_client: 77.7852 MiB
    fhir_stu3_models: 31.3828 MiB
        lib/fhir_stu3_models/fhir/resources/ImagingStudy.rb: 5.3008 MiB
        lib/fhir_stu3_models/fhir/resources/DocumentManifest.rb: 1.9961 MiB
        lib/fhir_stu3_models/fhir/resources/DocumentReference.rb: 1.9023 MiB
        lib/fhir_stu3_models/fhir/resources/AuditEvent.rb: 1.6875 MiB
        lib/fhir_stu3_models/fhir/resources/Procedure.rb: 1.375 MiB
        lib/fhir_stu3_models/fhir/resources/CarePlan.rb: 1.0586 MiB
        lib/fhir_stu3_models/fhir/resources/Observation.rb: 0.9844 MiB
        lib/fhir_stu3_models/fhir/resources/FamilyMemberHistory.rb: 0.9219 MiB
        lib/fhir_stu3_models/fhir/resources/Condition.rb: 0.8867 MiB
        lib/fhir_stu3_models/fhir/resources/PlanDefinition.rb: 0.7305 MiB
        lib/fhir_stu3_models/fhir/resources/Media.rb: 0.7031 MiB
        lib/fhir_stu3_models/fhir/resources/Patient.rb: 0.625 MiB
        lib/fhir_stu3_models/fhir/resources/ProcedureRequest.rb: 0.5781 MiB
        lib/fhir_stu3_models/fhir/resources/MedicationStatement.rb: 0.5391 MiB
        lib/fhir_stu3_models/fhir/resources/AllergyIntolerance.rb: 0.5273 MiB
        lib/fhir_stu3_models/fhir/resources/ExplanationOfBenefit.rb: 0.5156 MiB
        lib/fhir_stu3_models/fhir/resources/TestScript.rb: 0.5039 MiB
        lib/fhir_stu3_models/fhir/resources/MedicationRequest.rb: 0.4688 MiB
        lib/fhir_stu3_models/fhir/resources/Questionnaire.rb: 0.4648 MiB
        lib/fhir_stu3_models/fhir/resources/Substance.rb: 0.4336 MiB
        lib/fhir_stu3_models/fhir/resources/Specimen.rb: 0.3398 MiB
        lib/fhir_stu3_models/fhir/resources/CapabilityStatement.rb: 0.3242 MiB
        lib/fhir_stu3_models/fhir/resources/DeviceUseStatement.rb: 0.3242 MiB
        lib/fhir_stu3_models/fhir/resources/CareTeam.rb: 0.3086 MiB

This issue gets exacerbated because we are not just including fhir_stu3_models. We use fhir_client which also needs fhir_dstu2_models and fhir_models (which brings the total up to 77 MiB).

Further details can be examined by running bundle exec derailed bundle:objects. Largely seems to be an issue with string allocations due to how the models are defined.

I'm not sure what the right solution to this problem is, but I think it's worth noting so that others can be aware of the memory footprint required by these gems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant