1 Star 1 Fork 0

DDD / slash-balanced

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

插件简介

为解决特定场景中,服务器资源资源利用不充分,浏览器加载数据慢,无法使用http2的情况下,解决浏览器同源并发限制问题 注意:该方案需要服务端暴露多个域名或者多个端口
支持随机、最小连接数、轮询等多种负载均衡算法和服务熔断(正在开发)

项目特点&适用场景

  1. 本地情况无意义,实测互联网/局域网加载性能约提升20%~50%不等,影响因素较多,可以考虑多流量入口
  2. 服务器资源利用足够,解决前端并发限制瓶颈
  3. 服务器多流量入口,可直接在前端分发(不建议本方案,DNS方案更好)

开发进度

目前只开发了ajax部分,其他的后面开发

npm install slash-balanced
yarn add slash-balanced

源码

github gitee

开发指南

npm install slash-balanced
yarn add slash-balanced
//ts和js的配置方式是一样的 算法取枚举后面的名字即可LeastConnections
SlashBalanced.init({
    enable: false,
    proxyOptions: [
        {
            baseUrl: "http://host:port",
            algorithm: ProxyAlgorithmEnum.LeastConnections,
            hystrix: false,
            enable: true,
            proxyPass: [
                {
                    target: "http://host:port",
                    weight: 1
                },
                {
                    target: "http://host:port",
                    weight: 1
                }
            ]
        }
    ]
} as unknown as SlashBalancedOption)
SlashBalanced.start();
//SlashBalanced.stop();

实际测试效果

img

MIT License Copyright (c) 2022 一条摆摆鱼啊 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

为解决特定场景中,服务器资源资源利用不充分,浏览器加载数据慢,无法使用http2的情况下,解决浏览器同源并发限制问题 注意:该方案需要服务端暴露多个域名或者多个端口 支持随机、最小连接数、轮询等多种负载均衡算法和服务熔断(正在开发) 展开 收起
TypeScript 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
TypeScript
1
https://gitee.com/lanmushan/slash-balanced.git
git@gitee.com:lanmushan/slash-balanced.git
lanmushan
slash-balanced
slash-balanced
main

搜索帮助