ThinkGeo.com    |     Documentation    |     Premium Support

Map Loading Performance improvement

Hi,
Any one clearly explain me about 'How can we perfectly rendering map. I mean, for fast rendering which things needs to be maintained.

We am using a Map with One AdornmentOverlay(GraticuleAdornmentLayer) and lots of CustomOverlays(InMemoryFeatureLayer,ShapeFileFeatureLayer,GdiPlusRasterLayer).
We are not using any Markers.

One more thing, We are are also using WrapDateLine to all overlays.

These all things we felt map loading slowing down.

Please explain me, some major factors we needs to set for improving map rendering.

Thanks,
Riyaz

Hi Riyaz,

I guess the most performance problem is from GraticuleAdornmentLayer and your wrapdateline, could you please did a quickly test to make sure which effect takes too much source? You can compare the load speed before and after comment one function, and log the load time by code.

For other layer I think the server cache and client cache should be helpful.

Regards,

Ethan

Hi Ethan,
1. I just removed wrap dateline and replace GraticuleAdornmentLayer with GraticuleFeatureLayer.
2. One major thing, we did all the functionality in client side with client side render. For that we have to add all overlays(around 50-60) at Load time.it’s taking some more time on loading the Page.
Problem is we can’t add the Overlay in client side. we just redraw it. I cross checked with your forum and samples. I didn’t get much code for adding overlay in client side. So please advice me is possible to add overlay to a map in client side.
3. Can you please give me code for handling Layers by server cache and client cache.

Thanks,
Riyaz

Hi Riyaz,

I think you maybe misunderstand the overlay here. Overlay only exist in server side, because in client side each overlay will be rendered as a OpenLayers layer, and each layer contains about 20 tiles (related with the screen size). So if you have 50~60 server side overlay, that means you have at least 50 x 20 = 1000 tiles need be rendered at the same time. That’s why your performance is not well.

So I think the best solution is reduce the overlay number.

And add layer in client side is not helpful, the layer which can be added in client side is something like Google or Bing layer, they get source from internet but not from your server, and in fact you add them via OpenLayers api. The other type layers(server overlay) cannot be added in client side.

In fact the server side whether works related with your data source, if some data takes a lot of source, the server side cache can save the time.

Client cache should be set in overlay level, for example:
Map1.StaticOverlay.ClientCache.CacheId = “Test Cache”;
Map1.StaticOverlay.ClientCache.Duration = new TimeSpan(2, 0, 0, 0);

Wish that’s helpful.

Regards,

Ethan

Hi Ethan,

           I am using Custom Overlays. if we set client cache to Static Overlay. it will apply for all the Map contents or not. Or else I need to apply tile cache for all Custom Overlays.

I am applying TileType to SingleTile in Base Map(Countries02.shp) Overlay. But not for All Overlays.
Code:
LayerOverlay worldOverlay = new LayerOverlay(“World Map”, false, TileType.SingleTile);

Please suggest clear thing about tile cache.we are facing performance issue on loading,panning and zoom in/out.

Thanks,
Riyaz

Hi Riyaz,

My sample only shows how to set the client cache. You can set the client cache for each overlay, and add them into the customOverlays.

For example:

            LayerOverlay worldOverlay = new LayerOverlay("World Map", false, TileType.MultipleTile);
            worldOverlay.ClientCache.CacheId = "Test Cache";
            worldOverlay.ClientCache.Duration = new TimeSpan(2, 0, 0, 0);

And I think cache is useful for the MultipleTile mode, please choose this mode if target overlay need set cache.

Regards,

Ethan

Hi Ethan,
1. Client Cache can we apply for all custom overlays including graticule feature layer. if the layer having different styles basing on zoom levels then also we can apply Client Cache for that overlay.

          2 . Cache Id should be different for all the Overlays and Idle Duration will be 2 days for cache data.
          3. Already I mention that, we are All Overlays(50~60) in Load, I think because of that Loading(rendering) time increasing even panning and zoom in also. For fixing this issue any other solution there. We cant remove all overlays in Load.

          4. We add one Layer on Overlay and Layer/Overlay making visible false/true. If layer/overlay is in visible off mode, then panning and zoom in functionality could not be effect right?

I mean Performance of Map should be fine right? That Overlay not redraw on Visible off mode right?

Thanks,
Riyaz

Hi Riyaz,

  1. The client cache in fact is the tile image which is saved in browser cache, you can try to set it for each of your overlay and see whether it works.

  2. You can set that follow your requirement.

  3. If you cannot reduce the overlay number, the first time the tile request time cannot be saved, I think we don’t have other solution for it.

  4. If the overlay is invisible, it shouldn’t sent request and render by browser, you can check it in browser network monitor.

Wish that’s helpful, if I missed any point please let me know.

Regards,

Ethan

Hi Ethan,
We set client cache, map rendering performance is increased. Can we possible to set both Client and Server cache for improving further.

Thanks,
Riyaz

Hi Riyaz,

I think you can try that, the server cache should be helpful for performance.

Regards,

Ethan

Hi Ethan,
Thanks for your reply.
Can you please provide me some sample code for ‘Server Cache’. it will helpful for me to achieve it.

Thanks,
Riyaz

Hi Riyaz,

I found an old topic about that: http://community.thinkgeo.com/t/using-cache-in-map-suite-web-edition-3-0/7658

Something changed from v3 to v10, but I think the ServerCache work for overlay hadn’t changed, you can set it for the overlay you used.

Regards,

Ethan

Hi Ethan,

I applied ClientCache and ServerCache. Client Cache is working fine, where as I didn’t feel much performance improve.

In ServerCache, the performance surely improved. But there are two problems.

  1. Tiles are not clearing whenever functionality on/off. I think problem there in CacheDirectory path.

  2. And one more problem we are facing is Basemap background colors… Actually we have 3kinds of basemaps in our application. 1. Light mode, 2. Dark mode, 3. Open street map

In light and dark mode we have countries shape file with different colors. I hope u will understand. And open street map as usual.

Problem is when 2 different users using the application with different base map (One user with light mode. And another with Dark mode) we are getting mixture of both colors… I think because of this Tile cache… So how can we resolve this issue… Please give me some solution.

ServerCache Code:
lo.ServerCache.CacheId = “AllOverlays”;
lo.ServerCache.CacheDirectory = Server.MapPath(".") + @"/ServerTileCache";

Thanks,
Riyaz

Hi Riyaz,

If you have 3 different types background map, that means maybe you need 3 different group cache.

You can parse the background mode from client, and set the different “CacheId” to make the cache point to different path.

Wish that’s helpful.

Regards,

Ethan

Hi Ethan,

I think we have already tried this in my code, but we used different UserIDs … But the result was same problem…

Actually i didn’t understand your points “you need 3 different group cache” and " set the different “CacheId” to make the cache point to different path".

Can u please give me a sample code… It will be more helpful.

Thanks,
Riyaz

Hi Riyaz,

In fact our CacheID is used for split different group cache, you can think it’s the sub-folder-name. For example:

lo.ServerCache.CacheDirectory = Server.MapPath(".") + @"/ServerTileCache";

lo.ServerCache.CacheId = “Light”;

Then this group tile will be saved in this folder: …/ServerTileCache/Light/…

And lo.ServerCache.CacheId = “Dark”;

The tiles will be saved in …/ServerTileCache/Dark/…

So if you can get mode from request, you can set the cache id to different group.

Because your scenario is complex, so I cannot build a simple sample for that, but I think you can quickly try this solution and view your server folder to check whether it works.

Regards,

Ethan

Hi Ethan,

            Thanks for suggestion, it's work out.

Regards,
Riyaz

Hi Riyaz,

Thanks for your update.

Regards,

Ethan