设为首页 收藏本站
查看: 995|回复: 0

[经验分享] related articles about LVS & Http Session

[复制链接]

尚未签到

发表于 2017-4-18 11:03:17 | 显示全部楼层 |阅读模式
Session in http unde LVS
http://lists.community.tummy.com/pipermail/linux-ha-dev/2001-December/002993.html
引用

2. I can set up a separate URL for session based apps that sends all requests
to  a heatbeat duplicated session manager on the first tier using
Apache/webapps/Tomcat  to load balance to the next tier down. The load
balancing in webapps/mod_jk  assures that the session always returns to the
same machine the the cluster.  This solution increases the complexity of the
cluster and it's management.. If the load grows too much I can always
esatblish another set of session managers. I don't have to go hammer my
developers to comply with yet another set of demands out of systems. It's
hard enough to get compliance on logging and testing....



LVS: Cluster friendly versions of applications that need to maintain state
http://www.austintek.com/LVS/LVS-HOWTO/HOWTO/LVS-HOWTO.cluster_friendly_applications.html
引用

    *

      What are sessions?

      When an application written on top of a stateless protocol like HTTP has a need of stateful transactions, it typically writes some data to disk between requests and retrieves these data again on the subsequent request. This mechanism is known as session handling. The session data typically get written to files or databases. Each followup-request sends some sort of token to the server so that the application can retrieve the correct file or correct record in the database.
    *

      The old-fashined way to identify sessions

      At the time when every webserver was a single PC, the session token identified a filename or a record in a database and everything was OK. When an application that relies on this mechanism is ported to a cluster environment, it stops working unless one deteriorates the cluster with a mechanism called persistence. Persistence is a quick and dirty way to get the old-fashioned token to work. It's not a very clever way though.
    *

      Why persistence is bad

      Persistence counteracts two purposes of a cluster: easy maintainance by taking single machines out at any time and optimized balancing between the members of a cluster. Above that, persistence consumes memory on the load balancers.
    *

      How to do it better

      Recall that there is a token being sent back and forth anyway, that identifies a filename or a database record. Extend this token to unambiguously point to the machine where the session data were created and install a session server on each host that delivers session data within the cluster to any of the peers on request. From that moment you can run your application truely distributed, you can take single machines out for maintainance any time: you turn their weight to 0 and wait for maybe an hour or three, depending on how long you want your sessions to last. You get better balancing, and you save memory on the balancer. Note, that unlike with a dedicated session server, you do not create a single point of failure with this method.



集群的可扩展性及其分布式体系结构之七--网络负载平衡常见问题
http://www-128.ibm.com/developerworks/cn/linux/cluster/cluster_system/balance/part3/
引用

LVS的存储一致性问题:
在一个通过LVS组建的Web集群环境中,所有涉及Session的应用都面临这样的矛盾:由于会话信息存储在服务结点上,因此一旦建立一次会话--例如登录bbs,之后的所有数据传输必须硬性的指向建立会话连接的节点(该Session以文件的形式保留在节点服务进程的路径下)。这样,会在调度算法上破坏原本正常运行的负载平衡。

但是如果把所有的文件读写放在同一个磁盘上或者指向同一个NFS服务器,可以解决文件读写不一致的问题。但又导致新的问题出现:提供I/O服务的节点成为集群的性能瓶颈!
怎么解决这一效率与功能之间的矛盾呢?可能的方式有:
1、 改写Apache服务器,使之适应LVS的分布式环境
2、 降低性能要求,使用NAS或者NFS服务进行磁盘共享
3、 撰写特殊的PHP或者脚本语言代码
4、 采用分布式文件系统

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-365823-1-1.html 上篇帖子: 介绍LVS站点集合 下篇帖子: LVS + Jboss配置的注意点
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表