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

Go 1.5.1 更新的功能

Go 1.5.1版本对编译器,汇编器, fmt, net/textproto, net/http, 和 runtime 包的 bug 修复。...

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

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