You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Jared Graber <ja...@IACcap.com> on 2008/06/24 20:08:37 UTC

Multiple connections to database repository

Based on an old thread (May 2006), I found that you cannot have 2
different applications accessing the same database repository and expect
them to see each changes made by each other.

 

What if only 1 application was writing to the repository?

 

Example:

1 application that is reading and writing to the repository.

5 applications that on demand will make their own connection to the
repository in order to export the data, and then logout.

 

Is the database always kept up to date (which I think would make this
possible) or does jackrabbit keep data in memory for a while before
storing it in the database?

 

Thanks,

 

Jared


Re: Multiple connections to database repository

Posted by Alexander Klimetschek <ak...@day.com>.
You could also look at clustering Jackrabbit:

http://wiki.apache.org/jackrabbit/Clustering

Regards,
Alex

On Tue, Jun 24, 2008 at 2:28 PM, Brian Thompson <el...@gmail.com> wrote:
> The database is always kept up to date, but Jackrabbit maintains a cache.
> In your example, the 5 "on-demand" applications would read outdated data
> from the cache, AFAIK.
>
> The standard for handling that type of situation is to set up the 5
> on-demand apps to connect to the read-write app - that way, only the one app
> runs the repository.
>
> -Brian
>
>
>
> On Tue, Jun 24, 2008 at 1:08 PM, Jared Graber <ja...@iaccap.com>
> wrote:
>
>> Based on an old thread (May 2006), I found that you cannot have 2
>> different applications accessing the same database repository and expect
>> them to see each changes made by each other.
>>
>>
>>
>> What if only 1 application was writing to the repository?
>>
>>
>>
>> Example:
>>
>> 1 application that is reading and writing to the repository.
>>
>> 5 applications that on demand will make their own connection to the
>> repository in order to export the data, and then logout.
>>
>>
>>
>> Is the database always kept up to date (which I think would make this
>> possible) or does jackrabbit keep data in memory for a while before
>> storing it in the database?
>>
>>
>>
>> Thanks,
>>
>>
>>
>> Jared
>>
>>
>



-- 
Alexander Klimetschek
alexander.klimetschek@day.com

RE: Multiple connections to database repository

Posted by Jared Graber <ja...@IACcap.com>.
If possible I would prefer to stick with accessing the underlying
database.  Using RMI is an option but with the solution we're using, I
see that as a potential problem as well.  
In one of our environments, the repository will basically be read only -
the database will overwritten with a copy from one of the other
environments, but will restrict access to only reads.  Because the data
is being overwritten from an external source (not through the API) I can
see that causing caching issues with RMI - unless the JCR-RMI server is
restarted.

In my apps, I don't need to have a constant connection to the repository
backed by the database.  I only need to connect when the app receives a
signal to update its data (this doesn't happen often).  Would shutting
down the repository and reconnecting clear the cache?

-Jared


-----Original Message-----
From: Jukka Zitting [mailto:jukka.zitting@gmail.com] 
Sent: Wednesday, June 25, 2008 12:54 AM
To: users@jackrabbit.apache.org
Subject: Re: Multiple connections to database repository

Hi,

On Tue, Jun 24, 2008 at 11:07 PM, Jared Graber <ja...@iaccap.com>
wrote:
> In that case my question comes down to this:

Are you decided about accessing the underlying database from multiple
Jackrabbit clients from different host/JVMs? How about using JCR-RMI
instead of a remote database connection to access the database. Then
you wouldn't need to worry about any caching issues etc.

BR,

Jukka Zitting

Re: Multiple connections to database repository

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Tue, Jun 24, 2008 at 11:07 PM, Jared Graber <ja...@iaccap.com> wrote:
> In that case my question comes down to this:

Are you decided about accessing the underlying database from multiple
Jackrabbit clients from different host/JVMs? How about using JCR-RMI
instead of a remote database connection to access the database. Then
you wouldn't need to worry about any caching issues etc.

BR,

Jukka Zitting

RE: Multiple connections to database repository

Posted by Jared Graber <ja...@IACcap.com>.
In that case my question comes down to this:

If I have an application that only interacts with the repository to
export data 
	session.exportDocumentView(path, out, false, false);
do I need to worry about caching?  To be more specific, if I export the
document view, will jackrabbit cache that data so that next time I
export the document view I will get outdated data?

If the 2nd call to export document retrieves the cached data, how do I
get around this?

-Jared


-----Original Message-----
From: Alexander Klimetschek [mailto:aklimets@day.com] 
Sent: Tuesday, June 24, 2008 3:55 PM
To: users@jackrabbit.apache.org
Subject: Re: Multiple connections to database repository

On Tue, Jun 24, 2008 at 3:27 PM, Jared Graber <ja...@iaccap.com>
wrote:
> Are you saying that the read only applications will generate their own
jackrabbit cache so that the next export will export old data?
>        If so, how would I clear that cache?  Would logging out of the
repository not do it?

There are multiple caches inside the memory, depending on
configuration (mainly PersistenceManagers) but most importantly each
workspace has its own lucene index on the file system that is used for
queries and other improvements in accessing the data. These have to be
updated through a so-called Journal in a cluster configuration. There
is no way to simply clear the cache from outside.

> If not:
> I think if the database is always up to date, then I should be fine.

Once you call session.save() or commit a transaction in your JCR
client code, it will be persisted immediately, which means it gets
stored in the database right away - this is true for all db
persistence managers.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: Multiple connections to database repository

Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, Jun 24, 2008 at 3:27 PM, Jared Graber <ja...@iaccap.com> wrote:
> Are you saying that the read only applications will generate their own jackrabbit cache so that the next export will export old data?
>        If so, how would I clear that cache?  Would logging out of the repository not do it?

There are multiple caches inside the memory, depending on
configuration (mainly PersistenceManagers) but most importantly each
workspace has its own lucene index on the file system that is used for
queries and other improvements in accessing the data. These have to be
updated through a so-called Journal in a cluster configuration. There
is no way to simply clear the cache from outside.

> If not:
> I think if the database is always up to date, then I should be fine.

Once you call session.save() or commit a transaction in your JCR
client code, it will be persisted immediately, which means it gets
stored in the database right away - this is true for all db
persistence managers.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

RE: Multiple connections to database repository

Posted by Jared Graber <ja...@IACcap.com>.
Are you saying that the read only applications will generate their own jackrabbit cache so that the next export will export old data?  
	If so, how would I clear that cache?  Would logging out of the repository not do it?

If not:
I think if the database is always up to date, then I should be fine.  
The purpose of the 5 read only applications is to retrieve a snapshot in time of the repository and cache it.   Once the data is exported, it doesn't need to stay in synch with repository.  It is expected to deviate.  At some point in the future, the applications would be notified that they should update the cache by connecting to the database repository and exporting the data from it.

-Jared

-----Original Message-----
From: Brian Thompson [mailto:elephantium@gmail.com] 
Sent: Tuesday, June 24, 2008 2:28 PM
To: users@jackrabbit.apache.org
Subject: Re: Multiple connections to database repository

The database is always kept up to date, but Jackrabbit maintains a cache.
In your example, the 5 "on-demand" applications would read outdated data
from the cache, AFAIK.

The standard for handling that type of situation is to set up the 5
on-demand apps to connect to the read-write app - that way, only the one app
runs the repository.

-Brian



On Tue, Jun 24, 2008 at 1:08 PM, Jared Graber <ja...@iaccap.com>
wrote:

> Based on an old thread (May 2006), I found that you cannot have 2
> different applications accessing the same database repository and expect
> them to see each changes made by each other.
>
>
>
> What if only 1 application was writing to the repository?
>
>
>
> Example:
>
> 1 application that is reading and writing to the repository.
>
> 5 applications that on demand will make their own connection to the
> repository in order to export the data, and then logout.
>
>
>
> Is the database always kept up to date (which I think would make this
> possible) or does jackrabbit keep data in memory for a while before
> storing it in the database?
>
>
>
> Thanks,
>
>
>
> Jared
>
>

Re: Multiple connections to database repository

Posted by Brian Thompson <el...@gmail.com>.
The database is always kept up to date, but Jackrabbit maintains a cache.
In your example, the 5 "on-demand" applications would read outdated data
from the cache, AFAIK.

The standard for handling that type of situation is to set up the 5
on-demand apps to connect to the read-write app - that way, only the one app
runs the repository.

-Brian



On Tue, Jun 24, 2008 at 1:08 PM, Jared Graber <ja...@iaccap.com>
wrote:

> Based on an old thread (May 2006), I found that you cannot have 2
> different applications accessing the same database repository and expect
> them to see each changes made by each other.
>
>
>
> What if only 1 application was writing to the repository?
>
>
>
> Example:
>
> 1 application that is reading and writing to the repository.
>
> 5 applications that on demand will make their own connection to the
> repository in order to export the data, and then logout.
>
>
>
> Is the database always kept up to date (which I think would make this
> possible) or does jackrabbit keep data in memory for a while before
> storing it in the database?
>
>
>
> Thanks,
>
>
>
> Jared
>
>