GolangNote

Golang笔记

推荐两个用Go 实现的负载均衡

Permalink

两个不错的可以实现均衡负载的 go 库,sslb 比较简单,seesaw 功能较多,使用也比较复杂。

sslb - Golang超级简单的负载均衡,比较简单,支持 WebSockets

https://github.com/eduardonunesp/sslb

google 非官方团队开源的,基于LVS

https://github.com/google/seesaw

sslb 示例

JSON: sslb 配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
    "general": {
        "maxProcs": 4,
        "workerPoolSize": 10,
    },
    
    "frontends" : [
        {
            "name" : "Front1",
            "host" : "127.0.0.1",
            "port" : 9000,
            "route" : "/",
            "timeout" : 5000,
            
            "backends" : [
                {
                    "name" : "Back1",
                    "address" : "http://127.0.0.1:9001",
                    "heartbeat" : "http://127.0.0.1:9001",
                    "inactiveAfter" : 3,
                    "heartbeatTime" : 5000,
                    "retryTime" : 5000
                },{
                    "name" : "Back2",
                    "address" : "http://127.0.0.1:9002",
                    "heartbeat" : "http://127.0.0.1:9002",
                    "inactiveAfter" : 3,
                    "heartbeatTime" : 5000,
                    "retryTime" : 5000
                }
            ]
        }
    ]
}

本文网址: https://golangnote.com/topic/130.html 转摘请注明来源

Related articles

谷歌翻译的 golang 库推荐

Google 的翻译越来越好了,官方的Golang SDK 已经很完美,这里介绍的是几个非官方发布的有特色的库。...

Write a Comment to "推荐两个用Go 实现的负载均衡"

Submit Comment Login
Based on Golang + fastHTTP + sdb | go1.17 Processed in 0ms