Slow rendering (openstreetmap-carto)
Hello,
I just set up a planet DB on my server, following the switch2osm tutorial (https://switch2osm.org/manually-building-a-tile-server-18-04-lts).
I imported the planet.pbf file (https://switch2osm.org/manually-building-a-tile-server-18-04-lts). I'm using this command:
time osm2pgsql -d gis --create --slim
-G --hstore -C 48000 --number-processes the default openstreetmap-carto style. Tiles rendering is way too slow to be usable. I plan to pre-render up to zoom 12, and generating a single metatile at zoom 13 takes 20 seconds. It still takes 6 \
--tag-transform-script ~/src/map-styles/openstreetmap-carto/openstreetmap-carto.lua \
--style ~/src/map-styles/openstreetmap-carto/openstreetmap-carto.style \
planet-latest.osm.pbf
And here's my seconds at zoom 16.
Here's what I've done so far to speed things up:
- put my DB on my server's SSD
- execute the indexes.sql script (https://github.com/gravitystorm/openstreetmap-carto/blob/master/indexes.sql )
- fine tune my PostgreSQL config and set my cpufreq-set to performance as recommended here: https://wiki.openstreetmap.org/wiki/User:Species/PostGIS_Tuning
What more should I do? I added below more information about my setup. Interestingly rendering durations with render_list seems fine (see below).
----------------------------------------------------------
Here's my server's config:
- Intel Core i7-8700 Hexa-Core (12 threads)
- 64 GB of RAM
- 2 TB SSD (for the BD)
DB)
- 2 * 6 TB HDD (set up in RAID 1, for the OS & the tile cache)
I imported the planet.pbf file using this command:
time osm2pgsql -d gis --create --slim
-G --hstore -C 48000 --number-processes 6 \
--tag-transform-script ~/src/map-styles/openstreetmap-carto/openstreetmap-carto.lua \
--style ~/src/map-styles/openstreetmap-carto/openstreetmap-carto.style \
planet-latest.osm.pbf
It took 36 hours to complete, creating a DB of around 900 GB. The DB is stored on the SSD, and the tiles cache to the HDD. I executed the indexes.sql script of openstreetmap-carto (https://github.com/gravitystorm/openstreetmap-carto/blob/master/indexes.sql ) after the import.
Now rendering tiles is extremely slow:
- zoom 13: 30 seconds
- zoom 16: 6 seconds
I'm trying to fine tune my PostgreSQL server to improve it, with little to no improvements. Following the advices on this page: https://wiki.openstreetmap.org/wiki/User:Species/PostGIS_Tuning and a few other tutorials, GB.
Here's what I added the following to my /etc/postgresql/10/main/postgresql.conf:
to my postgresql.conf:
synchronous_commit = off
fsync = off
random_page_cost = 1.1
wal_buffers = 16MB
effective_cache_size = 48GB
maintenance_work_mem = 4GB
shared_buffers = 8MB
work_mem = 128MB
autovacuum = on
effective_io_concurrency = 200
max_connections = 300
checkpoint_completion_target = 0.7
default_statistics_target = 100
min_wal_size = 1GB
max_wal_size = 2GB
max_worker_processes = 12
max_parallel_workers_per_gather = 6
max_parallel_workers = 12
I also changed my cpufreq-set with the following command:
sudo cpufreq-set -g performance
Still, generating a single metatile at zoom 13 (which isn't the worst) takes 20 seconds.
Rendering Here are some rendering durations I got with render_list. They seem fine to me:
- zooms 0-4 with render_list took 13 minutes. Here's the output:
*****************************************************
Total for all tiles rendered
Meta tiles rendered: Rendered 8 tiles in 788.40 seconds (0.01 tiles/s)
Total tiles rendered: Rendered 512 tiles in 788.40 seconds (0.65 tiles/s)
Total tiles handled: Rendered 8 tiles in 788.40 seconds (0.01 tiles/s)
*****************************************************
Zoom 00: min: 139.1 avg: 139.1 max: 139.1 over a total of 139.1s in 1 requests
Zoom 01: min: 111.3 avg: 111.3 max: 111.3 over a total of 111.3s in 1 requests
Zoom 02: min: 112.7 avg: 112.7 max: 112.7 over a total of 112.7s in 1 requests
Zoom 03: min: 138.2 avg: 138.2 max: 138.2 over a total of 138.2s in 1 requests
Zoom 04: min: 13.9 avg: 71.8 max: 126.4 over a total of 287.1s in 4 requests
*****************************************************
0 -> 4: 13mn
- zooms 5 -> 6: 15mn
- zooms 7: 13mn
What more can I do? Are we supposed to create other indexes than the ones listed in the indexes.sql script?
I was expecting rendering performance to be something like 1-5 secs on that server (depending on the zoom level). Is that realistic?