RUN@cloud » Application Session Stores

Application Session Stores

Last modified by Cyrille Le Clerc on 2014/01/27 21:09

Session stores are a new feature that allow you to easily setup session clustering for your production applications.  By enabling this feature, the application's will be upgraded to store HttpSession-scoped data in a CloudBees session-store that is synchronized across multiple application instances, and will prevent the loss of session state as applications updates are deployed to the platform.  This creates a much more consistent experience for customers using your applications as you push updates.

SessionStores are available when you upgrade your application to a paid configuration.  To create an application session-store, you will need to use the CloudBees SDK.

Example: Create a 100MB session-store resource named "session1" for the account "acme"

bees app:session-store:create session1 -ac acme -size 100mb

The available sizes are: 100mb, 250mb and 1gb  (see pricing)

Once the session store has been created, you can associate it to your application using the RUN@cloud console by selecting the created resource from the "Session Clustering" drop down menu on your application configuration tab or use the SDK.

Example: Bind the session-store "session1" to the  application "test"

bees app:bind -a test -r session1

Session-store statistics

You can get basic usage statistics about your session store with the following SDK command:

bees app:session-store:stats SESSION_STORE_RESOURCE_NAME

This command will return the following metrics:

ops_per_sec  operation per seconds
quota_used quota used in percent
item_count  number of items in the store

Example: Get the session-store "session1" statistics

bees app:session-store:stats session1
ops_per_sec     : 10
quota_used      : 24.1
item_count      : 466

Listing Session Stores

Updating Session Stores

bees cb-app:list -a YOUR_ACCOUNT_ID -t session-store

Updating the Binding of a Session Store

You must first unbind your session store and then rebind it with the desired configuration parameters:

Sample with an app www and a session store session1 on an account cyrille-leclerc:

# List the bindings of the app "www"
bees app:bindings -a www
   Applications bindings:
      _internal_sessionstore [session-store] cb-app:cyrille-leclerc/session1

# unbind the session store
bees app:unbind -a www _internal_sessionstore
   application - cyrille-leclerc/www binding _internal_sessionstore removed

# bind the session store "session1" to the app "www" with custom configuration parameters
bees app:bind -a www -r cyrille-leclerc/session1 sticky=true sessionBackupAsync=true
   application - cyrille-leclerc/www bound to cb-app:cyrille-leclerc/session1 as session1

# verify binding parameters
bees app:bindings -a www
   Applications bindings:
      session1 [session-store] cb-app:cyrille-leclerc/session1
Created by Spike Washburn on 2011/07/20 04:11