@@ -64,7 +64,7 @@ | |||
Pipeline分为两种方式使用,一种是使用队列的方式,一种是网关集成的方式。 | |||
| 使用方式 | 特性 |备注| | |||
|:---|:---|:---|:---| | |||
|:------|:------|:------| | |||
|使用队列|网关不需要重启,相当于透传数据,设备上来的数据直接入队列,通过服务去处理消息。|设备多的可以这样搞,这样关注点在业务上面。| | |||
|使用网关集成|网关需要根据消息业务的变化去处理,也就意味着更改业务,需要重启网关,但是上手简单。|设备少的,开发能力弱的,允许设备丢点数据的。| | |||
@@ -181,7 +181,7 @@ pm2 start "dotnet JT808.Gateway.CleintBenchmark.dll ASPNETCORE_ENVIRONMENT=Produ | |||
"TcpPort": 808, | |||
"UdpPort": 808, | |||
"MiniNumBufferSize": 102400, | |||
"SoBacklog": 102400 | |||
"SoBacklog": 204800 | |||
} | |||
``` | |||
@@ -232,7 +232,7 @@ pm2 start "dotnet JT808.Gateway.CleintBenchmark.dll ASPNETCORE_ENVIRONMENT=Produ | |||
"TcpPort": 808, | |||
"UdpPort": 808, | |||
"MiniNumBufferSize": 102400, | |||
"SoBacklog": 102400 | |||
"SoBacklog": 204800 | |||
} | |||
``` | |||
@@ -242,82 +242,6 @@ pm2 start "dotnet JT808.Gateway.CleintBenchmark.dll ASPNETCORE_ENVIRONMENT=Produ | |||
 | |||
### 80K | |||
| 操作系统 | 配置 | 使用 | | |||
|:-------:|:-------:|:-------:| | |||
| centos7 | 16c24g | JT808服务端 | | |||
| centos7 | 8c16g | JT808客户端 | | |||
| centos7 | 8c16g | JT808客户端 | | |||
| centos7 | 8c16g | JT808客户端 | | |||
| centos7 | 8c16g | JT808客户端 | | |||
> 计算网络增强型 sn1ne ecs.sn1ne.3xlarge 12 vCPU 24 GiB Intel Xeon E5-2682v4 / Intel Xeon(Skylake) Platinum 8163 2.5 GHz 2.5 Gbps 130 万 PPS | |||
> 计算网络增强型 sn1ne ecs.sn1ne.2xlarge 8 vCPU 16 GiB Intel Xeon E5-2682v4 / Intel Xeon(Skylake) Platinum 8163 2.5 GHz 2 Gbps 100 万 PPS | |||
客户端1的参数配置appsettings.json | |||
``` 1 | |||
"ClientBenchmarkOptions": { | |||
"IP": "", | |||
"Port": 808, | |||
"DeviceCount": 20000, | |||
"Interval": 1000, | |||
"DeviceTemplate": 100000 //需要多台机器同时访问,那么可以根据这个避开重复终端号 100000-200000-300000 | |||
} | |||
``` | |||
客户端2的参数配置appsettings.json | |||
``` 2 | |||
"ClientBenchmarkOptions": { | |||
"IP": "", | |||
"Port": 808, | |||
"DeviceCount": 20000, | |||
"Interval": 1000, | |||
"DeviceTemplate": 200000 //需要多台机器同时访问,那么可以根据这个避开重复终端号 100000-200000-300000 | |||
} | |||
``` | |||
客户端3的参数配置appsettings.json | |||
``` 3 | |||
"ClientBenchmarkOptions": { | |||
"IP": "", | |||
"Port": 808, | |||
"DeviceCount": 20000, | |||
"Interval": 1000, | |||
"DeviceTemplate": 300000 //需要多台机器同时访问,那么可以根据这个避开重复终端号 100000-200000-300000 | |||
} | |||
``` | |||
客户端3的参数配置appsettings.json | |||
``` 4 | |||
"ClientBenchmarkOptions": { | |||
"IP": "", | |||
"Port": 808, | |||
"DeviceCount": 20000, | |||
"Interval": 1000, | |||
"DeviceTemplate": 400000 //需要多台机器同时访问,那么可以根据这个避开重复终端号 100000-200000-300000 | |||
} | |||
``` | |||
服务器参数配置appsettings.json | |||
``` 1 | |||
"JT808Configuration": { | |||
"TcpPort": 808, | |||
"UdpPort": 808, | |||
"MiniNumBufferSize": 204800, | |||
"SoBacklog": 204800 | |||
} | |||
``` | |||
 | |||
 | |||
### 100K | |||
| 操作系统 | 配置 | 使用 | | |||
@@ -385,7 +309,7 @@ pm2 start "dotnet JT808.Gateway.CleintBenchmark.dll ASPNETCORE_ENVIRONMENT=Produ | |||
"JT808Configuration": { | |||
"TcpPort": 808, | |||
"UdpPort": 808, | |||
"MiniNumBufferSize": 204800, | |||
"MiniNumBufferSize": 102400, | |||
"SoBacklog": 204800 | |||
} | |||
``` | |||
@@ -38,19 +38,26 @@ namespace JT808.Gateway.NormalHosting.Impl | |||
/// <param name="session"></param> | |||
public override byte[] Processor(JT808HeaderPackage request, IJT808Session session) | |||
{ | |||
//AOP 可以自定义添加一些东西:上下行日志、数据转发 | |||
logger.LogDebug("可以自定义添加一些东西:上下行日志、数据转发"); | |||
//流量 | |||
jT808Traffic.Increment(request.Header.TerminalPhoneNo, DateTime.Now.ToString("yyyyMMdd"), request.OriginalData.Length); | |||
var parameter = (request.Header.TerminalPhoneNo, request.OriginalData.ToArray()); | |||
//转发数据(可同步也可以使用队列进行异步) | |||
jT808TransmitService.Send(parameter); | |||
//上行日志(可同步也可以使用队列进行异步) | |||
jT808MsgLogging.Processor(parameter, JT808MsgLoggingType.up); | |||
//处理上行消息 | |||
var down= base.Processor(request, session); | |||
//下行日志(可同步也可以使用队列进行异步) | |||
jT808MsgLogging.Processor((request.Header.TerminalPhoneNo, down), JT808MsgLoggingType.down); | |||
var down = base.Processor(request, session); | |||
try | |||
{ | |||
//AOP 可以自定义添加一些东西:上下行日志、 | |||
logger.LogDebug("可以自定义添加一些东西:上下行日志、数据转发"); | |||
//流量 | |||
jT808Traffic.Increment(request.Header.TerminalPhoneNo, DateTime.Now.ToString("yyyyMMdd"), request.OriginalData.Length); | |||
var parameter = (request.Header.TerminalPhoneNo, request.OriginalData.ToArray()); | |||
//上行日志(可同步也可以使用队列进行异步) | |||
jT808MsgLogging.Processor(parameter, JT808MsgLoggingType.up); | |||
//下行日志(可同步也可以使用队列进行异步) | |||
jT808MsgLogging.Processor((request.Header.TerminalPhoneNo, down), JT808MsgLoggingType.down); | |||
//转发数据(可同步也可以使用队列进行异步) | |||
jT808TransmitService.Send(parameter); | |||
} | |||
catch (Exception) | |||
{ | |||
} | |||
return down; | |||
} | |||
@@ -9,6 +9,8 @@ using JT808.Gateway.GrpcService; | |||
using Microsoft.Extensions.Hosting; | |||
using Microsoft.Extensions.Logging; | |||
using System.Text.Json; | |||
using JT808.Protocol.Extensions; | |||
using Microsoft.Extensions.Options; | |||
namespace JT808.Gateway.NormalHosting.Jobs | |||
{ | |||
@@ -19,13 +21,13 @@ namespace JT808.Gateway.NormalHosting.Jobs | |||
private Grpc.Core.Metadata AuthMetadata; | |||
public CallGrpcClientJob( | |||
ILoggerFactory loggerFactory, | |||
JT808Configuration configuration) | |||
IOptions<JT808Configuration> configurationAccessor) | |||
{ | |||
Logger = loggerFactory.CreateLogger("CallGrpcClientJob"); | |||
channel = new Channel($"{configuration.WebApiHost}:{configuration.WebApiPort}", | |||
channel = new Channel($"{configurationAccessor.Value.WebApiHost}:{configurationAccessor.Value.WebApiPort}", | |||
ChannelCredentials.Insecure); | |||
AuthMetadata = new Grpc.Core.Metadata(); | |||
AuthMetadata.Add("token", configuration.WebApiToken); | |||
AuthMetadata.Add("token", configurationAccessor.Value.WebApiToken); | |||
} | |||
public Task StartAsync(CancellationToken cancellationToken) | |||
@@ -39,6 +41,11 @@ namespace JT808.Gateway.NormalHosting.Jobs | |||
{ | |||
var result1 = jT808GatewayClient.GetTcpAtomicCounter(new Empty(), AuthMetadata); | |||
var result2 = jT808GatewayClient.GetTcpSessionAll(new Empty(), AuthMetadata); | |||
var result3 = jT808GatewayClient.UnificationSend(new UnificationSendRequest | |||
{ | |||
TerminalPhoneNo= "123456789012", | |||
Data=Google.Protobuf.ByteString.CopyFrom("7E02000026123456789012007D02000000010000000200BA7F0E07E4F11C0028003C00001810151010100104000000640202007D01137E".ToHexBytes()) | |||
}, AuthMetadata); | |||
Logger.LogInformation($"[GetTcpAtomicCounter]:{JsonSerializer.Serialize(result1)}"); | |||
Logger.LogInformation($"[GetTcpSessionAll]:{JsonSerializer.Serialize(result2)}"); | |||
} | |||
@@ -1,6 +1,6 @@ | |||
<Project> | |||
<PropertyGroup> | |||
<JT808DotNettyPackageVersion>2.3.1</JT808DotNettyPackageVersion> | |||
<JT808GatewayPackageVersion>1.0.0-preview6</JT808GatewayPackageVersion> | |||
<JT808GatewayPackageVersion>1.0.0-preview7</JT808GatewayPackageVersion> | |||
</PropertyGroup> | |||
</Project> |