• 请不要在回答技术问题时复制粘贴 AI 生成的内容
wyan453351466
V2EX  ›  程序员

多台服务器共同处理任务的时候,通过什么方式来交互比较好?

  •  
  •   wyan453351466 · Dec 11, 2019 · 3401 views
    This topic created in 2374 days ago, the information mentioned may be changed or developed.

    需求是,需要在多台服务器上同时执行某种任务。

    一个 master 服务器负责派发任务,多个 worker 服务器来执行。

    那么服务器与服务器之间的数据通过哪种方式交互会比较好呢?

    通过 web-api 定时通信?

    还是直接连接同一个的 Redis 数据库?(楼主觉得前者比较好,毕竟可以减少 http 的请求次数,安全性方面貌似也更好一些)

    还有其他的方法吗?

    13 replies    2019-12-11 23:03:44 +08:00
    tms
        1
    tms  
       Dec 11, 2019
    mq、rpc
    lihongjie0209
        2
    lihongjie0209  
       Dec 11, 2019
    同步 RPC
    异步 MQ
    securityCoding
        3
    securityCoding  
       Dec 11, 2019
    本质上是任务分片执行 ,不要考虑其他的了 , 就是 MQ
    wyan453351466
        4
    wyan453351466  
    OP
       Dec 11, 2019
    需求补充:

    对实时性的要求不高,任务处理结果的返回可以有一定的延迟,只要最终数据能统一到一起就行。
    chen774553620
        5
    chen774553620  
       Dec 11, 2019
    消息队列 mq
    zhiguang
        6
    zhiguang  
       Dec 11, 2019
    分布式任务调度?
    BlackBerry999
        7
    BlackBerry999  
       Dec 11, 2019
    同 2 楼
    robot1
        8
    robot1  
       Dec 11, 2019
    mapreduce
    netnr
        9
    netnr  
       Dec 11, 2019
    webhook 钩子,分发后,执行完(包括异常超时等)触发接口调用
    wangyzj
        10
    wangyzj  
       Dec 11, 2019
    python 的话 celery
    Vegetable
        11
    Vegetable  
       Dec 11, 2019
    太多啦,建议直接使用现成的框架,比如 celery
    https://github.com/search?q=distribute+task&type=Repositories
    araaaa
        12
    araaaa  
       Dec 11, 2019 via iPhone
    rsocket 和 reactor
    araaaa
        13
    araaaa  
       Dec 11, 2019 via iPhone
    @araaaa reactor 的 mono.zip 可以进行多个并发处理
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4337 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 65ms · UTC 05:33 · PVG 13:33 · LAX 22:33 · JFK 01:33
    ♥ Do have faith in what you're doing.