Oh, I forgot to mention:

whichever scheme you choose (completely in memory, or partially in
memory + cached), the model api should be expressive enough that it
doesn't matter and you can change the model implementation later,
without needing to touch the controller code.

On Tue, Oct 17, 2006 at 10:53:12 +0200, Yuval Kogman wrote:
> Don't use a singleton. Instead, devise a Catalyst::Model api for
> your tree structure, so that you can do:
> 
>       $c->model("MyTree")->get_that_node($which);
>       $c->model("MyTree")->get_the_root_node;
> 
> or whatever.
> 
> You should probably pre-load this structure at setup time to get it
> to be shared between all the child processes, but if it grows too
> big to be pre-loaded you can have the tree lazily load itself using
> a cascade of caches.
> 
> Using Cache::Cascade you can keep a small (several tens or hundreds
> of objects) cached per child process, and a memcached for another N
> mb, and then the least popular nodes will be loaded from the DB, and
> stored in the cache only when they're actually used.
> 
> Essentially, what I'm saying is that $n MB is too large a structure
> to be useful for one cache entry. Scale it down, and divide it into
> smaller chunks, and then cache those if at all.
> 
> However, when $n is 10 and not 100 it should be enough to just
> preload it.
> 
> See also Devel::Size to check how much the structure really costs.
> 
> On Tue, Oct 17, 2006 at 10:44:48 +0200, [EMAIL PROTECTED] wrote:
> > Hi List,
> > 
> > in my current project i have to build a big tree-structure (every node
> > has a test-field, sum ~10MB) from a database.
> > The data doesn't change not very often, so i would like to preload it,
> > because building the tree is slow..
> > 
> > My qestion:
> > which way to "store" the tree? Should i build a "singleton"-class or
> > should i use memcached?
> > I allready use memcache in my app, so using it here again sounds good to
> > me. Will the massive objct-copying (on allmost every call!) be a
> > problem? (Again: ~25000 nodes with ~10MB data).
> > Maybe there is a complete different way i never thought about?
> > 
> > best regards a thanks for every hint :)
> > Matthias
> > 
> > 
> > 
> > _______________________________________________
> > List: [email protected]
> > Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> > Searchable archive: http://www.mail-archive.com/[email protected]/
> > Dev site: http://dev.catalyst.perl.org/
> 
> -- 
>   Yuval Kogman <[EMAIL PROTECTED]>
> http://nothingmuch.woobling.org  0xEBD27418
> 



> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/


-- 
  Yuval Kogman <[EMAIL PROTECTED]>
http://nothingmuch.woobling.org  0xEBD27418

Attachment: pgp48fi1SEP7Z.pgp
Description: PGP signature

_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to