如何使用NGINX将用户路由到特定计算机? [英] How to route a user to a specific machine using NGINX?

查看:166
本文介绍了如何使用NGINX将用户路由到特定计算机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近从Figma工程博客中阅读了这篇文章: https://www.figma.com/blog/rust-in-production-at-figma/,并对他们的NGINX多人路由设置感到好奇.看起来是这样的:

I was recently reading this article from the Figma engineering blog: https://www.figma.com/blog/rust-in-production-at-figma/ and was curious about their NGINX setup for multiplayer routing. This is how it looks:

其中有M台服务器,每台服务器有W台工作者. Figma允许用户实时在设计文档上进行协作,并且每个文档(即负责每个文档的实时多人处理的逻辑)始终位于一个特定的工作人员中.

Where they have M number of servers, and where each server has W number of workers. Figma lets users collaborate on design documents in real-time, and each document (i.e. the logic that takes care of the real-time multiplayer processing for each doc) always lives in one specific worker.

我想知道他们如何设法始终将用户路由到具有正在处理文档的工作程序的计算机,然后再路由到实际具有该文档的特定进程.

I’m wondering how they manage to always route users to the machine that has the worker for the document being worked on, and then to the specific process that actually has the doc.

他们使用NGINX进行此操作,但是我的问题是如何?

They do this with NGINX, but my question is how?

我知道NGINX具有轮循和ip_hash方法来实现负载平衡,但这还不足以实现它们的功能.

I know that NGINX has round-robin and ip_hash methods to load balance, but that’s not granular enough to achieve what they do.

相关问题: 根据条件将流量路由到多个节点服务器

推荐答案

您应该能够使用Cookie将用户与下游节点相关联:

You should be able to use a cookie to associate a user with the downstream node: https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/#enabling-session-persistence

这篇关于如何使用NGINX将用户路由到特定计算机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆