Memcache-session-manager (Flexjson)

Source: Internet
Author: User
Tags session id

MSM Project Flexjson serialized Reference document.

Serial Number ( step )

Requirements Description

1

jar package list:

spymemcached-2.11.1.jar

Memcached-session-manager-tc8-1.8.0.jar

Memcached-session-manager-1.8.0.jar

 

 

Msm-flexjson-serializer-1.8.3.jar

Flexjson-3.3.jar

 

will jar package put to /tomcat/lib/ under

2

Modify /tomcat/conf/context.xml, Add the following content .

<manager className="De.javakaffee.web.msm.MemcachedBackupSessionManager"

Memcachednodes = "n1:192.168.0.215:20201 n2:192.168.0.221:20201"  

Requesturiignorepattern = ".*\. (PNG|GIF|JPG|CSS|JS) $ "

Sessionbackupasync = "true"

Sticky = "false"

Storagekeyprefix = " Static:kaoqin "

Lockingmode = "None"

Sessionbackuptimeout = " the"  

Transcoderfactoryclass = "De.javakaffee.web.msm.serializer.json.JSONTranscoderFactory"  

copycollectionsforserialization = "false" />

3

Add a log.

Add De.javakaffee.web.msm.level=fine to the $CATALINA _home/conf/logging.properties

Note 1:

The meaning of each parameter and its basic configuration:

1.ClassName. necessary. and is fixed, Memcachedbackupsessionmanager inherits the Org.apache.catalina.session.ManagerBase and implements the Org.apache.catalina.Manager interface.

2.Memcachednodes must. The format can be separated by a grid or ",". The node count should not be too much.

3.Requesturiignorepattern is optional. Filter requests.

4.sessionBackupAsync is optional. Whether to save the session asynchronously. The synchronization is saved before returning response, if the pursuit response is usually set to true. The default is true.

5.sticky, optional.

6.backupThreadCount (since 1.3, optional, default number-CPU kernel) sticky= "false" function.

7.operationTimeout (self-1.6.0, optional, default 1000). Sets the time-out period for using the memcache operation.

8.storageKeyPrefix (self-1.8.0, optional, default webappversion) supports both static and dynamic parameter modes. Static parameter format: The format of the "Static:kaoqin" session is SESSIONID=KAOQIN_JSESSIONID-N1. Dynamic parameter Support (host,context,webappversion). Here are some examples to prove that its configuration creates a storage key (session ID "foo" context path "ctxt" and Host "HST"): * static:x, X_foo * host, Hst_foo * Host.hash e93c0 85e_foo * Context-Ctxt_foo * Context.hash-45e6345f_foo * host,context-Hst:ctxt_foo * webappversion 001_foo * Host.hash,context.hash,webappversion-E93c085e:45e6345f:001_foo

(Note —---Dynamic parameters: 1.host is conf/server.xml

2.host.hash is the hash code of the host name

3.context is the on-line path and is typically configured in Meta-inf/context.xml. or a

/conf/catalina/localhost/context.xml.default or Yes .

/conf/catalina/localhost/helloapp.xml or a/conf/context.xml or a

Find <Context> child elements in the <Host> element in the/conf/server.xm file. The information for this <Context> element applies only to a single Web application. If the definition context is root, it is ignored.

4.context.hash is the hash code of the context.

5.webppVersion is the default value

Three can be used in combination with each other, separated by commas. Like Context,host, I

)

9. Sessionbackuptimeout. The default is 100 milliseconds. More than 100 of the backup session is considered an operation failure.

10.transcoderFactoryClass.

Transcoderfactoryclass (since 1.1, optional, default de.javakaffee.web.msm.JavaSerializationTranscoderFactory)

Create a class name that uses the serial/Deserializer session/transcoding factory from Memcached. The specified class must implement de.javakaffee.web.msm.TranscoderFactory and provide a parameterless constructor. Other transcoderfactory implementations are available through other package/canister-like Msm-kryo, Msm-xstream and Msm-javolution strings (as described above), These listings and comparisons on serializationstrategies.

Available Transcoderfactory implementations

: * Java Serialization: De.javakaffee.web.msm.JavaSerializationTranscoderFactory * Kryo based on sequence: De.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory * Javolution based on sequence: De.javakaffee.web.msm.serializer. Javolution. Javolutiontranscoderfactory * XStream-based serialization: De.javakaffee.web.msm.serializer.xstream.XStreamTranscoderFactory

11.copyCollectionsForSerialization: The default is False.

12.memcachedProtocol (since 1.3, optional, default text)

13.username (since 1.6.0, optional)

For more details please refer to:

Https://github.com/magro/memcached-session-manager/wiki/SetupAndConfiguration

NOTE 2:

The best thing to do is use Kryo for serialization, which is considered to be very effective, and this time it's not a success.

Memcache-session-manager (Flexjson)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.