zoukankan      html  css  js  c++  java
  • memcached-session-manager的一些理解

    1.节点分配

    粘性规划:

    Tomcat-1(t1)将session优先备份在运行在令一台机器上的memcached-2(m2)上面,仅当m2失效的时候,t1才会将sessin存储在m1上面(m1是t1的备份节点)。这样当machine1(t1和m1存在在这台机器上)挂掉的时候,session也不会丢失.

    <t1>   <t2>
      .  / .
      .  X  .
      . /  .
    <m1>   <m2>

    在配置过程中,只需要指定备份节点(failover=n1),所以存储的主节点(primarily)采用随机存储

    When a new session is created the memcached-session-manager selects the memcached node randomly.

    然后在session中增加存储节点的名字:<sessionId>-<node>[.<jvmRoute>],如“602F7397FBE4D9932E59A9D0E52FE178-n1”,或者602F7397FBE4D9932E59A9D0E52FE178-n1.tomcat0。

    非粘性规划:

    不需要设置failover节点,第一次访问的时候,会随机创建一个节点,然后将其逻辑上的下一个节点作为备份节点。

    一些节点分配的例子:

    Example
    machines m1, m2
    tomcats t1, t2 on m1, t3, t4 on m2
    memcached nodes n1 on m1, n2 on m2
    -> failoverNodes for t1 and t2 = n1, failoverNodes for t3 and t4 = n2
    Example
    machines m1, m2, m3, m4
    tomcats t1 on m1, t2 on m2, t3 on m3 and t4 on m4
    memcaches n1 on m1, n2 on m2, n3 on m3, n4 on m4
    -> t1.failoverNodes = n1, t2.failoverNodes = n2, t3.failoverNodes = n3, t4.failoverNodes = n4
    Example
    machines m1, m2, m3, m4
    tomcats t1 on m1, t2 on m2
    memcacheds n1 on m3, n2 on m4
    -> t1.failoverNodes and t2.failoverNodes = <empty> (not needed in this case)

     2.序列化

    支持多种序列化模式:kryo-serializer,javolution-serializer,xstream-serializer,flexjson-serializer 和自定义序列化模式,需要引入对应的jar包

  • 相关阅读:
    LeetCode-46. Permutations
    LeetCode-40. Combination Sum II
    LeetCode-39. Combination Sum
    剑指offer-数组中的逆序对
    LeetCode-295. Find Median from Data Stream
    LeetCode-268. Missing Number
    LeetCode-515. Find Largest Value in Each Tree Row
    GIS技术在采矿与勘探中的应用
    JavaScript 跨域总结与解决办法giserdqy.com
    JavaScript 跨域总结与解决办法giserdqy.com
  • 原文地址:https://www.cnblogs.com/fuxinci/p/3375726.html
Copyright © 2011-2022 走看看