| 1 | = !MapGuide RFC 11 - Stateless Http GETTILEIMAGE request = |
| 2 | |
| 3 | This page contains an change request (RFC) for the !MapGuide Open Source project. |
| 4 | More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page. |
| 5 | |
| 6 | |
| 7 | == Status == |
| 8 | |
| 9 | ||RFC Template Version||1.0|| |
| 10 | ||Submission Date||5 January 2007|| |
| 11 | ||Last Modified||jasonbirch [[Timestamp]]|| |
| 12 | ||Author||Trevor Wekel|| |
| 13 | ||RFC Status||adopted|| |
| 14 | ||Implementation Status||completed|| |
| 15 | ||Proposed Milestone||1.2|| |
| 16 | ||Assigned PSC guide(s)||Bruce Dechant|| |
| 17 | ||'''Voting History'''||January 18, 2007|| |
| 18 | ||+1||Andy, Bob, Bruce, Haris, Jason, Paul, Tom|| |
| 19 | ||+0|||| |
| 20 | ||-0|||| |
| 21 | ||-1|||| |
| 22 | |
| 23 | == Overview == |
| 24 | |
| 25 | GETTILEIMAGE relies on the session repository to do its work. To improve tiled map performance and to facilitate external caching mechanisms like Squid, a new version of the operation should be introduced which does not require an MgMap object in the session repository. |
| 26 | |
| 27 | == Motivation == |
| 28 | |
| 29 | The session repository is a key component in MapGuide Server performance. Any reduction in load on this key component will improve overall system performance. The GETTILEIMAGE request only operates on the base map layers for a particular map. This means all of the dynamic layers (buffers, redlines, etc) added to a specific user's MgMap object in the session repository will not be involved in tile creation. |
| 30 | |
| 31 | As far as the tiles are concerned, only the base map layers in the original map definition are of interest. This information will be the same for all users of the map so there is no real benefit to using a unique session repository held MgMap instance for each user. |
| 32 | |
| 33 | The current GETTILEIMAGE Http op needs the session id to gain access to the session held MgMap object. This makes external cache implementations like Squid virtually impossible to use since the user's current scale is contained in the MgMap and not in the URL. |
| 34 | |
| 35 | == Proposed Solution == |
| 36 | |
| 37 | Implement version 2 of GETTILEIMAGE as follows: |
| 38 | |
| 39 | |
| 40 | OPERATION=GETTILEIMAGE |
| 41 | |
| 42 | |
| 43 | VERSION=2.0.0 |
| 44 | |
| 45 | |
| 46 | MAPDEFINITION=Library://NavteqNorthAmerica/Maps/nacolorTiled.MapDefinition |
| 47 | |
| 48 | |
| 49 | BASEMAPLAYERGROUPNAME=Base Layer Group |
| 50 | |
| 51 | |
| 52 | TILECOL=9079 |
| 53 | |
| 54 | |
| 55 | TILEROW=7440 |
| 56 | |
| 57 | |
| 58 | SCALEINDEX=1 |
| 59 | |
| 60 | |
| 61 | Most of the parameters are self explanatory. The SCALEINDEX parameter is the scale index for the tile set of interest. Tile set 0 corresponds to the most detailed scale defined in the MapDefinition. |
| 62 | |
| 63 | |
| 64 | Authentication information can be provided by any of the following but the first two methods should be preferred usage: |
| 65 | |
| 66 | |
| 67 | HTTP Basic Auth header information |
| 68 | |
| 69 | |
| 70 | USERNAME and PASSWORD request parameters |
| 71 | |
| 72 | |
| 73 | SESSION request parameter |
| 74 | |
| 75 | |
| 76 | Implement a new GetTile method for MgTileService. All of the parameters are identical so there will be minimal processing required by the Web Extensions to implement the HTTP operation. This method can also be used to programmatically pregenerate tile caches. |
| 77 | |
| 78 | |
| 79 | class MgTileService |
| 80 | |
| 81 | |
| 82 | { |
| 83 | |
| 84 | |
| 85 | virtual MgByteReader* GetTile( |
| 86 | |
| 87 | |
| 88 | MgResourceIdentifier* mapDefinition, |
| 89 | |
| 90 | |
| 91 | CREFSTRING baseMapLayerGroupName, |
| 92 | |
| 93 | |
| 94 | INT32 tileColumn, |
| 95 | |
| 96 | |
| 97 | INT32 tileRow, |
| 98 | |
| 99 | |
| 100 | INT32 scaleIndex) = 0; |
| 101 | |
| 102 | |
| 103 | } |
| 104 | |
| 105 | On the Server side, a cache of serialized MgMap objects will be maintained to respond to the new API. These objects will be deserialized and used when a tile has to be rendered. For previously cached tiles, the GetTile arguments are sufficient to construct a fully qualified file name so the MgMap object will not be used. This will reduce the load on the session repository and speed up tile serving for cached tiles. |
| 106 | |
| 107 | Two new serverconfig.ini parameters will be added to the TileService section: |
| 108 | |
| 109 | |
| 110 | [TileServiceProperties] |
| 111 | |
| 112 | |
| 113 | TiledMapCacheSize = 10 |
| 114 | |
| 115 | |
| 116 | RenderOnly = 0 |
| 117 | |
| 118 | A very simple cache management scheme will be introduced. When the TiledMapCacheSize is exceeded, all of the serialized MgMap objects will be dumped from the cache and rebuilt as requested. If a site has a large number of tiled maps, the TiledMapCacheSize should be set large enough to handle "typical" concurrency loads. An entry will be written to the Server logs when the cache size is exceeded to aid with tuning the cache size parameter. |
| 119 | |
| 120 | If a map's tile cache is cleared or it's MapDefinition changed, the corresponding MgMap serialized form will be removed from the cache. |
| 121 | |
| 122 | The RenderOnly parameter determines whether rendered tiles are written to disk. If set to "1", tiles will not be written to the MapGuide disk cache. This can be set to facilitate use of external HTTP caches like Squid. |
| 123 | |
| 124 | == Implications == |
| 125 | |
| 126 | The existing version 1.0.0 GETTILEIMAGE request will remain in existence. It should be deprecated in a future release. To make use of the new request, all of the Ajax viewers will be updated. This could break backward compatibility for users who have performed significant script customizations. They will be required to merge the changes into their existing scripts. The following viewer files will require a few lines of change: |
| 127 | |
| 128 | |
| 129 | ajaxmappane.templ |
| 130 | |
| 131 | |
| 132 | mapframe.php |
| 133 | |
| 134 | |
| 135 | mapframe.aspx |
| 136 | |
| 137 | |
| 138 | mapframe.jsp |
| 139 | |
| 140 | The new MgTileService::GetTile method will need to be documented. Since the documentation is autogenerated from the header files, there should be minimal documetation impact. |
| 141 | |
| 142 | == Test Plan == |
| 143 | |
| 144 | Visual testing with updated Ajax viewers will be performed. |
| 145 | |
| 146 | Multi-threaded load tests for both tile generation and tile rendering will be executed. |
| 147 | |
| 148 | == Funding/Resources == |
| 149 | |
| 150 | Autodesk |