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

Optimize Local File Vocab Load #153

Open
no-reply opened this Issue Aug 15, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@no-reply
Member

no-reply commented Aug 15, 2017

Local vocabularies in a YAML file are read from disk fresh for each call to the #all, #search, and #find operations. This can mean that the full file is read, and the in-memory YAML structure allocated/gc'd multiple times in a typical form operation. This is especially an issue for larger vocabularies

We should optimize this to hold the YAML data structures in memory while the application running. I think this is slightly more complex than a simple instance variable, since the Authority instances may be initialized repeatedly. Something like a singleton wrapping the YAML is probably called for.

See: https://github.com/samvera/questioning_authority/blob/master/lib/qa/authorities/local/file_based_authority.rb#L28

@elrayle

This comment has been minimized.

Show comment
Hide comment
@elrayle

elrayle Oct 19, 2017

Contributor

The configuration yml files associated with the linked data processing side of QA are read in once.

See config/initializers/linked_data_authorities.rb.

This looks in the QA's config/authorities/linked_data directory and the same directory in the app that includes QA. The downside of reading in through an initializer is that it requires a server restart to pick up configuration changes and new configurations. But since these don't change very often, that hasn't been an issue thus far.

Contributor

elrayle commented Oct 19, 2017

The configuration yml files associated with the linked data processing side of QA are read in once.

See config/initializers/linked_data_authorities.rb.

This looks in the QA's config/authorities/linked_data directory and the same directory in the app that includes QA. The downside of reading in through an initializer is that it requires a server restart to pick up configuration changes and new configurations. But since these don't change very often, that hasn't been an issue thus far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment