I am building an OSM tile server with mod_tile/renderd, and osm2pgsql, as per instructions here: https://switch2osm.org/manually-building-a-tile-server-16-04-2-lts/
With my current spec EC2 server t2.xlarge, Ubuntu 16.04, I can just about work with a country-sized map, although rendering tiles on the fly is still slow, so render_list is needed. I have tried all performance tweaks I could find to speed up rendering, but what I really think I need is a more powerful server, particularly as the eventual aim is a planet sized import. Most server specs I can find for this are very outdated.
Would anybody have recommendations for an EC2 instance (or general cloud server specs) for building a planet sized OSM tile server in 2018?
I found upgrading to a m5.2xlarge server was sufficient to work with the planet database - on my previous 16gb server, I was running out of RAM for many DB tasks. Other important issues to resolve were:
Build spatial indexes on the entire table geometries, which was not done by osm2pgsql in my case. I did already have partial indexes from running openstreetmap-carto/scripts/indexes.py but these were not suitable for my style and not being used, so I needed to create these indexes:
CREATE INDEX planet_osm_polygon_index ON planet_osm_polygon USING GIST(way)
CREATE INDEX planet_osm_line_index ON planet_osm_line USING GIST(way)
Manually set a layer extent in the style xml file (I just used the map extent) - I had omitted it, which means it had to be calculated by a time consuming PostGIS query, see: https://github.com/mapnik/mapnik/wiki/OptimizeRenderingWithPostGIS
Run a VACUUM and ANALYZE
I have now been able to run render_list on zooms 0-11, and the server can generate further zoom levels on the demand without issue.