Message-ID: <535246933.3061.1422378029864.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_3060_1757040690.1422378029864" ------=_Part_3060_1757040690.1422378029864 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This page documents my Google Summer of code project "Cachi= ng Data in uDig". You can read my projet proposal at http://rochecrg3.scg.ulaval.ca/crg/dev/soc07/udig.=20
Here I will try to keep track of ideas, development notes and work progr= ess.=20
First I propose some user stories, in which I dumped first ideas. I borr=
owed ideas from Andrea's : =
I will update these stories as work goes on, an= d I get a better idea of the needs.
Datastore caching should allow to wrap transparently any other
Dat= astore (ie. the source Datastore) and leverage related subsequent
Datastore cache acts as buffer between the client and the actual
s= ource Datastore. It may be persistent over client sessions.
The maximum capacity can be set by the user.=20
Can we propose a general framework for arbitrary data caching ?
Ra= ster and vector data models API are not unified in Geotools.
One issue is the way features are retrieved from Datastore : a
Dat= astore usually receives a Query, and features are not retrieved by
id= . Slightly different queries will yield a common set of features.
What we will store are features, rather than query results.=20
But we need to track queries, and some kind of relationships with
= result features. How do we want to remember previous queries ? What
r= elationships with features do we keep track of ?
First, we suggest we keep track of queries spatial bounds and keep a
spatial index of the cached features.
What type of queries the cache should leverage ?=20
Other queries may require to keep other indices of features (but this
way it will be possible to implement specialized cache for performance<= br /> sensitive operations. This is an extension mechanism we should take care to provide.)
Cache should delegate unhandled queries to source Datastore. Two step
query of the datasource may be used :
1. get fid list from datasource
2. get features by fid that the ca= che doesn't already hold.
We will have to check this is performance-wise, but at least this will save bandwidth when working with remote datastore.=20
Feature is not Serializable.=20
We have to find some way to serialize data represented by features.= =20
What if Datastore schema changes ?=20
What if cache get out of sync with source datastore ? How do we detect t= his ?=20
When the cache is full, it must make room for new data. We will have
to define an eviction strategy for feature cache and index (or
In the low bandwidth scenario, data may be best copied from the source s= erver and distributed using CD-ROM or DVD-ROM. Clients would appreciate to = download only updates from the server, so they will still be able to displa= y up-to-date data.=20
We would like to set up a datastore that can connect to two (or more ?) = source datastores which store the same features, but possibly different ver= sions. For example, one of the datastore would be a local storage, with goo= d performance access, but holding data frozen at time t. The other datastor= e would represent a remote server.=20
The multisource datastore would then retrieve features :=20
It should be able to ask the remote store for what features have been mo= dified, and update the local store.=20
Since we have to know if the original data has changed since time t, thi=
s service seems not be possible without some kind of data versioning system=
This could involve a sequential checkout (based on spatial extent) = from a versioned remote datastore.
This is the scenario where a client has a local copy of a data source an= d wants to download updates from the original source. The local copy is use= d to initialize the cache, and client asks for updates to the remote source= , and updates cache (or local copy).=20
See also :=20
In the low or no bandwidth scenario, users may want to edit locally the = data, and commit modifications when possible.=20
Data cache using persistent storage will allow clients to carry on work = when disconnected.=20
At commit time, the original data may have been modified by another clie= nt. This is a well-known issue of concurrent modifications=20
The initial goal is to allow client|application to cache data when query= ing remote sources, and make disconnected mode possible. Handling asynchron= ous updtaes is a plus.=20
In this section, I try to detail deliverables and scope of intended work= .=20
1. in-memory data cache, read-only=20
The most simple scenario.=20
I will propose an extensible framework for DataCache.
I will propo= se a test framework to assess DataCache functionalities.
I will test = different implementation of DataCache against MemoryDataStore, the referenc= e implementation of DataStores. Different implementations include testing d= ifferent types of spatial indices.
2. client demo using cache=20
A demo would be nice to appreciate the actual benefits of DataCache.= =20
First, I can think of a very simple client - use JMapPane, with two pane= s (cached, control) to visually compare rendering times ?=20
Second, I can try a demo using uDig (adding programmatically a cached Da= taStore to catalog).=20
3. persistent data cache (disk storage), read-only=20
Extension of 1 to disk-based data cache.=20
I will consider using Hsql DataStore as cache backend - but I don't know= if plugin is mature enough to be used (ask Jody ?). Think of other solutio= ns ?=20
I will also consider serializing features to byte arrays and using http://research.att.com/~marioh/spatialindex/ spatia= l index framework.=20
Different types of DataCache might be chained : typically=20 =20
Cache must be initializable from its storage.=20
4. Write-through data cache=20
Simple handling of edits, where cache behaves as if there was no cache o= n edits.=20
5. Write-back data cache, assuming DataStore handles nicely version conf= licts, ie the cache does not take care about version issues and commit conf= licts=20
6. - OPTIONAL - sequential updates=20
We assume client has some way to identify the version of the copy of the= source it currently has.=20
Versioning is beyond the scope of the intended work, because it may take=
us real far.
But we propose to try some experiments
This could involve setting up a web service (server-side), which := =20
I can also test ideas using Geoserver versioned WFS (based on Andrea pos= tgis versioned DataStore)=20
7. - OPTIONAL - propose uDig implementation of connected/disconnected mo= de=20
I would be glad to have time to achieve this, but can't figure out what = is the required work and how much time it will need.=20
Next things I am planning to work on, unordered for the time being := =20
The sequence to query the cache I have actually implemented is=20 =20
User has to wait for all these operations to terminate, whereas he could= get at least a first anwer from the cache. Using threads, we can imagine t= his other sequence :=20 =20
Most of the cache behavior should be under control of the query tracker,=
which knows the known parts of the universe and may record how often each =
part of the universe is accessed.
We can't remember every query, but = we can idealize or normalize them by expanding each to a grid. Typically, a= tile will be a quadrant of a quadtree, and we approximate a query by the m= inimum containing quadrant.
We can attach to each quadrant :=20
On eviction, we pick a leaf quadrant, ie a quadrant that has no child, i= n the tree and make it invalid. Parent quadrants should be marked invalid o= r partial. When four quadrants in a quadrant are invalid, they should be re= moved from that quadrant, which reverts to a leaf. A leaf is always marked = partial, unless it has the lowest allowed level.=20
In order to find the leaf to evict, we traverse the tree by level, looki= ng for a quadrant that matches the criterium (for example, least recently u= sed). If found, we iterate from that quadrant. If not found, ie all quadran= ts at given level are equals according to the used criterium, we do an exha= ustive lookup of the lower level, and so on. If we have to exhaustively tra= verse many levels, this will be time consuming, and we may revert to random= eviction after a given number of levels traversed with no matches.=20
On look-up, given an input bbox query, we first search for the minimum c= ontaining quadrant. Then we test if that quadrant is valid and entire. If n= ot valid, we'll have to fetch this quadrant from the source store. If not e= ntire, we search for invalid inner quadrants. To minimize the number of qua= drants to fetch, each quadrant should yield less than a maximum number of q= uadrants, possibly depending on the level of the quadrant.=20
Some notes of the work being done through this Summer of Code project, a= nd report on progress.=20