You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Emmanouil Batsis <Em...@eurodyn.com> on 2004/11/02 12:28:26 UTC

[JXPath] Compiled Expressions Cache Impl? (was: Re: JXPath: Thread-Safe Behavior and Real-Time Applications)

Hi,

Dmitri Plotnikov wrote:

>JXPath maintains a global cache of those.  Since that cache is of limited size and is shared by all threads, the performance may suffer when all these threads start storing their load of XPaths in that cache. What I would recommend is disabling the automatic caching (for that there is a global variable on JXPathContextImpl) and maintain application's own cache of compiled expressions.
>

Thanks for the above, *very* informative as I also have thread-safety 
requirements on XML trees of unknown structure and size. I was thinking 
of implementing a statistics-and-total-cache-size-based mechanism  to 
figure out frequently used expressions, then store those, but I'm not 
sure how accessible the JXPath cache is (can i selectively store and 
remove compiled expressions?), or how easily another cache can be 
implemented and what that should be like... any suggestions?

Many thanks,

Manos

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [JXPath] Compiled Expressions Cache Impl? (was: Re: JXPath: Thread-Safe Behavior and Real-Time Applications)

Posted by Dmitri Plotnikov <dm...@apache.org>.
Manos,

I recommend that you maintain cache outside JXPath.  Use 
JXPathContext.compile(xpath) to get a compiled expression and store it in 
your own cache.  I think this would be better than exposing the internals of 
JXPath cache.

Good luck,

- Dmitri

----- Original Message ----- 
From: "Emmanouil Batsis" <Em...@eurodyn.com>
To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
Sent: Tuesday, November 02, 2004 6:28 AM
Subject: [JXPath] Compiled Expressions Cache Impl? (was: Re: JXPath: 
Thread-Safe Behavior and Real-Time Applications)


>
> Hi,
>
> Dmitri Plotnikov wrote:
>
>>JXPath maintains a global cache of those.  Since that cache is of limited 
>>size and is shared by all threads, the performance may suffer when all 
>>these threads start storing their load of XPaths in that cache. What I 
>>would recommend is disabling the automatic caching (for that there is a 
>>global variable on JXPathContextImpl) and maintain application's own cache 
>>of compiled expressions.
>>
>
> Thanks for the above, *very* informative as I also have thread-safety 
> requirements on XML trees of unknown structure and size. I was thinking of 
> implementing a statistics-and-total-cache-size-based mechanism  to figure 
> out frequently used expressions, then store those, but I'm not sure how 
> accessible the JXPath cache is (can i selectively store and remove 
> compiled expressions?), or how easily another cache can be implemented and 
> what that should be like... any suggestions?
>
> Many thanks,
>
> Manos
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org