Serving Vector Tiles, Fast

103 points by altilunium 3 months ago | 17 comments
  • stevage 3 months ago
    The term "serving" is a bit misleading here. Most of the time, vector tile servers are serving pre generated tiles, which is extremely fast. This analysis is about generating tiles on the fly from PostGIS through a custom web server.
    • vlovich123 3 months ago
      Yup but super impressive just how much faster Martin was than all the other competition by significant margins with Bbox (Rust) and Tegola (Go) trailing at ~2-4x slower. That indicates the author(s) of Martin really optimized the data structures & algorithms to achieve a new Pareto frontier. Neat - would be nice if there were an accessible summary of the tricks employed to make it so fast that were missing in competitors.
      • darksaints 3 months ago
        The trick that makes Martin so fast is not doing any geospatial processing, and just being focused on making quick, non-blocking requests to Postgres. All geospatial processing is done by PostGIS, which is essentially just using the C++ geos library (which is by far the most comprehensive and well optimized geospatial processing library).
        • GrayShade 3 months ago
          Martin has an in-memory tile cache, which probably makes a difference: https://github.com/maplibre/martin/pull/1105. BBOX caches to a file instead.
          • darksaints 3 months ago
            The benchmarking repository has config files used for the test, and they did not use the tile cache feature.
          • stevage 3 months ago
            Yeah, that's definitely interesting - I'm surprised there is so much room for variation considering PostGIS is (if I'm not mistaken) doing most of the work.

            I couldn't find any description of what test 1, 2, 3 etc actually are though.

          • n4r9 3 months ago
            Not sure I agree; it sounds like the vector tiles are generated in advance of testing the servers. This description is from the linked GitHub:

            > six open-source vector tiles servers (BBOX, Ldproxy, Martin, pg_tileserv, Tegola, and TiPg) are set up and configured using Docker in a public cloud. Vector tiles are created for each server from the vector data of the PostGIS database. Various test scenarios with Apache JMeter are used to determine which server can deliver the vector tiles the fastest.

            • GrayShade 3 months ago
              • n4r9 3 months ago
                Yes, true. I had the impression that the tiles themselves were being stored as geometric data in the postgres DB, then fetched and served. But I might have been confused by the article starting "Once you have created your vector tiles...". The GitHub page is a little ambiguous tbh.
          • pbsurf 3 months ago
            I've built a server for generating OpenStreetMap vector tiles on demand from a GeoDesk database, which is barely larger than an .osm.pbf (100GB vs. 80GB for current planet.osm.pbf) - much smaller than a PostGIS instance: https://github.com/styluslabs/geodesk-tiles
            • durkie 3 months ago
              another option that would have been interesting to see here is serving PostGIS GeoJSON export -> tippecanoe encode. Tippecanoe is super fast, parallelizes well and built solely for generating vector tile data (with lots of configurable options that PostGIS lacks)
              • pluto_modadic 3 months ago
                okay, do they mean vectors, or tiles, because that's like saying "serving PNG JPEGs" or "serving JPEG PNGs". Some servers chuck back /a picture/, some servers chuck back /an SVG/ or line data.
                • chipsa 3 months ago
                  They mean vector tiles. It’s tiles of vectorized images, usually of a map (or other geographic data). They’re so named because they are a vectorized replacement for raster tiles, which were PNGs. If the server chucks back a picture, it’s not a vector tile server.
                  • andrewljohnson 3 months ago
                    In GIS world, a vector tile is a chunk of geographic data (the vectors) limited to a geographic region (the tile boundaries which fit into the projected checkerboard of your map).

                    You use a vector tile instead of a png or jpeg tile because you don’t want an image representation of the data, you want the raw “vector” data so you can style it, search it, and do other things with it on client devices.