From f019f346014df4d119fde855b1abf84e04b3dd7d Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Wed, 1 Apr 2015 15:04:56 +0200 Subject: [PATCH] Mapnik renderer configuration not part of the `renderer` root configuration - All configuration must be moved into `renderer.mapnik` - see `config/environments/*.js.example` for reference --- NEWS.md | 2 + config/environments/development.js.example | 44 +++++++++++++++++++++- config/environments/production.js.example | 44 +++++++++++++++++++++- config/environments/staging.js.example | 44 +++++++++++++++++++++- config/environments/test.js.example | 44 +++++++++++++++++++++- lib/cartodb/server_options.js | 1 + 6 files changed, 171 insertions(+), 8 deletions(-) diff --git a/NEWS.md b/NEWS.md index 9b2ea413..2d4f35ec 100644 --- a/NEWS.md +++ b/NEWS.md @@ -24,6 +24,8 @@ Announcements: - scale_factor * Affected tables for x-cache-channel will use direct connection to postgresql * Removes some metrics: authorized times ones + * Mapnik renderer configuration not part of the `renderer` root configuration + - All configuration must be moved into `renderer.mapnik`, see `config/environments/*.js.example` for reference - Removes rollbar as optional logger diff --git a/config/environments/development.js.example b/config/environments/development.js.example index d04ddf01..2fed947d 100644 --- a/config/environments/development.js.example +++ b/config/environments/development.js.example @@ -84,9 +84,49 @@ var config = { ,renderer: { // Milliseconds since last access before renderer cache item expires cache_ttl: 60000, - metatile: 4, - bufferSize: 64, statsInterval: 5000, // milliseconds between each report to statsd about number of renderers and mapnik pool status + mapnik: { + // The size of the pool of internal mapnik renderers + // Check the configuration of uv_threadpool_size to use suitable value + poolSize: 8, + + // Metatile is the number of tiles-per-side that are going + // to be rendered at once. If all of them will be requested + // we'd have saved time. If only one will be used, we'd have + // wasted time. + metatile: 2, + + // Buffer size is the tickness in pixel of a buffer + // around the rendered (meta?)tile. + // + // This is important for labels and other marker that overlap tile boundaries. + // Setting to 128 ensures no render artifacts. + // 64 may have artifacts but is faster. + // Less important if we can turn metatiling on. + bufferSize: 64, + + // SQL queries will be wrapped with ST_SnapToGrid + // Snapping all points of the geometry to a regular grid + snapToGrid: false, + + // SQL queries will be wrapeed with ST_ClipByBox2D + // Returning the portion of a geometry falling within a rectangle + // It will only work if snapToGrid is enabled + clipByBox2d: false, // this requires postgis >=2.2 and geos >=3.5 + + limits: { + // Time in milliseconds a render request can take before it fails, some notes: + // - 0 means no render limit + // - it considers metatiling, it naive implementation: (render timeout) * (number of tiles in metatile) + render: 0, + // As the render request will finish even if timed out, whether it should be placed in the internal + // cache or it should be fully discarded. When placed in the internal cache another attempt to retrieve + // the same tile will result in an immediate response, however that will use a lot of more application + // memory. If we want to enforce this behaviour we have to implement a cache eviction policy for the + // internal cache. + cacheOnTimeout: true + } + }, http: { timeout: 2000, // the timeout in ms for a http tile request proxy: undefined, // the url for a proxy server diff --git a/config/environments/production.js.example b/config/environments/production.js.example index 85408685..3adc127e 100644 --- a/config/environments/production.js.example +++ b/config/environments/production.js.example @@ -78,9 +78,49 @@ var config = { ,renderer: { // Milliseconds since last access before renderer cache item expires cache_ttl: 60000, - metatile: 4, - bufferSize: 64, statsInterval: 5000, // milliseconds between each report to statsd about number of renderers and mapnik pool status + mapnik: { + // The size of the pool of internal mapnik renderers + // Check the configuration of uv_threadpool_size to use suitable value + poolSize: 8, + + // Metatile is the number of tiles-per-side that are going + // to be rendered at once. If all of them will be requested + // we'd have saved time. If only one will be used, we'd have + // wasted time. + metatile: 2, + + // Buffer size is the tickness in pixel of a buffer + // around the rendered (meta?)tile. + // + // This is important for labels and other marker that overlap tile boundaries. + // Setting to 128 ensures no render artifacts. + // 64 may have artifacts but is faster. + // Less important if we can turn metatiling on. + bufferSize: 64, + + // SQL queries will be wrapped with ST_SnapToGrid + // Snapping all points of the geometry to a regular grid + snapToGrid: false, + + // SQL queries will be wrapeed with ST_ClipByBox2D + // Returning the portion of a geometry falling within a rectangle + // It will only work if snapToGrid is enabled + clipByBox2d: false, // this requires postgis >=2.2 and geos >=3.5 + + limits: { + // Time in milliseconds a render request can take before it fails, some notes: + // - 0 means no render limit + // - it considers metatiling, it naive implementation: (render timeout) * (number of tiles in metatile) + render: 0, + // As the render request will finish even if timed out, whether it should be placed in the internal + // cache or it should be fully discarded. When placed in the internal cache another attempt to retrieve + // the same tile will result in an immediate response, however that will use a lot of more application + // memory. If we want to enforce this behaviour we have to implement a cache eviction policy for the + // internal cache. + cacheOnTimeout: true + } + }, http: { timeout: 2000, // the timeout in ms for a http tile request proxy: undefined, // the url for a proxy server diff --git a/config/environments/staging.js.example b/config/environments/staging.js.example index d8e186b8..4c5fef84 100644 --- a/config/environments/staging.js.example +++ b/config/environments/staging.js.example @@ -78,9 +78,49 @@ var config = { ,renderer: { // Milliseconds since last access before renderer cache item expires cache_ttl: 60000, - metatile: 4, - bufferSize: 64, statsInterval: 5000, // milliseconds between each report to statsd about number of renderers and mapnik pool status + mapnik: { + // The size of the pool of internal mapnik renderers + // Check the configuration of uv_threadpool_size to use suitable value + poolSize: 8, + + // Metatile is the number of tiles-per-side that are going + // to be rendered at once. If all of them will be requested + // we'd have saved time. If only one will be used, we'd have + // wasted time. + metatile: 2, + + // Buffer size is the tickness in pixel of a buffer + // around the rendered (meta?)tile. + // + // This is important for labels and other marker that overlap tile boundaries. + // Setting to 128 ensures no render artifacts. + // 64 may have artifacts but is faster. + // Less important if we can turn metatiling on. + bufferSize: 64, + + // SQL queries will be wrapped with ST_SnapToGrid + // Snapping all points of the geometry to a regular grid + snapToGrid: false, + + // SQL queries will be wrapeed with ST_ClipByBox2D + // Returning the portion of a geometry falling within a rectangle + // It will only work if snapToGrid is enabled + clipByBox2d: false, // this requires postgis >=2.2 and geos >=3.5 + + limits: { + // Time in milliseconds a render request can take before it fails, some notes: + // - 0 means no render limit + // - it considers metatiling, it naive implementation: (render timeout) * (number of tiles in metatile) + render: 0, + // As the render request will finish even if timed out, whether it should be placed in the internal + // cache or it should be fully discarded. When placed in the internal cache another attempt to retrieve + // the same tile will result in an immediate response, however that will use a lot of more application + // memory. If we want to enforce this behaviour we have to implement a cache eviction policy for the + // internal cache. + cacheOnTimeout: true + } + }, http: { timeout: 2000, // the timeout in ms for a http tile request proxy: undefined, // the url for a proxy server diff --git a/config/environments/test.js.example b/config/environments/test.js.example index 9032752e..49527c4e 100644 --- a/config/environments/test.js.example +++ b/config/environments/test.js.example @@ -78,9 +78,49 @@ var config = { ,renderer: { // Milliseconds since last access before renderer cache item expires cache_ttl: 60000, - metatile: 4, - bufferSize: 64, statsInterval: 5000, // milliseconds between each report to statsd about number of renderers and mapnik pool status + mapnik: { + // The size of the pool of internal mapnik renderers + // Check the configuration of uv_threadpool_size to use suitable value + poolSize: 8, + + // Metatile is the number of tiles-per-side that are going + // to be rendered at once. If all of them will be requested + // we'd have saved time. If only one will be used, we'd have + // wasted time. + metatile: 2, + + // Buffer size is the tickness in pixel of a buffer + // around the rendered (meta?)tile. + // + // This is important for labels and other marker that overlap tile boundaries. + // Setting to 128 ensures no render artifacts. + // 64 may have artifacts but is faster. + // Less important if we can turn metatiling on. + bufferSize: 64, + + // SQL queries will be wrapped with ST_SnapToGrid + // Snapping all points of the geometry to a regular grid + snapToGrid: false, + + // SQL queries will be wrapeed with ST_ClipByBox2D + // Returning the portion of a geometry falling within a rectangle + // It will only work if snapToGrid is enabled + clipByBox2d: false, // this requires postgis >=2.2 and geos >=3.5 + + limits: { + // Time in milliseconds a render request can take before it fails, some notes: + // - 0 means no render limit + // - it considers metatiling, it naive implementation: (render timeout) * (number of tiles in metatile) + render: 0, + // As the render request will finish even if timed out, whether it should be placed in the internal + // cache or it should be fully discarded. When placed in the internal cache another attempt to retrieve + // the same tile will result in an immediate response, however that will use a lot of more application + // memory. If we want to enforce this behaviour we have to implement a cache eviction policy for the + // internal cache. + cacheOnTimeout: true + } + }, http: { timeout: 2000, // the timeout in ms for a http tile request proxy: undefined, // the url for a proxy server diff --git a/lib/cartodb/server_options.js b/lib/cartodb/server_options.js index e7f8b855..f3f3e3bd 100644 --- a/lib/cartodb/server_options.js +++ b/lib/cartodb/server_options.js @@ -70,6 +70,7 @@ module.exports = function(redisPool) { statsInterval: rendererConfig.statsInterval }, renderer: { + mapnik: rendererConfig.mapnik, http: rendererConfig.http }, redis: global.environment.redis,