Code Monkey home page Code Monkey logo

bumblebee's Introduction

Beetlex framework 👋

high performance socket tcp communication framework, support Unix domain Socket, TLS, HTTP, HTTPS, WebSocket, Gateway, RPC, Redis ... protocols , custom protocols and 1M connections solution

Package Nuget version Download
BeetleX(tcp component)
BeetleX.FastHttpApi(Http/Websocket server component)
BeetleX.Redis(Redis client component)
BeetleX.Http.Clients(Http/Websocket client component)
XRPC(Remote interface invoke)
MQTT(MQTT Server)

BeetleX's tcp, http, websocket, xprc, web, vue ... samples

Web Framework Benchmarks Round 20 in the top 10

bumblebee's People

Contributors

beetlex-io avatar sxi3265 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bumblebee's Issues

优化响应转发

现在的转发方式是节点服务器完全响应所有内容后才进行转发,优化调整成获取节点响应内容块后马上转发。

请问能不能转Cookie

发觉通过网关请求后,后端服务没收到Cookie,发现你Header头没写Cookie进去。是设计上不考虑COOKIE吗?还是说要那里做设置?

使用wrk压力测试时,超过500连接就会出现500错误

网关测试:

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)

How can I use reroute link like Ocelot

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.

使用代码设置 HttpOptions.StaticResurceType 对 woff 和 ttf 不起作用

代码设置 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并不会起作用。

Bumblebee nginx

大佬 。我想问一下。Bumblebee 做网关。还需要nginx 吗

网关透传客户端IP到后台服务

网关暂没有透传客户端IP功能,可以在Requesting事件中添加

g.Requesting += (o, e) =>
            {
                e.Request.Header.Add(HeaderTypeFactory.CLIENT_IPADDRESS, e.Request.RemoteIPAddress);
                // e.Request.Header.Add("ClientIP", e.Request.RemoteIPAddress);
            };

IP并发控制插件调整

原来插件当IP被限制后一样会被网关处理返回一个5XX错误,这样一样会损耗网关处理性能。计划调整由FastHttpApi的connect事件来接管直接关闭连接

Bumblebee.Jwt.JwtPlugin

版本 bumblebee.1.3.2
启动bumblebee -->
--->启用jwt插件,--->然后关闭jwt插件
--->停止 bumblebee --->再启动 无法进入系统
image

[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)

增加向应Header相关事件

增加两个事件

  • HeaderWriting
    用于在网关取消或修改响应给请求的某个header值
  • HeaderWrited
    用于网关针对请求写一些特定的header值

缓存和Url重写后引发的问题

缓存插件会缓存post请求的内容,调整为只缓存get的请求。
Url重写后,日志,缓存和jwt等插件引用了重写后的路径,需要调整为重写前的路径。

相关内容更新日志

2019-20-27

修复在一些情况代理数据异常和CPU100%的问题,添加iptables插件。

2019-20-24

添加服务发现插件

2019-20-20

支持Url重写

2019-10-11

添加响应处理插件,用于记录服务响应的内容;添加插入运行级别,可指定同一类型插件运行的顺序。

  • 添加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

2019-10-8

BeetleX.Bumblebee.ConcurrentLimits 1.0.3.6用于IP或Url并发限制

2019-10-7

优化BeetleX.Bumblebee.Configuration 1.0.8的插件编辑json配置。
image

ValidateRPS bug

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;

如何不统计资源文件的访问

Home面板上的Total (Top 10)会统计css js。如何过滤这些请求?因为网站每天有近百万的访问量我需要查看哪个页面使用的最多

能否在插件中动态设置RewriteUrl

我们有些业务在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。

优化网关到API服务连接池

优化网关到API服务连接池,确保网关用最优化的连接数去和API服务交互,避免过多连接的创建导致性能上的损耗。

插件【default_ip_concurrent_limits】 重启报错

1 服务器迁移=>centOS 启动报错
2 配置的 default_ip_concurrent_limits {
"Limit": 100,
"DisabledTime": 1000,
"CleanTime": 1800,
"WhiteList": [

]

}
3 页面点击不动
4
image
目前只能关闭。
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)
image

根据域名进行区分的转发

例如: 服务器 192.168.2.3 IIS: 用户接口 api1.server.com:80 组织接口 api2.server.com:80
配置后只会转发到其中一个接口。nginx也是不能通过域名区分。

多级域名匹配问题

当多级域名没有配置的情况,会匹配到根域名。如img1.tomap.me在没配置的情况路由到已经配置tomap.me上。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.