Skip to content

Commit 21bf46e

Browse files
docs(cache): update the docs with our new cache capabilities (#2311)
Only to be merged close to release to prevent confusion --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 50d6411 commit 21bf46e

File tree

5 files changed

+45
-7
lines changed

5 files changed

+45
-7
lines changed

docs/src/config-file.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,28 @@ base_path: /tiles
3737
# Number of web server workers
3838
worker_processes: 8
3939

40-
# Amount of memory (in MB) to use for caching tiles [default: 512, 0 to disable]
41-
cache_size_mb: 1024
40+
# Amount of memory (in MB) to use for caching [default: 512, 0 to disable]
41+
#
42+
# This is the total amount of cache we use.
43+
# By default, this is split up between:
44+
# - Tiles 50% -> 256 MB
45+
# - Pmtiles' directories 25% -> 128 MB
46+
# - Fonts 12.5% -> 64 MB
47+
# - Sprites 12.5% -> 64 MB
48+
#
49+
# How the cache works internally is unstable and may change to improve performance/efficiency.
50+
# For example, we may change the split between sources to improve efficiency.
51+
#
52+
# Specify each cache size individually for finer cache size control:
53+
# - Tiles: `tile_cache_size_mb`
54+
# - Pmtiles: `pmtiles.directory_cache_size_mb`
55+
# - Fonts: `fonts.cache_size_mb`
56+
# - Sprites: `sprites.cache_size_mb`
57+
cache_size_mb: 512
58+
59+
# Allows overriding the size of the tile cache.
60+
# Defaults to `cache_size_mb` / 2
61+
tile_cache_size_mb: 256
4262

4363
# Which compression should be used if the
4464
# - client accepts multiple compression formats, and
@@ -231,6 +251,16 @@ postgres:
231251

232252
# Publish PMTiles files from local disk or proxy to a web server
233253
pmtiles:
254+
# Size of the directory cache (in MB).
255+
# Defaults to cache_size_mb / 4
256+
#
257+
# Note:
258+
# Tile and directory caching are complementary.
259+
# For good performance, you want
260+
# - directory caching (to not resolve the directory on each request) and
261+
# - tile caching (for high access tiles)
262+
directory_cache_size_mb: 128
263+
234264
# You can pass options for pmtiles files located on remote storages here.
235265
#
236266
# The avaliable options are documented here:
@@ -282,6 +312,10 @@ cog:
282312

283313
# Sprite configuration
284314
sprites:
315+
# Size of the sprite cache (in MB).
316+
# Defaults to cache_size_mb / 8
317+
cache_size_mb: 64
318+
285319
paths:
286320
# all SVG files in this dir will be published as a "my_images" sprite source
287321
- /path/to/my_images
@@ -291,6 +325,10 @@ sprites:
291325

292326
# Font configuration
293327
fonts:
328+
# Size of the sprite cache (in MB).
329+
# Defaults to cache_size_mb / 4
330+
cache_size_mb: 64
331+
294332
# A list of *.otf, *.ttf, and *.ttc font files and dirs to search recursively.
295333
- /path/to/font/file.ttf
296334
- /path/to/font_dir

docs/src/run-with-nginx.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Using with NGINX
22

3-
You can run Martin behind NGINX proxy, so you can cache frequently accessed tiles and reduce unnecessary pressure on the database. Here is an example `docker-compose.yml` file that runs Martin with NGINX and PostgreSQL.
3+
You can run Martin behind NGINX proxy, so you can cache frequently accessed tiles with custom logic.
4+
Here is an example `docker-compose.yml` file that runs Martin with NGINX and PostgreSQL.
45

56
```yml
67
version: '3'

docs/src/sources-cog-files.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ listen_addresses: '0.0.0.0:3000'
3939
# Number of web server workers
4040
worker_processes: 8
4141

42-
# Amount of memory (in MB) to use for caching tiles [default: 512, 0 to disable]
42+
# Amount of memory (in MB) to use for caching [default: 512, 0 to disable]
4343
cache_size_mb: 8
4444

4545
# Database configuration. This can also be a list of PG configs.

docs/src/sources-fonts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Martin can serve glyph ranges from `otf`, `ttf`, and `ttc` fonts as needed by MapLibre text rendering. Martin will
44
generate them dynamically on the fly.
5-
The glyph range generation is not yet cached, and may require external reverse proxy or CDN for faster operation.
5+
The glyph range generation is cached and the size of this cache can be configured via `fonts.cache_size_mb` in the config file.
66

77
## API
88

docs/src/sources-sprites.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ The SVG filenames without extension will be used as the sprites' image IDs (reme
55
The images are searched recursively in the given directory, so subdirectory names will be used as prefixes for the image IDs.
66
For example `icons/bicycle.svg` will be available as `icons/bicycle` sprite image.
77

8-
The sprite generation is not yet cached, and may require external reverse proxy or CDN for faster operation.
9-
If you would like to improve this, please drop us a pull request.
8+
The spritesheet generation is cached and the size of this cache can be configured via `sprites.cache_size_mb` in the config file.
109

1110
### API
1211

0 commit comments

Comments
 (0)