You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Francisco Carriedo Scher <fc...@gmail.com> on 2012/04/11 20:47:59 UTC

Method to check healthy session?

Hi there,

which method is the appropriate one to check that given session is
healthy?  I have been trying with isLive()  and refresh(true) standard JCR
methods, but none says the session is down when i suddenly shutdown the
server containing the repository... I saw a remote version of session named
RemoteSession (i guess that not being able to comunicate with the remote
part would be interpreted as the session not being live, isn't?). Anyway it
appears to be only available for RMI...

What i am using now is session.save() method to determine if it is alive or
not, but i think that there should be better ways to find it out...

Thanks for your response.

Regards.

Re: Method to check healthy session?

Posted by Francisco Carriedo Scher <fc...@gmail.com>.
Thank you very much Jukka,

 i will switch from save() to a dummy query to a fixed common node.

Additionally, we have observed the network traffic during tests and two
questions arised:

- after testing session.refresh(false) doesn't "forget" about the pending
changes, the only way we found to really forget is to re-obtain  the
repository object each time. The issue on this is that happened that some
operations got stuck (cached?) and the new ones could not be completed, as
the old ones (those stuck) raised exceptions (i.e.: creating a new node,
implied trying to perform previously another operations that failed. That
is what i mean with enqueing.

- based on what is stated above (getting a new session on every operation)
both a complete list of the sons of the root node and a complete
description of the node types (some KBs, easy to deal with) is transferred
(about 100KB). The second one is what really matters, because we are
expecting to receive a heavy load.
The first idea is to delete all the nodes but the necessary ones (nt:base,
nt:folder, nt:files...), then the XML will be lighter. Is there a better
solution for this?.

Thank you very much for your attention!

Regards!





2012/4/11 Jukka Zitting <ju...@gmail.com>

> Hi,
>
> On Wed, Apr 11, 2012 at 10:19 PM, Francisco Carriedo Scher
> <fc...@gmail.com> wrote:
> > i was talking about the Webdav one. The scenario is the following:
> >
> > 1) The repository is deployed and running within a JBoss 7 AS
> > 2) There are client sessions operating it through Webdav
> > 3) Suddenly the repository is undeployed (or the server shutdown)
> > 4) The session.isLive() and session.refresh(true) methods return true
> (and
> > no exception arises) despite the repository being not accessible anymore
> >
> > Anyway, session.save()  method does effectively throw an exception and
> then
> > re-obtaining the repository object and the session can be performed, but
> > under heavy load that leads to lots of TCP connections in TIME_WAIT
> state...
>
> OK, I see.
>
> I think ideally we should have Session.isLive() or Session.refresh()
> ping the server for status, but I guess the current implementation
> doesn't do that to avoid extra network roundtrips. Doing something
> like a dummy query should force a network roundtrip regardless of the
> caching layers without having to use a potentially unsafe operation
> like save().
>
> > Is there a better way to check the repository to be up and getting a new
> > session if needed?
>
> Do you really need long-living sessions? If you rather organize your
> client so that each separate operation (think of individual HTTP
> requests to a web application) uses a new, separate JCR session, then
> you don't need to worry about sessions becoming stale.
>
> BR,
>
> Jukka Zitting
>

Re: Method to check healthy session?

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

On Wed, Apr 11, 2012 at 10:19 PM, Francisco Carriedo Scher
<fc...@gmail.com> wrote:
> i was talking about the Webdav one. The scenario is the following:
>
> 1) The repository is deployed and running within a JBoss 7 AS
> 2) There are client sessions operating it through Webdav
> 3) Suddenly the repository is undeployed (or the server shutdown)
> 4) The session.isLive() and session.refresh(true) methods return true (and
> no exception arises) despite the repository being not accessible anymore
>
> Anyway, session.save()  method does effectively throw an exception and then
> re-obtaining the repository object and the session can be performed, but
> under heavy load that leads to lots of TCP connections in TIME_WAIT state...

OK, I see.

I think ideally we should have Session.isLive() or Session.refresh()
ping the server for status, but I guess the current implementation
doesn't do that to avoid extra network roundtrips. Doing something
like a dummy query should force a network roundtrip regardless of the
caching layers without having to use a potentially unsafe operation
like save().

> Is there a better way to check the repository to be up and getting a new
> session if needed?

Do you really need long-living sessions? If you rather organize your
client so that each separate operation (think of individual HTTP
requests to a web application) uses a new, separate JCR session, then
you don't need to worry about sessions becoming stale.

BR,

Jukka Zitting

Re: Method to check healthy session?

Posted by Francisco Carriedo Scher <fc...@gmail.com>.
Hi Jukka,

i was talking about the Webdav one. The scenario is the following:

1) The repository is deployed and running within a JBoss 7 AS
2) There are client sessions operating it through Webdav
3) Suddenly the repository is undeployed (or the server shutdown)
4) The session.isLive() and session.refresh(true) methods return true (and
no exception arises) despite the repository being not accessible anymore

Anyway, session.save()  method does effectively throw an exception and then
re-obtaining the repository object and the session can be performed, but
under heavy load that leads to lots of TCP connections in TIME_WAIT state...

Is there a better way to check the repository to be up and getting a new
session if needed?

If a better explanation is needed please, do not hesitate asking for it!

Thank you very much for your attention!

Regards.


2012/4/11 Jukka Zitting <ju...@gmail.com>

> Hi,
>
> On Wed, Apr 11, 2012 at 8:47 PM, Francisco Carriedo Scher
> <fc...@gmail.com> wrote:
> > which method is the appropriate one to check that given session is
> > healthy?  I have been trying with isLive()  and refresh(true) standard
> JCR
> > methods, but none says the session is down when i suddenly shutdown the
> > server containing the repository...
>
> I'm not sure I understand your use case. Are you talking about a local
> JCR session or one based on WebDAV remoting?
>
> In either case if the underlying repository is forcibly closed, the
> session you have will start throwing RepositoryExceptions when it no
> longer can access the repository.
>
> BR,
>
> Jukka Zitting
>

Re: Method to check healthy session?

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

On Wed, Apr 11, 2012 at 8:47 PM, Francisco Carriedo Scher
<fc...@gmail.com> wrote:
> which method is the appropriate one to check that given session is
> healthy?  I have been trying with isLive()  and refresh(true) standard JCR
> methods, but none says the session is down when i suddenly shutdown the
> server containing the repository...

I'm not sure I understand your use case. Are you talking about a local
JCR session or one based on WebDAV remoting?

In either case if the underlying repository is forcibly closed, the
session you have will start throwing RepositoryExceptions when it no
longer can access the repository.

BR,

Jukka Zitting