开发者

Session optimization in Jetty + Wicket

Is there a way to swap sessions onto disk with j开发者_JAVA技巧etty if they are idle for n.n. minutes?

It is under investigation, but we suspect that we have many idle users logged in with large session size. So, while they are doing nothing, their session could be pushed onto disk.

Is there a setting or utility or way to achieve this?

We are using wicket+jetty.

Simply shortening session destroy timeout is not an option.


Assuming you're running Jetty 7, the answer is yes.

Because it's possible to configure & run Jetty in multiple ways, it's pretty hard to give a definitive answer about how to turn this on in your scenario.

The outcome you want it to call "setIdleSavePeriod" on the "HashSessionManager" with a non-zero value (the number of seconds a session should be idle before it is pushed to disk)

If you're running your server with the default jetty.xml then you'll need to add something like (untested):

<Configure class="org.mortbay.jetty.webapp.WebAppContext">
  .
  .
  .
  <Set name="sessionHandler">
    <New class="org.mortbay.jetty.servlet.SessionHandler">
      <Arg>
        <New class="org.mortbay.jetty.servlet.HashSessionManager">
          <Set name="storeDirectory">your/chosen/directory/goes/here</Set>
          <Set name="idleSavePeriod">300</Set>
        </New>
      </Arg>
    </New>
  </Set>
  .
  .
  .
</Configure>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜