|
From: <php...@li...> - 2006-07-24 20:42:20
|
Hi Jost
Thank you very much for your explanations
On 7/24/06, php...@li...
<php...@li...> wrote:
> Hi Paul,
>
> > to keep certain Java objects (in my
> > case Lucene index searchers, query filters)
> > persistent between client calls.
>
> I usually use a factory class:
>
> public class FooFactory {
> private static final Object foo=createFoo();
> public Object getFoo() {
> return foo;
> }
> }
>
> This works because the JVM keeps the class Name=>Class
> bindings in a weak hash map and classes usually aren't
> gc'ed unless the VM runs short of memory.
That could be part of the solution, like a lucene indexreader for a
dedicated application. But in my case, I want to build an easy to
distribute/deploy PHP component requiring only the minimim work of
installing your php-java bridge as a stand-alone service (or for those
who can within tomcat or the likes).
> The above method can't be used if all nodes of a
> (weblogoc- or tomcat-) cluster should refer to the
> same foo instance or if there's no persistent VM at
> all(for example if lucene and the bridge classes have
> been compiled to native code and are started for each
> request).
>
That is not the case for me, I did not explore the option of compiling
to native code yet (but will do, curious about the performance with
respect to a VM install)
> > I also suspect
> > serializing (sometimes
> > larger) objects is beyond the scope of session
> > variable too.
>
> Depends on how long you want to keep the data and how
> expensive it is to create. If the data is really
> expensive I would use the JPersistenceAdapter,
> serialize the data and store it on the master node, on
> the web server or in a database and deserialize it
> when the next request comes in.
Ah, that's interesting! The data (lucene filters and sort objects
mainly) is rather expensive to create (roughly 50 to 200 msec per
instance for a "typical" index which has a few tens to a few hundred
fields and 100k records)
The main problem with JPersistenceAdapter is that I should find a way
to get this working in a PHP4 contextto which I'm tied now ... and
which does not look trivial now
Thank you very much again, I learned a lot andn admire your work on
the php-java bridge!
Best regards
Paul
--
http://walhalla.wordpress.com
|