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

Size-limited pool for GTFS cache #805

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from
Draft

Size-limited pool for GTFS cache #805

wants to merge 4 commits into from

Conversation

abyrd
Copy link
Member

@abyrd abyrd commented Apr 21, 2022

Addresses #799. Related to #473. This is concurrent code managing its own locks and conditions, so should be subject to additional scrutiny and testing under load. That said, the locking has been kept relatively coarse to make it easier to follow.

This LimitedPool has been wired up to GTFSFeeds and spatial indexes, with the maximum size set very small for testing. It should also be applicable to things like linkages and distance tables and the AsyncPreloader, but those are not wired up yet.

For now the logging is set to be quite noisy on the LimitedPool class so we can observe how it behaves under load.

Hard limit on total number of feeds open at once.
get() blocks when full until a feed can be evicted (has no users).
only one GTFSFeed can be open for each key at a time.

Mostly untested draft, needs serious audit for concurrency issues.

To simplify (while losing generality):
reference counting logic could be pushed down into GTFSFeed itself.
ReferenceCountingCache logic could be pulled up into GTFSCache.
considering LimitedPool as an option of LinkageCache
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

Successfully merging this pull request may close these issues.

1 participant