Giter Site home page Giter Site logo

stateless-tomcat's Introduction

Showing how externalising the HTTP Servlet session into a database can work.

Getting started

pushd app
./gradlew docker
popd
docker-compose up

This should build the application, and create a docker environment with 3 instances of the application talking to a single MySQL database, and haproxy as a load-balancer in front of the apps.

http://localhost/ should give you the same session ID each time.

Kill an instance of the tomcat application; the session should continue to work.

Tests

zero-downtime deployment

  1. have a client access the site to few times
  2. only a single session should be created
  3. Check the logs that a CleanupObject instance has been created
  4. Sequentially stop and restart each app_x instance
  5. client sessions aren't interrupted by this
  6. wait for a minute or two for the sessions to expire
  7. you should see valueUnbound events in the logs as CleanupObjects are purged

See zero-downtime-deployment.sh.

extended downtime

  1. have a few clients access the site to create sessions
  2. Check the logs that various CleanupObject instances have been created
  3. stop all of the app_x instances to simulate extended downtime of the application / segfaults
  4. wait for 2 minutes (session timeout is 1 minute)
  5. start one or more of the app_x instances
  6. after a minute or so, you should see valueUnbound events in the logs as CleanupObjects are purged

See extended-downtime.sh.

image session

  1. have a client access the site a few times
  2. only a single session should be created
  3. request the image using the client session
    1. is the session loaded from the DB?
  4. request the image using no session cookie (replicating a cookie-less domain)
    1. is the session loaded from the DB?

See image-session.sh.

stateless-tomcat's People

Contributors

jabley avatar

Stargazers

Mat avatar

Watchers

İbrahim Güneş avatar sibarm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.