monarch-initiative / biolink-api

API for linked biological knowledge
https://api.monarchinitiative.org/api/
BSD 3-Clause "New" or "Revised" License
63 stars 25 forks source link

Dev server takes minute and a half to boot up #251

Closed kshefchek closed 5 years ago

kshefchek commented 5 years ago

This is non urgent but something I noticed while hacking on biolink, running the dev server via:

python biolink/app.py

takes ~100 seconds to start up. This can be cumbersome when making small changes and checking updates. There appears to be some preloading steps that are executed twice. See the attached logs: biolink-dev-logs.txt

cmungall commented 5 years ago

that's not good, Deepak and I can take a look at this

deepakunni3 commented 5 years ago

I noticed this two weeks ago and here is what I gathered.

Notes:

kshefchek commented 5 years ago

Ah so I'm the culprit! I'll have to remind myself what I'm doing here and take a different approach.

deepakunni3 commented 5 years ago

If Ontobio is properly caching scigraph:ontology then this step should move faster. The first call will take 30 seconds and all subsequent initialization will take a fraction of that.

Although I am not sure why caching is not working.

kshefchek commented 5 years ago

possibly related - https://github.com/biolink/ontobio/pull/278#issuecomment-455020850

deepakunni3 commented 5 years ago

Okay, I'll take a look at it. Might be a limitation of the caching mechanism used

kshefchek commented 5 years ago

uncommenting https://github.com/biolink/ontobio/blob/d2ab6facf14bc373c4f008e00c40b2e717a8285c/ontobio/ontol_factory.py#L78 helps a little. I'm questioning my design decision. OwlSim2Api could be treated like a singleton class, and I'm not sure the best place to instantiate it. Another option is to adjust the constructor so it's not creating a scigraph ontology factory, or moving the _get_owlsim_stats method out of the class and caching it.