Re: Object Caching

From: Hans Pikkemaat (h.pikkemaa..si-solutions.nl)
Date: Thu Nov 12 2009 - 03:07:35 EST

  • Next message: Andrus Adamchik: "Re: Object Caching"

    Hi,

    So this means that if I use a generic query that the query results are
    always stored
    completely in the object store (or the query cache if I configure it).

    Objects are returned in a list so as long I have a reference to this
    list (because I'm
    traversing it) these objects are not garbage collected.

    If I use the query cache the full query results are cached. This means
    that I can only
    tell it to remove the whole query.

    Effectively this means I'm unable to run a big query and process the
    results as a stream.
    So I cannot process the first results and then somehow make them
    available for
    garbage collection.

    The only option I have would be the iterated query but this is only
    usefull for queries
    one 1 table without any relations because it is not possible to use
    prefetching nor is
    it possible to manually construct relations between obects.

    My conclusion here is that cayenne is simply not suitable for doing
    large batch wise
    query processing because of the memory implications.

    tx

    HPI

    Andrus Adamchik wrote:
    > As mentioned in the docs, individual objects and query lists are
    > cached independently. Of course query lists contain a subset of cached
    > object store objects inside the lists. An object won't get gc'd if it
    > is also stored in the query list.
    >
    > Now list cache expiration is controlled via query cache factory. By
    > default this is an LRU map, so as long as the map has enough space to
    > hold lists (its capacity == # of lists, not # of objects), the objects
    > won't get gc'd.
    >
    > You can explicitly remove entries from the cache via QueryCache remove
    > and removeGroup methods. Or you can use a different QueryCacheFactory
    > that implements some custom expiration/cleanup mechanism.
    >
    > Andrus
    >
    > On Nov 11, 2009, at 3:43 PM, Hans Pikkemaat wrote:
    >
    >
    >> Hi,
    >>
    >> I use the latest version of cayenne, 3.0b and am experimenting with
    >> the object caching features.
    >>
    >> The documentation states that committed objects are purged from the
    >> cache because it uses weak references.
    >> (http://cayenne.apache.org/doc/individual-object-caching.html)
    >>
    >> If I however run a query using SQLTemplate which caches the objects
    >> into the dataContext local cache (objectstore),
    >> the objects don't seem to be purged at all. If I simply run the
    >> query dump the contents using an iterator on the resulting
    >> List then the nr of registered objects in the objectstore stays the
    >> same (dataContext.getObjectStore().registeredObjectsCount()).
    >> Even if I manually run System.gc() I don't see any changes (I know
    >> this can be normal as gc() doesn't guarantee anything)
    >>
    >> What am I doing wrong? Under which circumstances will cayenne purge
    >> the cache?
    >>
    >> tx
    >>
    >> Hans
    >>
    >>
    >
    >

    -- 
    	TSi Solutions
    Neptunusstraat 25
    7521 WC Enschede
    

    Tel. +31 (0)88 - 25 00 000 Fax. +31 (0)88 - 25 00 122 Hans Pikkemaat Java Developer (Services Team) E-mail: h.pikkemaa..si-solutions.nl <mailto:h.pikkemaat@tsi-solutions.nl> www.tsi-solutions.nl <http://www.tsi-solutions.nl/> www.toeristiek.nl <http://www.toeristiek.nl/>

    10 jaar TSi Solutions ... marktleider in het automatiseren en outsourcen van werkprocessen in de reisbranche ... toonaangevende partij voor het verzamelen, structureren en beschikbaarstellen van reiscontent ... Reisrevue Innovatieveer 2008 - Veervolle vermelding ... Winnaar Reisrevue Innovatieveer 2009 ... Top 20 positie in 2008 Deloitte Technology Fast50 Nederland ... Top 10 positie in 2009 Deloitte Technology Fast50 Benelux ... genomineerd voor Technology 500 EMEA 2009 TSi Solutions is de handelsnaam van Travel Service International b.v.[KvK 06091935] DISCLAIMER: De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en de afzender direct te informeren door het bericht te retourneren. The information contained in this message may be confidential and is intended to be exclusively for the addressee. Should you receive this message unintentionally, please do not use the contents herein and notify the sender immediately by return e-mail.



    This archive was generated by hypermail 2.0.0 : Thu Nov 12 2009 - 03:08:17 EST