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

Implement tile caching #1105

Merged
merged 3 commits into from
Dec 31, 2023
Merged

Implement tile caching #1105

merged 3 commits into from
Dec 31, 2023

Conversation

nyurik
Copy link
Member

@nyurik nyurik commented Dec 25, 2023

Add a top level config parameter -- the size of cache memory (in MB) to use for caching tiles and PMT directories, defaulting to 512, and 0 to disable. This also removes the pmtiles.dir_cache_size_mb parameter (it will be ignored, but will give a warning)

cache_size_mb: 512

The new cache will contain all tiles as provided by the source. So if PostgreSQL returns a non-compressed tile, the cache will contain the uncompressed variant, and will be compressed for each response. This will be fixed in the later releases.

Note that fonts and sprites are not cached at this time, and are still a TODO.

@nyurik nyurik force-pushed the cache-all branch 5 times, most recently from 0ac296a to adcfcdd Compare December 27, 2023 20:02
@nyurik nyurik force-pushed the cache-all branch 2 times, most recently from a542cbc to c06a56d Compare December 30, 2023 00:16
@nyurik nyurik merged commit 3dc54d7 into maplibre:main Dec 31, 2023
3 of 10 checks passed
@nyurik nyurik deleted the cache-all branch December 31, 2023 03:48
@donnyv
Copy link

donnyv commented Jan 15, 2024

How does it know when to dump the cache for a table? If does dump the cache. Does it dump the whole cache or only features that have been updated?

@nyurik
Copy link
Member Author

nyurik commented Jan 15, 2024

@donnyv there is no cache flushing at the moment, because Martin assumes all data is static. We will need a way to flush cache going forward.

nyurik added a commit to nyurik/martin that referenced this pull request Jan 17, 2024
Add a top level config parameter -- the size of cache memory (in MB) to
use for caching tiles and PMT directories, defaulting to 512, and 0 to
disable. This also removes the `pmtiles.dir_cache_size_mb` parameter (it
will be ignored, but will give a warning)

```
cache_size_mb: 512
```

The new cache will contain all tiles as provided by the source. So if
PostgreSQL returns a non-compressed tile, the cache will contain the
uncompressed variant, and will be compressed for each response. This
will be fixed in the later releases.

Note that fonts and sprites are not cached at this time, and are still a
TODO.
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.

2 participants