[ka-Map-users] Performance problems
Pje
pjebra at gmail.com
Tue Feb 6 13:49:27 EST 2007
Thanks for the quickly reply.
About the options:
1) Unfortunately, I can't.
2) I tried to modify tile.php and kaMap.js to accept variable substituion.
The problem is:
- when an user select a vessel in my app and refreshes the map, the code of
these vessel is passed to tile.php. These code is used to construct the SQL
query. The problem is when the user select another vessel and unselect the
previous one. The tile is cached and the previous vessel will still be
there. I think I can't use any type of cache in this scenario, because every
time a vessel is selected and the user refreshes the map, a new SQL query
will be used (in the data section of my layer, e.g. data %sql%). So, the
cache will be useless.
3) I am using variable substituion because I can't have a layer for each
vessel (there will be more than 2000 vessels in the system). So, one layer
for each is impracticable. Also, these data is dynamic.
4) Maybe this is my only option, but I don't know where to start.
Sorry about any misunderstanding, english is not my native language.
On 2/5/07, Paul Spencer <pspencer at dmsolutions.ca> wrote:
>
> right, sorry I missed that detail. The only options you have are:
>
> 1) live with it (not good)
> 2) modify redraw so that it will accept variable substitution - the
> code is already in the no-cache case so redraw shouldn't be hard to add
> 3) change your app so you don't need to use variable substitution -
> may not be possible
> 4) fix the no-cache implementation so it doesn't cause a full
> metatile draw for every tile
>
> Cheers
>
> Paul
>
> On 5-Feb-07, at 8:42 AM, Pje wrote:
>
> > Hmm. But if I set tile_source to redraw I will can't use variable
> > substitution, right? Because variable substitution is only
> > implemented in tile_nocache.php
> >
> > On 2/5/07, Paul Spencer <pspencer at dmsolutions.ca> wrote: Pje,
> >
> > using no-cache is a "BAD THING" (tm). It causes the whole metatile
> > to redraw for every tile request. This is absolutely the worst case
> > performance.
> >
> > What you really want to do is use is something like:
> >
> > "tile_source" "redraw"
> > "redraw_interval" "150"
> > "refresh_interval" "300"
> >
> > This will cause the client to automatically re-request tiles every
> > 300 seconds (5 minutes) and the tiles will be considered stale and be
> > recreated every 150 seconds (2.5 minutes).
> >
> > This allows the tiles to be cached for 2.5 minutes so when a client
> > loads a tile, it only causes one map draw per metatile rather than a
> > map draw per tile. The tiles are time-stamped and when a request
> > comes in for a tile that is past the time allowed, it redraws the
> > cached tiles. The timestamp is done per-layer so that all the tiles
> > are synchronized.
> >
> > The refresh interval ensures that the layer is dynamically updated
> > even if the user does nothing.
> >
> > You can play with the times to get the desired effect and balance
> > your load, but you should find that this produces substantially
> > better results for you.
> >
> > Cheers
> >
> > Paul
> >
> > On 5-Feb-07, at 7:53 AM, Pje wrote:
> >
> > > Hi,
> > >
> > > I am having some problems with two layers that use tile_source
> > > "nocache".
> > >
> > > I am using it because these layers are respectively points sent by
> > > fishing vessels and areas. These points are sent at 5min intervals
> > > and the areas are inserted by the user. So, *i think* i can't use
> > > cache in this case.
> > >
> > > The problem is that the map is taking too much time to load. The
> > > points table in the database have 18.000 registers... and there
> > > will be a lot more. And there is about 18 areas.
> > >
> > > Also, I am using variable substitution in mapfile. My points layer
> > > is something like that:
> > >
> > > layer
> > > name "track"
> > > group "Track"
> > > connectiontype POSTGIS
> > > connection "dbname=xxx user=xxx password=xxx host=xxx port=5432"
> > > data "%data%"
> > > type line
> > > status on
> > > metadata
> > > tile_source "nocache"
> > > end
> > > class
> > > name "track"
> > > color 0 0 0
> > > end
> > > end
> > >
> > >
> > > When the user select some vessel, I do that using javascript:
> > >
> > > var map = myKaMap.getCurrentMap();
> > > var track = mapa.getLayer('track');
> > > track.replacementVariables = {vessel: id_vessel};
> > > track.redraw();
> > >
> > > The areas layer is using the same logic.
> > >
> > > So, there is a way to achieve that but with better perfomance? The
> > > performance was ok before I add these two layers. Any tips?
> > > _______________________________________________
> > > ka-Map-users mailing list
> > > ka-Map-users at lists.maptools.org
> > > http://lists.maptools.org/mailman/listinfo/ka-map-users
> >
> > +-----------------------------------------------------------------+
> > |Paul Spencer pspencer at dmsolutions.ca |
> > +-----------------------------------------------------------------+
> > |Chief Technology Officer |
> > |DM Solutions Group Inc http://www.dmsolutions.ca/ |
> > +-----------------------------------------------------------------+
> >
> >
> >
> >
> >
> > _______________________________________________
> > ka-Map-users mailing list
> > ka-Map-users at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/ka-map-users
>
> +-----------------------------------------------------------------+
> |Paul Spencer pspencer at dmsolutions.ca |
> +-----------------------------------------------------------------+
> |Chief Technology Officer |
> |DM Solutions Group Inc http://www.dmsolutions.ca/ |
> +-----------------------------------------------------------------+
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ka-map-users/attachments/20070206/c4eddbcf/attachment.html
More information about the ka-Map-users
mailing list