commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Smuts <ASm...@therealm.com>
Subject RE: [simplestore] enhancements (was: [simplestore] inital che ck in)
Date Thu, 17 Jan 2002 20:40:10 GMT


> -----Original Message-----
> From: Juozas Baliuka [mailto:baliuka@mwm.lt]
> Sent: Thursday, January 17, 2002 8:17 AM
> To: Jakarta Commons Developers List
> Subject: RE: [simplestore] enhancements (was: [simplestore] inital check
> in)
> 
> 
> >Maybe I understand you wrong, but look at this:
> >In the Cocoon project we have 2 stores a) MRUMemoryStore for quick access
> >and b) JispFilesystemStore for -well- swapping. Why? Because we
> store/cache
> >generated data (xml -> xslt -> html or fop or ...) in the cache.
> Generating
> >this data is very expensive.
> 
> 
> 
> Ok, but it is not memory management, it is optimization for generation.

It is reference management.  


> Storing cache to disk has this
> disadvantage :
>   if(memory.isLow()){
> // if  method "isLow()" correct your cache is in disk, OS did this.
> // else if method "isLow()" is incorrect next has no meaning.
>     store.flushToDisk();
> 
> }
> void flushToDisk(){
> 
>    save(memory);// if method "isLow()" was correct you loaded cache from
> disk to memory here , OS did this.
> 
> }
> You must find alternative way to Optimize generation, not memory
> management.
> 
> I use this way to optimize generation :
> 
> Generate content directly to stable storage if don't have it on memory and
> in disk:
> 
> SomeStream getContent(Something id){
> 
>   Content c = find(id);
>   if(  c != null  )return c.openStream();
> 
> Content c = generateToStorageFirst(id);
> //cache to memory if possible, if your generation is very expensive and
> your going to copy it to Socket at last,
> // generating content to disk seems very fast :)
> 
>   return c.openStream();
> 
> }
> 
> //Optimization is in find
> 
>   Content find( Something id){
> 
>    Content c =  findInMemoryCache(id);
> 
>   if (c != null )return c.openStream();
> 
>   return findInSomeStorage();
> 
> 
> }
> 
> Content generateToStorageFirst(Something id){
> 
>    Content c = generate(id);
>     if(!c.isVeryLage()){
>                     cache(c);
> }
>   return c;
> }
> // constant for the same content;
> bolean isVeryLarge(){
> 
> // if very lage, it can be faster to generate, large memory block
> allocation is very expensive.
> 
>   return   lenght >   ( totalVirtulMemorySizeForJVMis4GBon32bitOS/
>                    ConstantCanBeTested )  *
> CanBeTestedAppDependantConstant;
> 
> 
> }
> 
> It is very possible to design it better , but this must be more clear read
> here.
> You never need method "isLow()" it has no meaning, because it is
> impossible
> to implement.
> if application says  "low" it does not mean it is true for JVM, if JVM
> says  "low" it does not mean it is true for OS.
> if OS never says this for JAVA application. If you have two applications
> on
> your machine "isLow" for OS has no
> meaning in your application, It will not help for OS to move Virtual
> Memory, or application and OS will do it both.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-
> help@jakarta.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message