How to cache session with IBM WebSphere Liberty on AWS?

424 Views Asked by At

I would like to use AWS Elasticache for Liberty’s session caching, but it looks like Liberty's sessionCache-1.0 feature can only be used with JCache compliant storage. (like Hazelcast, Infinispan, etc...).

so please let me confirm.

  • Is this correct that it is impossible to use Liberty’s feature (sessionCache-1.0) with AWS Elasticache?
  • If so, do I need to write custom code for session caching in my application?

If you have any suggestions on how to realize session caching in Liberty, I would appreciate it.

1

There are 1 best solutions below

0
On BEST ANSWER

Eventualy I could configure the sessionCache-1.0 feature with redisson.
Followings are the configuration flagment for ElastiCache Redis (Cluster Mode Disabled).

server.xml

・・・
    <!-- JCache Library -->
    <library id="jCacheVendorLib">
        <fileset dir="${shared.resource.dir}/redisson" includes="*.jar"/>
    </library>

    <!-- Session Replication -->
    <httpSessionCache libraryRef="jCacheVendorLib" uri="file:${shared.resource.dir}/redisson/redisson-jcache.yaml"/>
・・・

redisson-jcache.yaml

---
replicatedServersConfig:
  idleConnectionTimeout: 10000
  connectTimeout: 10000
  timeout: 3000
  retryAttempts: 3
  retryInterval: 1500
  failedSlaveReconnectionInterval: 3000
  failedSlaveCheckInterval: 60000
  password: null
  subscriptionsPerConnection: 5
  clientName: xxxxxxx
  loadBalancer: !<org.redisson.connection.balancer.RoundRobinLoadBalancer> {}
  subscriptionConnectionMinimumIdleSize: 1
  subscriptionConnectionPoolSize: 50
  slaveConnectionMinimumIdleSize: 24
  slaveConnectionPoolSize: 64
  masterConnectionMinimumIdleSize: 24
  masterConnectionPoolSize: 64
  readMode: "MASTER_SLAVE"
  subscriptionMode: "MASTER"
  nodeAddresses:
  - "redis://xxxxxxxxxxxxxx01.cache.amazonaws.com:6379"
  - "redis://xxxxxxxxxxxxxx02.cache.amazonaws.com:6379"
  scanInterval: 1000
threads: 16
nettyThreads: 32
codec: !<org.redisson.codec.MarshallingCodec> {}
transportMode: "NIO"