commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juozas Baliuka <bali...@mwm.lt>
Subject RE: [simplestore] enhancements (was: [simplestore] inital check in)
Date Thu, 17 Jan 2002 13:56:37 GMT

It is very possible there are a lot of "Memory optimizers" in Container: 
Tomcat, JBoss, Cocoon, MyApplication,
YourApplication and all of them have "Background Cleanup".
I believe you understand me.


At 02:16 PM 1/17/2002 +0100, you wrote:

>>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. 
>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>



--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message