Friday, June 20, 2008

Upgraded Servers and Performance Improvements

We upgraded the memory so 3banana should feel a bit faster. If you are still having issues please email us at beta-feedback@3banana.com.

There was also a problem with the HashSessionManager that has been resolved which would cause requests to block for 20-30 seconds. Jetty was configured to save all the sessions to disk every 60 seconds, which was causing quite a bit of havock.


HashSessionManager hashSessionManager = new HashSessionManager();
hashSessionManager.setStoreDirectory(
  new File("/opt/web/session/"));
hashSessionManager.setMaxInactiveInterval(SECONDS_IN_MONTH);
hashSessionManager.setMaxCookieAge(2 * SECONDS_IN_YEAR);

// how often we write the sessions out to disk
hashSessionManager.setSavePeriod(60);

SessionHandler sessionHandler = new SessionHandler(hashSessionManager);

webapp.setSessionHandler(sessionHandler);


The sessions are now being written to disk on shutdown:

Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
  super.run();
  try {
    System.out.println("shutting down, saving sessions");
    hashSessionManager.saveSessions();
  } catch (Exception e) {
    e.printStackTrace();
  }
}
});



Finally, you can monitor our uptime using Pingdom.

0 comments: