You are browsing a read-only backup copy of Wikitech. The live site can be found at


From Wikitech-static
Revision as of 23:49, 25 September 2015 by imported>Yurik
Jump to navigation Jump to search

This page describes the technical aspects of deploying Maps service on Wikimedia Foundation infrastructure.


The maps service consists of Kartotherian - a nodejs service to serve map tiles, and Tilerator - a non-public service to prepare vector tiles (data blobs) from OSM database into Cassandra storage. There are four servers in the maps group: maps-test200{1,2,3,4}.codfw.wmnet that run both Kartotherian (port 6533, NCPU instances) and Tilerator (port 6534, half of NCPU instance). Also, there are two Varnish servers in the cache_maps group: cp104{3,4}.eqiad.wmnet.



Kartotherian servers map tiles by getting vector data from Cassandra, applying the style to it, and returning raster images. It is also capable of serving a "static image" - a map with a given width/height/scaling/zoom, and can server vector tiles directly for on-the-client rendering (WebGL maps).

To see the tiles without Varnish cache, connect to Kartotherian using an ssh tunnel, e.g. ssh -L 6533:localhost:6533 maps-test2001.codfw.wmnet and browse to http://localhost:6533


Tilerator is a backend vector tile pre-generation service that uses a Redis job que, copying tiles from a Postgres DB, using sql queries into vector tiles stored in Cassandra. It is controlled via POST requests from localhost. Postgres DBs are set up on each of the maps hosts, one master and 3 slaves.

Connect to Tilerator using an ssh tunnel, e.g. ssh -L 6534:localhost:6534 maps-test2001.codfw.wmnet

See full Tilerator documentation for all commands & parameters.

Command URL
Jobs Status http://localhost:6534/
Jobs Internal Status http://localhost:6534/raw
Get a list of variables http://localhost:6534/variables
Get source configuration http://localhost:6534/sources
Add new sources POST text body in YAML to http://localhost:6534/sources

For POST requests and responses in JSON, browser extensions such as Postman tend to work well.

Dynamic Tile Sources


To create a new Cassandra data source, post something like this to the /sources as a text body. Default table name is tiles. If table or keyspace is not there, you have to use createIfMissing parameter.

  uri: cassandra://
    keyspace: v2
    table: tiles2a
    cp: [maps-test2001.codfw.wmnet, maps-test2002.codfw.wmnet, maps-test2003.codfw.wmnet, maps-test2004.codfw.wmnet]
    username: {var: cassandra-user}
    password: {var: cassandra-pswd}
#    repfactor: 4
#    durablewrite: 0
#    createIfMissing: true

Dynamic Layer Generator

To generate just a few layers from database, create a layer filter and a layer mixer:

  uri: bridge://
    npm: ["osm-bright-source", "data.xml"]
      dbname: gis
      host: ""
      type: postgis
      host: localhost
      user: {var: osmdb-user}
      password: {var: osmdb-pswd}
  xmlLayers: [admin, road]

  uri: layermixer://
    sources: [{ref: v2}, {ref: gentmp}]

Once set, POST a job to copy mixtmp into the storage v2 e.g. http://localhost:6534/add?generatorId=mixtmp&storageId=v2&baseZoom=0&fromZoom=5&beforeZoom=6&parts=10

Generating Tiles

Generate all tiles for zooms 0..7, using generator gen, saving into v3 everything including the solid tiles, up to 4 jobs per zoom.


Generated tiles only if they already exist in v2 source, and save them into v3, on zooms 8..15, 60 jobs per zoom.


Bulk Copying

The fastest way to copy a large number of tiles from one source to another is to use a large number of parts and specify saveSolid=true (skips solid tile detection). E.g. to copy all z16 tiles from v2 to v3, use