大网数据广告活动
服务器运维问答

How to maintain session persistence and file sync in load balancing?

· 52CE 我爱测

I'm not very educated when it comes to distributed systems. I have a website hosted currently on a windows server and I want to load balance to 2-3 servers. But I have some problems in mind, and I want to know what I need to do a…

问题原文

原帖链接 · Markus Pauli · CC BY-SA 4.0

I'm not very educated when it comes to distributed systems. I have a website hosted currently on a windows server and I want to load balance to 2-3 servers. But I have some problems in mind, and I want to know what I need to do about them.

1- Session persistence. I thought about using nginx open source but found out that the only way to do sticky sessions is ip_hash which causes uneven distribution among the servers. I don't want this, are there any free alternatives for windows that allow sticky sessions without IP Hashing?

2- Updating and downloading files. When I need to update/copy/create files, do I need to do it on all servers? Is there any easier way?

已采纳解答

原帖链接 · BarsMonster · CC BY-SA 4.0

  1. When you have many users, IP hashing will statistically give you almost uniform distribution across servers. I would suggest to stay with sticky sessions with ip_hash. That is the simplest and most robust way.

Alternatively, you can store sessions in something like memcached or any other no-SQL database, this way you won't need to care about session sticking.

  1. There are no easier ways, but there are more automated ways which will require less manual work. You can automate this using repository and doing remote execution of commands like PSExec or WMI.

Files uploaded by users will have to be ether synchronized to all servers, or uploaded and served from network location accessible to all servers.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-03-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。