We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

MapCache: Overview of MapServer's tile caching server

00:00

Formale Metadaten

Titel
MapCache: Overview of MapServer's tile caching server
Serientitel
Anzahl der Teile
188
Autor
Lizenz
CC-Namensnennung 3.0 Deutschland:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen.
Identifikatoren
Herausgeber
Erscheinungsjahr
Sprache
Produzent
Produktionsjahr2014
ProduktionsortPortland, Oregon, United States of America

Inhaltliche Metadaten

Fachgebiet
Genre
Abstract
MapCache is the MapServer project's implementation of a tile caching server. It aims to be simple to install and configure, to be (very) fast (written in C and running as a native module under apache or nginx, or as a standalone fastcgi instance), and to be capable (services WMTS, googlemaps, virtualearth, KML, TMS, WMS). When acting as a WMS server, it will also respond to untiled GetMap requests, by dynamically merging multiple layers into a single image, and multiple tiles into an arbitrary image size. Multiple cache backends are included, allowing tiles to be stored and retrieved from file based databases (sqlite, mbtiles, berkeley-db), memcached instances, cloud REST containers (S3, Azure, Google Cloud Storage), or even directly from tiled TIFF files. Support of dimensions allows storing multiple versions of a tileset (e.g. one per customer), and time based requests can be dynamically served by interpreting and reassembling entries matching the requested time interval. MapCache can also be used to transparently speedup existing WMS instances, by intercepting getmap requests that can be served by tiles, and proxying all other requests to the original WMS server. Along with an overview of MapCache's functionalities, this presentation will also address real-world usecases and recommended configurations.
Schlagwörter
25
74
Vorschaubild
29:15
Gewicht <Ausgleichsrechnung>Bildgebendes VerfahrenREST <Informatik>ParkettierungDigitale PhotographieCachingMultiplikationsoperatorQuellcodeKeller <Informatik>Regulärer Ausdruck <Textverarbeitung>Familie <Mathematik>ServerBrowserDateiformatProxy ServerZusammenhängender GraphMessage-PassingE-MailSummengleichungZeitrichtungVerkehrsinformationMAPDatenkompressionInstantiierungNeuroinformatikMethodenbankCASE <Informatik>GraphfärbungSchlüsselverwaltungDebuggingATMGeometrische QuantisierungBitExogene VariableClientAnalysisMaschinenspracheGoogolMatchingMapping <Computergraphik>t-TestProgrammbibliothekStandardabweichungProtokoll <Datenverarbeitungssystem>BenutzerbeteiligungDifferenteMeterAuflösung <Mathematik>Wrapper <Programmierung>KundendatenbankSpezialrechnerEinsSchnittmengeIntegralProjektive EbeneMaßerweiterungPixelCodierungDialektMeta-TagSkriptspracheDemo <Programm>SoftwareschnittstelleSoftwareentwicklerVersionsverwaltungCodeHeegaard-ZerlegungFormale SpracheSchlussregelTesselationCanadian Mathematical SocietyViereckVirtualisierungInterpolationElektronischer ProgrammführerLesen <Datenverarbeitung>SichtenkonzeptBitmap-GraphikDelisches ProblemVererbungshierarchieZoomStichprobenumfangHydrostatikFront-End <Software>Suite <Programmpaket>Computeranimation
ResultanteIdeal <Mathematik>DatenkompressionInverser LimesBildgebendes VerfahrenEinfügungsdämpfungSoftwareentwicklerSoftwaretestBootenVerzeichnisdienstLastCachingMinkowski-MetrikMultiplikationsoperatorQuellcodeTesselationFarbenraumParkettierungCASE <Informatik>InstantiierungDateiformatKonfiguration <Informatik>Wort <Informatik>MAPBitGruppenoperationGraphfärbungZoomARM <Computerarchitektur>Nichtlinearer OperatorDatenbankMereologieClientStrategisches SpielStandardabweichungOffene MengeSchnittmengeTypentheorieMaßerweiterungVariableAuflösung <Mathematik>Message-PassingAngewandte PhysikTermServerp-BlockDefaultDateiverwaltungÜberlagerung <Mathematik>SatellitensystemTemplateRuhmasseLeistung <Physik>Mini-DiscStatistikOverlay-NetzZahlenbereichBandmatrixDynamisches SystemFront-End <Software>Bitmap-GraphikHalbleiterspeicherEinfache GenauigkeitDifferenteHackerUmwandlungsenthalpieStützpunkt <Mathematik>CodierungAliasingComputeranimation
Arithmetischer AusdruckSicherungskopieFront-End <Software>DateiverwaltungEinfache GenauigkeitBildgebendes VerfahrenCachingServerVektorraumPolygonOffene MengeElementargeometrieMaximum-Entropie-MethodeMAPPunktATMParkettierungInstantiierungZeitstempelDatenbankBitmap-GraphikDimensionsanalyseClientSatellitensystemTesselationTeilmengeMultiplikationsoperatorFlächeninhaltInformationsspeicherungCoxeter-GruppeMaßerweiterungKundendatenbankRelationentheorieRegulärer Ausdruck <Textverarbeitung>ZoomNichtlinearer OperatorProzess <Informatik>Dichte <Physik>DateiformatMinkowski-MetrikProgrammbibliothekVersionsverwaltungKommandospracheAutorisierungBefehlsprozessorProtokoll <Datenverarbeitungssystem>Service providerFlächentheorieEin-AusgabeSteifes AnfangswertproblemCASE <Informatik>REST <Informatik>Hook <Programmierung>ZahlenbereichSchnittmengeDemoszene <Programmierung>URLInverser LimesBandmatrixMosaicing <Bildverarbeitung>TeilbarkeitMereologiep-BlockFokalpunktTaskImpulsGewicht <Ausgleichsrechnung>Umsetzung <Informatik>Lesen <Datenverarbeitung>HoaxSoftwareschnittstelleQuellcodeDreiMapping <Computergraphik>Computeranimation
Hierarchische StrukturMAPTesselationDatenkompressionQuick-SortComputeranimationVorlesung/Konferenz
CachingFehlermeldungTesselationProxy ServerRPCCodeKonfigurationsraumAbstandTypentheorieUmsetzung <Informatik>MultiplikationsoperatorBitrateVorlesung/Konferenz
ParkettierungKonfiguration <Informatik>ServerQuaderCASE <Informatik>Mixed RealitySichtenkonzeptElementargeometrieFehlermeldungTouchscreenQuick-SortVorlesung/Konferenz
MultipliziererKonfiguration <Informatik>Front-End <Software>CASE <Informatik>Vorlesung/Konferenz
ParkettierungThreadCASE <Informatik>Konfiguration <Informatik>Front-End <Software>Endliche ModelltheorieVorlesung/Konferenz
Vorlesung/Konferenz
Transkript: Englisch(automatisch erzeugt)
Tile saving component that's been added to maps of Two years ago officially, I think as Steve said three maybe now Just a short introduction about what what's tiling server so tiles are actually pre-computed usually 256 by 256 pixel images that allow first access to
Statically static data that's been that's been cached somewhere for rapid access A tile is aligned to one grid Which is basically a subdivision of the world along a given for a given projection
For a given extent and across different resolutions Tiles contain data that has been rendered by some third-party service In usual case another WMS server or map server itself or Google data source or whatever
Once the tile has been generated by this server it's split up by the time server and stored in a cache backend So we'll be looking at all the available cache backends. We have available and then that tile can be self backed to clients over the web
respecting different Services or standards. Map cache itself is actually a tiling library more than a tiling server and it has Front ends that's tie it either to the Apache web server
as a fast CGI instance as a native nginx module or as a native node module It's versatile in the sense that it supports multiple cache backends It supports multiple client protocols and it has advanced tile management features which allow you to pre-generate
seeds beforehand so that's called seeding recompress images to gain image weight interpolate image data that's not present from lower levels it's written in native code C, which is fast and lean and
There's a tiny demo interface that allows you to quickly set up a service and then just copy paste the JavaScript code That's needed to get that use that server directly in your development and client code The code is now four years old
started in 2010 and It was officially integrated as a map server components and the map server suit in 2012 so first talk about the protocols that are implemented and how you can request tiles from a cache, so it's
uses either standard XYZ addressing KML super overviews to view tiles in Google Earth typically and it has also a WMS wrapper to create To read WMS from tiles. I'll go into more detail for that So for standard tile addressing it supports the CMS protocol, which is the
OSGO protocol for addressing tiles It supports WM TS in either restful restful or key value pair modes Which is basically very similar to CMS, but vetted by the ODC supports addressing by virtual earth quad keys map guide addressing and standard XYZ addressing
It also supports WMS get map requests, which means that it will compute Any get map requests for given size or layers and Use the tiles that it has in cash instead of using the native data itself
So in most cases, this is usually much faster than hitting a WMS server itself Because you're using pre computed image tiles as the source So it responds to untiled Requests by assembling those tiles from the caches It can either assemble them vertically in the sense that if you're asking for multiple layers
Then it will stack multiple tiles one in the other and fusion them into a single tile and also horizontally Which means that if you ask for 1,000 by 1,000 images will stack four tiles once one's next to each other to create a that image It also acts as a kind of put ODC in balance because that's the main usage
Proxy for other services. So in that case, it can be the front end to your services It will intercept the requests that are tiled or that can be served from tile caches And then you have a set of rules that can allow you to forward other requests to other servers
So you have a kind of expressing language with regular expressions. This means you can send WFS request to a WFS server You Can send WFS requests of version 1.1 to one server and then 2.0 to another server You can also serve static data from
from another server Miscellaneous features which I've just put together here It creates the caching HTTP headers So your clients don't keep requesting over and over again for the same tile If if we allow it to to live that long in the browser's browser's cache
It can expire tiles more or less automatically So basically if you define that's a tile in your cache can only be one hour old. It will Automatically delete that tile if it's requested after one hour and recreate it back from the WMS source
It will report errors either as a message either as an empty image Or just basic status codes inside there are your HTTP requests There's support for meta tiling So that's creating multiple tiles from a single large get map request to the source WMS server
You can watermark the tiles with your logo if you that's what you want and it's And it's can also up sample tiles from lower level zoom level so basically if you have 10 meter raster image, but you want to serve them up to
Up to zoom level 20 or 21 for Google Maps. There's no use caching those Low resolution tiles it will just recreate them from the low resolution data. That's that's available Once your image comes back from
WMS server it can be recompressed and optimized before being stored into the tile cache itself This means this is useful if you're using raster data and You want to avoid double JPEG
Compression decompression once I once from the WMS server and one from the tile cache So you'd request PNG from your source WMS server and then Compress the JPEG only once when you're storing to your tile cache It can also allow you to be aggressive on the compression levels. You're applying to the tiles when you're storing them
And you're preceding everything or you can also choose to use a Less aggressive compression for doing on-demand compression of image tiles So less CPU used but at the cost of a higher weight images
It supports multiple image formats that can be stored or returned to the clients so the two basic Image formats used on the web so PNG on which you can play with the compression level that's applied to the PNG data and you can also apply quantization to the data to store those tiles as 8 bits by choosing the
Correct 256 colors that best match the image. That's that's being stored For JPEG you can also play on the compression or quality level and you can choose in which color space they the JPEG compression takes place usually YCBCR gets you better compression results
There's also a kind of fun feature which allows you to choose let map cache Dynamically choose in which format it's going to store its tiles It's going to store JPEG if it sees that the image data is fully opaque and then PNG if it sees that There's a transparency in it. So basically that means if you have a satellite
raster that doesn't cover the whole world then all the past that are fully covered by the roster will be stored in JPEG to Reduce the bandwidth and then the images on the side which have no data values will be stored and returned as PNG So you can overlay that with other layers on your clients
It will also try to intelligently handle empty or uniform tiles Depending on the caching backends that are used It will use different strategies once it sees that the tile contains no data or just one single color For caching on the disk. It will use symbolic linking to
To one file It can also For other cache backends just store the color in the cache instead of storing the image style and then base Dynamically recreate a PNG image on the fly at the request time Returning a 1-bit PNG of a uniform color
So I don't remember exactly the size of that PNG file is something around the 180 bytes something like that If you are in the case where you know, your cache is already fully seeded And it's all treats a tile that's not present in the cache as a fully transparent file and return that to you
So now we talk about image formats Map cache supports multiple grids not only the Google marketer one so you can define multiple grids per
Tile set you are serving so you can serve them up in WGS 84 for overlaying on a globe and marketer It's all automatically detects. Well, you can configure it to respond to grid aliases. So the the eternal problem between the EPSG
3357 and the deprecated 913 when is handled it can handle non-standard EPS. Well non EPSG codes in that case Inside the grid you can also configure a tile set to only Be configured for a certain extent of certain resolutions of a grid
So just say I'm using the Google grid But I'm only want the first ten levels and then in one day one day if you want to change that and and Switch to a higher zoom level. You just have to change that and not have to recreate all those tiles Same for the restricted extent saying, okay. I'm now only going to cover the USA
And then switch to the whole world and not have to recreate all the times you've already created for the Cache backends, which is basically the most important part of the tile cache So a cache is a backend that's able to store tile data for a given XYZ
So that's really the basic part of it To be able to become a cache your backend has to support For basic operations, which is exists, you know if a tile is in the cache given the given XYZ Get back image data for a given XYZ store data for that one and delete data
There are some specific hacks or Features that are only available for certain cache backends. So now I'll go into more details about each cache backend This cache is stored tile as directly in the file system
I Put here mainly for development testing or small tile sets because storing millions or billions of tiles on the file system Usually very quickly get into the limits of what the file systems are designed to do So the pros about this discussion it's very simple to set up you just give it a directory in that casual
storage styles and it's it's Relatively or very fast it can support detection of blank files blank tiles and you have the option to Store tiles given different layouts so you can reuse existing caches that you have available from other servers
So it's by default it's going to use the layout used by the what tile cache created But you can also read caches created by ArcGIS Well wind or you can supply your own templates and to store given the given XYZ
And the Congress it's difficult to manage that large number of files you it's difficult to get statistics about how much Bases occupied by those files. It's difficult to copy them from one place to the other You hit file system limits depending on the file systems, of course, but in the usual case you run out of inodes
You run into too many files per directory, whatever and You may also waste storage space given the file system block size, so if you have a block size of Four twelve kilobytes and you're storing a 128 byte tiled and you still have four kilobytes that are occupied by that time
It supports SQLite caches. So this is just storing the The tile data as a blob in an SQLite database with the XY and Z columns so the pros about this Backend is that it's a single file that's going to contain all your tile cache
It's easy to copy move over to another server You can extend it to support any Schema you want well Supposing it stores data as a blob and you have XYZ columns
So If you have existing SQLite files with tiles in them, you can just plug map cache into it and it'll read the tiles from it and it's efficient in disk space in the sense that Only the space actually occupied by the tile is going to be taken on the file system
the cons about this Backend is that you may need some tweaking to do Pass advanced variables to ask you light when you're creating databases when you have more than one terabyte of data Don't remember. What's the exact limits? for that one, that's around one terabyte, I think and
Another problem is that SQLite is isn't designed to handle multiple insertions concurrently Which means if you have multiple map cache instances that are trying to push tiles inside the cache There's a lock on the database and you slow down the insertions very noticeably It supports
third-party memcache server as a backend, so memcache is For storing and transient data, it won't resist the reboots Ideal for a temporary data which for forecasts for census Whatever data is only valid for a limited amount of time or that can be easily recomputed
The Pros of this these cache backends is that you can distribute the load between your different map caches instances and memcache server and memcache will do automatic pruning for you of your caches So it's the the tiles that haven't been used for some time will get pushed out of the cache
To leave more room for the new tiles coming The cons is that as its memory based Storage that you have a limited storage available and as you have very deep pockets for lots of RAM due to caches
Cache that's used only for For raster data in JPEG. It's specialized to store satellite imagery So it's going to store the image tiles directly inside a tiff file and map cache will read inside this tiff file for the for the encoded data
You can choose to store Given number of tiles per tiff file so if you're storing two thousand by two thousand tiles and you're storing four million tiles inside one tiff file and Reducing the number of files you have to store in the file system by that factor. So It allows you to
Either create those stiff files by third-party service as long as it's aligned to the grids you're using And To determine and it's greatly reduces the number of fires you have to store in the file system The limitations of this back end is that it's
Limited to JPEG data so you can store images with the transparency or PNG data only JPEG. That's the limitation of the tiff file itself You can't write concurrently to a single tiff file. So there's a big lock around the writing operation so you know two processes right to the same tiff file and That if you're doing updates or deletions inside the tiff file
Then the tiff library won't reclaim the space that you've that you've removed from time So if you're doing lots of updates, and that's not the format to use your tiff file will continue to grow and grow This is a new cache that's added to the version that's coming out
Caches to store tiles on third parties a server that supports rest protocol. So it's simple Get put and delete on a URI By itself this probably wouldn't be very useful but It comes in handy because they are
authorization hooks To hook into popular cloud storage providers so you can if you have a cloud Credentials you can start out to s3 micro surface your and Google cloud storage for your tires Once you're storing your tiles in there, there's a cost-benefit ratio to
Take into account, of course because storage is not free on those services And you have to understand that you usually have to Run your map cache instance inside the same infrastructure as the caches themselves Given that
You have bandwidth costs to take into account. So you don't want to pay the bandwidth between your s3 storage and your server Yeah, that's it And unless Of course unless you have a fully seeded cache in which case you can just point them to the URLs of your your rest
endpoints Usually it's needed with a with a map cache instances running on EC2 basically There's a seeder that's that's shipped with map cache. So the process of seeding is just pre generating tiles
At one point so they are available. That's high performance Until then after that So the seeder is a multi-threaded or multi-process, which means you can have multiple instances running at the same time to if you to
Take advantage of multiple WMS servers or multiple CPUs on the map cache instances It works in drill down mode, which means to take advantage of the the file system caches on the WMS server So instead of just looping through the tiles by XYZ Naively it's all drilled down. So you're always staying in the same area of data on the WMS server
Usually you speed things up a lot You can seed a subset of your tile sets if that's what you want only for a given dimension you can regenerate old tiles that are older than a given date if you know that
From one dates Backwards you need to regenerate You can restrict to the zoom levels You want to seed or the extent and you can also restrict to arbitrary geometries with the OGR Expression syntax to extract the geometry. So basically you can say, okay
I want to seed level 18 on the polygons where my population density is Is bigger than a given value to pre generate where people actually are going to be using your service And there's also a pruning mode which will allow you to delete tiles. That's also match these given criterias. I
Talked about dimensions for this either just going to talk about dimensions here So basically for a tile set you can store multiple versions of the image data Typically if you think of forecast data Then you have a date for a forecast and then you want to store the tiles for a given date
For forecast actually you have two dates you have the dates when the forecast has been made and the date for which the forecast is valid So this is supported You can other typical dimension could be a client ID if you need to create time sets that are different and restricted by Extents for a given client ID or for elevation for temperature maps, whatever
Dimensions can be expressed as allowed values intervals Typically for that would be for elevation or just a regular expression that was that must match We've also added support for time dimension
In the case where you have An external database that provides you the available timestamps that you can serve You can either pass an interval So start time and end time to map cache and it will assemble the tiles that correspond to that interval
so that can either be done horizontally if you base if in the case of satellite images where you have Multiple scenes and you want to create a mosaic of all the images that have been created in 2013 Maybe for example, or it can also be What's coming next?
Is an animation so you could animate also with creating an animated gif Your tile over time For that to work you must supply a database of the available timestamps because what you get as an input is just an interval so you have to know which are the
individual values that correspond to that interval Future work that's Things that are in the pipes for upcoming versions Maybe native Google sources, so we don't have to go through WMS servers. Just read directly from Google from the raster data
Advanced cache management so that would be failover caches or redundancy if tile isn't present in a cache then look into another one or If a cache backend failed and use a backup cache Backend
Or Be able to move cache and tiles from one cache one slow cache to a faster one so move from file base caches to mem caches and Last point also that needs to be addressed rather rapidly is being able to store more than just image tiles but vector tiles open either you Jeff
grids or An upcoming vector tile spec and I'm over now. So if you have any questions I have two questions like the first one is about the duty of cash
This is this similar to the G dollar ado command where you add like overviews to to file It doesn't support overviews for now. It's only suppose so you'd have to create one if hierarchy per level presume level but it's if you create a tile tiff, so if you pass the LCO tile equals yes and
Compression equals JPEG. That's when it's going to be used. Okay second one was about the You know in the cedar You know I used a tile cache and I was also a proxy and this type of proximity problem does some of the
requesting a tile from remote WMS it didn't handle any errors and with met proxy you could have a configuration where it would redo the Request again when that failed is anything available in that cache
I think there's some code that went in to be able to Resume the ceiling after an error so you can start off from where the error happened So so it'll fail in that case and Once you fix your WMS server, it's a restart from where it stopped
Okay Thanks Seeding by geometry will use the bounding box of the geometry or actual clipping of tiles which would intersect it the actual clipping
And another one vertical assembly what kind of mixing options are available just plain old screen multiply that sort of deal Only screen. Okay. Yeah, I think I think other compositing options might make sense
The cedar is multi-threaded but Which back end do you recommend for doing multi-threaded seating since a lot of them do lock on the back end so Well, not ask you lights in any case Then cash would probably work well in that case and well
I'd like to investigate into Modifying the cedar so you can push tiles to the back end in a single thread That could be another option also any other questions. All right. Thank you