beetlex-io / bumblebee Goto Github PK
View Code? Open in Web Editor NEW.net core fast http and websocket gateway components
License: Apache License 2.0
.net core fast http and websocket gateway components
License: Apache License 2.0
增加两个事件
现在的转发方式是节点服务器完全响应所有内容后才进行转发,优化调整成获取节点响应内容块后马上转发。
Home面板上的Total (Top 10)会统计css js。如何过滤这些请求?因为网站每天有近百万的访问量我需要查看哪个页面使用的最多
缓存插件会缓存post请求的内容,调整为只缓存get的请求。
Url重写后,日志,缓存和jwt等插件引用了重写后的路径,需要调整为重写前的路径。
你好,如何快速集成IdentityServer4鉴权,请指导下实现思路?
运行登录成功后,跳转到index页面然后就又跳回login页面
windows系统 谷歌浏览器 (71.0.3578.98)
Gateway
对象增加OnHttpRequest
和OnWebsocketReceive
虚方法,主要方便继承写应该方法来进行一些负载处理。
如题,有文档的话自定义扩展这块比较方便
1.Requested事件,请问如何获取请求api返回的数据?
2.Requested事件,请问如何对api返回的数据重新封装返回前端?
"liinux" should be "Linux"
当多级域名没有配置的情况,会匹配到根域名。如img1.tomap.me
在没配置的情况路由到已经配置tomap.me
上。
优化网关到API服务连接池,确保网关用最优化的连接数去和API服务交互,避免过多连接的创建导致性能上的损耗。
修复在一些情况代理数据异常和CPU100%的问题,添加iptables插件。
添加服务发现插件
支持Url重写
添加响应处理插件,用于记录服务响应的内容;添加插入运行级别,可指定同一类型插件运行的顺序。
添加BeetleX.Bumblebee.Caching
缓存处理插件
更新 BeetleX.Bumblebee.Configuration 1.1.7
,BeetleX.Bumblebee.Logs 1.0.7
,BeetleX.Bumblebee.Jwt 1.0.9
,BeetleX.Bumblebee.ConcurrentLimits 1.0.5
BeetleX.Bumblebee.ConcurrentLimits 1.0.3.6
用于IP或Url并发限制
例如: 服务器 192.168.2.3 IIS: 用户接口 api1.server.com:80 组织接口 api2.server.com:80
配置后只会转发到其中一个接口。nginx也是不能通过域名区分。
大佬 。我想问一下。Bumblebee 做网关。还需要nginx 吗
比如说 微服务A
注册了 127.0.0.1
到了 consul。。
bumblebee同步过来访问 http://getwathost:xxx:/a 访问到 127.0.0.1
微服务又上线了1台机器B 127.0.0.2 到 consul
bumblebee同步过来访问 http://getwathost:xxx:/a 会负载均衡到127.0.0.1 和 127.0.0.2
网关暂没有透传客户端IP功能,可以在Requesting事件中添加
g.Requesting += (o, e) =>
{
e.Request.Header.Add(HeaderTypeFactory.CLIENT_IPADDRESS, e.Request.RemoteIPAddress);
// e.Request.Header.Add("ClientIP", e.Request.RemoteIPAddress);
};
允许设置代理输出逻辑服务器地址头
当转发比较大的数据在某些情况可能引发错误
我们有些业务在Requesting时需要根据Request的数据进行rewrite(例如ABTest进行分流,部分人员调用新接口)
能不能增加设置URL的方法,例:
SetRewriteUrl(rewriteUrl){
this.IsRewrite = true;
this.SourceUrl = Url;
this.SourceBaseUrl = BaseUrl;
this.SourcePath = Path;
Url = rewriteUrl;
}。
现在AgentRequesting用这种方法来改写Url:
var url = e.Request.GetType().GetProperty("Url");
url.SetValue(e.Request, RewriteUrl, null);
但是这样在统计URL的时候显示的是Rewrite后的URL。
现有Url重写规则是全局不区分域名,扩展成可以针对指定域名下的重写规则
因为之前用的是ocelot,使用了路由聚合, 并且已经在使用中,但是现在希望使用这个网关,所以希望也能支持路由聚合,
那么,我想以插件的形式实现,是否可行呢
1 服务器迁移=>centOS 启动报错
2 配置的 default_ip_concurrent_limits {
"Limit": 100,
"DisabledTime": 1000,
"CleanTime": 1800,
"WhiteList": [
]
}
3 页面点击不动
4
目前只能关闭。
5 上次提的数据库日志偶尔还是主键冲突。
Gateway 26435002405224848 ::1 GET /__system/bumblebee/index.html process error Method not found: 'Void Bumblebee.Gateway.Incremen
tRequestCompleted(BeetleX.FastHttpApi.HttpRequest, Int32, Int64, Bumblebee.Servers.ServerAgent)'.@ at Bumblebee.ConcurrentLimits.IPConcurrentLimit
s.Execute(EventRequestingArgs e)
at Bumblebee.Plugins.Pluginer.Requesting(HttpRequest request, HttpResponse response)
at Bumblebee.Gateway.OnRequest(Object sender, EventHttpRequestArgs e)
添加url重写插件
版本 bumblebee.1.3.2
启动bumblebee -->
--->启用jwt插件,--->然后关闭jwt插件
--->停止 bumblebee --->再启动 无法进入系统
[12:39:58] [Error] Gateway 26472473813843969 ::1 GET /__system/bumblebee/plugins.html process error Method not found: 'Void Bumblebee.Gateway.IncrementRequestCompleted(BeetleX.FastHttpApi.HttpRequest, Int32, Int64, Bumblebee.Servers.ServerAgent)'.@ at Bumblebee.Jwt.JwtPlugin.Execute(EventRequestingArgs e)
at Bumblebee.Plugins.Pluginer.Requesting(HttpRequest request, HttpResponse response)
at Bumblebee.Gateway.OnRequest(Object sender, EventHttpRequestArgs e)
从来使用MemoryCache
调整成LRU Memory+磁盘
发觉通过网关请求后,后端服务没收到Cookie,发现你Header头没写Cookie进去。是设计上不考虑COOKIE吗?还是说要那里做设置?
现在网关配置文件变更需要重启服务,网关配置文件变更重新加载则可以热修改配置
internal bool ValidateRPS()
{
if (MaxRPS == 0)
return true;
long now = TimeWatch.GetElapsedMilliseconds();
if (now - mLastTime >= 1000)
return true;
return mRPS < MaxRPS;
}
When MaxRPS=1 ,it allways return False.
It should be :
return mRPS <= MaxRPS;
Hi IKende, thanks for your project. It's impress when compare to Ocelot. But I like reroute feature of Ocelot. So Bumblebee have that ? How can I use it.
网关测试:
wrk -t10 -c500 -d30s -T30s http://127.0.0.1:9000/user/getuserinfo
Running 30s test @ http://127.0.0.1:9000/user/getuserinfo
10 threads and 500 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 43.87ms 51.35ms 781.09ms 95.91%
Req/Sec 1.32k 425.11 3.94k 73.91%
395668 requests in 30.09s, 95.09MB read
Socket errors: connect 0, read 18217, write 0, timeout 0
Requests/sec: 13150.42
Transfer/sec: 3.16MB
网关调用的webapi接口的测试,api本身没问题
$ wrk -t10 -c500 -d30s -T30s http://127.0.0.1:9050/user/getuserinfo
Running 30s test @ http://127.0.0.1:9050/user/getuserinfo
10 threads and 500 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 51.80ms 267.11ms 11.01s 97.92%
Req/Sec 4.26k 2.56k 18.50k 76.59%
1260011 requests in 30.10s, 258.35MB read
Requests/sec: 41861.31
Transfer/sec: 8.58MB
出错日志(详细日志写不了,会导致并发下降就不会出错):
[2019/11/7 下午7:47:37] [Error] session 127.0.0.1:34530@17972 error 127.0.0.1:34530 send data completed process handler error Object reference not set to an instance of an object.!@object reference not set to an instance of an object.
at BeetleX.FastHttpApi.HttpApiServer.SendCompleted(ISession session, SocketAsyncEventArgs e)
at BeetleX.TcpServer.SendCompleted(SocketAsyncEventArgs e)
原来插件当IP被限制后一样会被网关处理返回一个5XX错误,这样一样会损耗网关处理性能。计划调整由FastHttpApi的connect事件来接管直接关闭连接
代码设置 StaticResurceType:
g = new Gateway();
g.HttpOptions(options =>
{
options.StaticResurceType = "txt;xml;zip;jpg;css;png;htm;woff;svg;gif;woff2;js;html;jpeg;ico;rar";
}
g.Open();
woff 文件显示 403错误。
GET http://..../__system/layuiadmin/layui/font/iconfont.woff?v=230 net::ERR_ABORTED 403 (No permission)
如果使用 HttpConfig.json 则一切正常。
看了代码,只有在实例化HttpApiServer时才会初始化,后续设置StaticResurceType并不会起作用。
给Route添加RPS限制
由于Host会带上端口,在匹配Host规则的时候容易描述出错,需要忽略端口
现在一个规则只能配置一个域名,支持配置多域名
大佬 能不提供一个最新编译好的环境
bin/1.3.2 启动报错
当连接在没响应的情况下连续发多个HTTP请求引发网关线程占用CPU问题
访问统计没有区分来源域名
API对应节点服务的RPS限制设置
当Url有服务不可用时,动态删除所有可用服务导致权重表重置失效
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.