You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Edgar Merino <do...@gmail.com> on 2009/02/04 23:19:06 UTC
SessionPerRequestFilter
Hello,
I'm implementing a j2ee filter to obtain a jcr session per http
request (using a threadlocal), however it sometimes opens more than once
session when I open a webpage, I'm thinking this is because many threads
are involved in a single request, but this affects performance (a lot),
what workaround can I apply to avoid this kind of overhead (to have a
real session per request instead of session per thread?).
Correct me if I made the wrong assumptions,
Edgar Merino
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: SessionPerRequestFilter
Posted by Thomas Mäder <th...@devotek-it.ch>.
You might also configure the filter such that it is not active for paths
where you are sure you don't need the filter (think
"Web-Content/StaticImages/*.jpg" or other static content)
Thomas
On Thu, Feb 5, 2009 at 3:56 AM, Igor Vaynberg <ig...@gmail.com>wrote:
> a single request is processed by a single thread. what might happen
> is, if you hit a page that has images, the browser will open more
> requests to retrieve those images - which will create more threads.
>
> what you should do is handle the session creation lazily - only create
> it when it is requested. use the filter to close the session (if its
> there) and reset a threadlocal holder rather then create the session
> in the filter.
>
> see brix-cms.googlecode.com - there is code in there that does just that.
>
> -igor
>
> On Wed, Feb 4, 2009 at 2:19 PM, Edgar Merino <do...@gmail.com> wrote:
> > Hello,
> >
> > I'm implementing a j2ee filter to obtain a jcr session per http request
> > (using a threadlocal), however it sometimes opens more than once session
> > when I open a webpage, I'm thinking this is because many threads are
> > involved in a single request, but this affects performance (a lot), what
> > workaround can I apply to avoid this kind of overhead (to have a real
> > session per request instead of session per thread?).
> >
> > Correct me if I made the wrong assumptions,
> > Edgar Merino
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Thomas Mäder
www.devotek-it.ch
Re: SessionPerRequestFilter
Posted by Igor Vaynberg <ig...@gmail.com>.
a single request is processed by a single thread. what might happen
is, if you hit a page that has images, the browser will open more
requests to retrieve those images - which will create more threads.
what you should do is handle the session creation lazily - only create
it when it is requested. use the filter to close the session (if its
there) and reset a threadlocal holder rather then create the session
in the filter.
see brix-cms.googlecode.com - there is code in there that does just that.
-igor
On Wed, Feb 4, 2009 at 2:19 PM, Edgar Merino <do...@gmail.com> wrote:
> Hello,
>
> I'm implementing a j2ee filter to obtain a jcr session per http request
> (using a threadlocal), however it sometimes opens more than once session
> when I open a webpage, I'm thinking this is because many threads are
> involved in a single request, but this affects performance (a lot), what
> workaround can I apply to avoid this kind of overhead (to have a real
> session per request instead of session per thread?).
>
> Correct me if I made the wrong assumptions,
> Edgar Merino
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org