Shiro call my session dao's doReadSession and doUpdateSession many times?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Shiro call my session dao's doReadSession and doUpdateSession many times?

Guofeng Zhang
Hi,

I created a session dao to store the shiro session to Redis so that the session could be shared across several application instances. But I found that the  doReadSession() and doUpdateSession() are invoked many many times for a sing request and cause my application runs very slow in the heavy load.

Is there any way to make it more efficient?

Your advice is appreciated.

Thanks,

Guofeng



Reply | Threaded
Open this post in threaded view
|

Re: Shiro call my session dao's doReadSession and doUpdateSession many times?

Rob Young
I’m massively interested in the answer to this question.  I need to implement user session caching at some point in a Shiro web application, I feel like this is one of those questions whose answer would be quite instructive!

> On Dec 18, 2016, at 10:08 AM, Guofeng Zhang <[hidden email]> wrote:
>
> Hi,
>
> I created a session dao to store the shiro session to Redis so that the session could be shared across several application instances. But I found that the  doReadSession() and doUpdateSession() are invoked many many times for a sing request and cause my application runs very slow in the heavy load.
>
> Is there any way to make it more efficient?
>
> Your advice is appreciated.
>
> Thanks,
>
> Guofeng
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Shiro call my session dao's doReadSession and doUpdateSession many times?

Curtis Wittner
I am also interested. I am using zookeeper for my session cache and have had to implement storing the sessions in memory as well so that the cache get process can pull from memory unless the zookeeper instance has been updated.


Curtis Wittner
Senior Software Developer
Integrated Services, Inc.
[hidden email]
www.ints.com
P:800-252-3099 x 235
F:503-968-9100

On Sun, Dec 18, 2016 at 12:18 PM, Rob Young <[hidden email]> wrote:
I’m massively interested in the answer to this question.  I need to implement user session caching at some point in a Shiro web application, I feel like this is one of those questions whose answer would be quite instructive!

> On Dec 18, 2016, at 10:08 AM, Guofeng Zhang <[hidden email]> wrote:
>
> Hi,
>
> I created a session dao to store the shiro session to Redis so that the session could be shared across several application instances. But I found that the  doReadSession() and doUpdateSession() are invoked many many times for a sing request and cause my application runs very slow in the heavy load.
>
> Is there any way to make it more efficient?
>
> Your advice is appreciated.
>
> Thanks,
>
> Guofeng
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Shiro call my session dao's doReadSession and doUpdateSession many times?

Brian Demers
This is likely cache implementation specific, but you could probably just requesting a session once and storing it in the current request, any other reads for that request would get the local copy.  

This would NOT be fool proof as multiple requests could update information in the session, and you could end up with stale cache.






On Mon, Dec 19, 2016 at 8:13 AM, Curtis Wittner <[hidden email]> wrote:
I am also interested. I am using zookeeper for my session cache and have had to implement storing the sessions in memory as well so that the cache get process can pull from memory unless the zookeeper instance has been updated.


Curtis Wittner
Senior Software Developer
Integrated Services, Inc.
[hidden email]
www.ints.com
P:<a href="tel:(800)%20252-3099" value="+18002523099" target="_blank">800-252-3099 x 235
F:<a href="tel:(503)%20968-9100" value="+15039689100" target="_blank">503-968-9100

On Sun, Dec 18, 2016 at 12:18 PM, Rob Young <[hidden email]> wrote:
I’m massively interested in the answer to this question.  I need to implement user session caching at some point in a Shiro web application, I feel like this is one of those questions whose answer would be quite instructive!

> On Dec 18, 2016, at 10:08 AM, Guofeng Zhang <[hidden email]> wrote:
>
> Hi,
>
> I created a session dao to store the shiro session to Redis so that the session could be shared across several application instances. But I found that the  doReadSession() and doUpdateSession() are invoked many many times for a sing request and cause my application runs very slow in the heavy load.
>
> Is there any way to make it more efficient?
>
> Your advice is appreciated.
>
> Thanks,
>
> Guofeng
>
>
>