Coolpy7_Community

command module
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

README

Coolpy7 Community

Release WebSite License Go Report Card OpenIssue ClosedIssue Stars

简介

Coolpy7社区版 是基于Epoll为通信核心开发的高性能MQTT服务库,专注于 物联网\即时通信\消息总线等 场景。

特性

  • 已经支持
    • MQTT协议支持 支持MQTT3.1/MQTT3.1.1
    • Qos全支持 支持Qos0 Qos1 Qos2
    • WebSocket 提供高性能Websocket桥接MQTT服务
    • JWT验证 提供JWT密钥验证(token于password连接参数)
    • 支持 Linux(操作系统)
    • 防空连接攻击
    • Self Ddos攻击

快速开始

1. 下载

这里 下载最新版本的各系统平台编译运行文件。

2 服务参数配置项
//Coolpy7 community版配置文件
{
  //tcp服务端口号
  "host": ":1883",
  //tcp的tls服务pem证书路径
  //例:/etc/aaa.pem
  "tcp_tls_pem": "",
  //tcp的tls服务key证书路径
  //例:/etc/aaa.key
  "tcp_tls_key": "",
  //websocket服务端口号
  "websocket_host": ":8083",
  //websocket的tls服务pem证书路径
  //例:/etc/aaa.pem
  "websocket_tls_pem": "",
  //websocket的tls服务key证书路径
  //例:/etc/aaa.key
  "websocket_tls_key": "",
  //启用jwt验证功能,支持多jwt认证,通过","号分隔多个jwt
  //例:jksjdfkjsdf,32234jsdkfj
  "jwt_secret_key": "",
  //防止ping包风暴影响性能,单位/秒,低于此值客户端ping包到达主动禁用此客户端
  "self_ddos_deny": 59,
  //离线消息补发触发器时间间隔,单位/秒
  "lazy_msg": 30,
  //防空连攻击,空接断开限时,单位/秒
  "nil_conn_deny": 2,
  //密码错误禁连限时,单位/秒
  "block_time": 1800,
  //密码容错次数,单位/次
  "max_attempts": 5
}

参数文件路径:

  • 配置文件固定文件名为conf.json并位于与本服务程序相同路径下
3 运行服务

参数说明:

  • 启动服务前请先确认相关执行权限
$ sudo chmod -x coolpy7_community_xxx

启动成功提示:

$ Coolpy7 Community On Port :1883
$ Coolpy7 Community Websocket On Port :8083
$ Coolpy7 v1.0.2 build golang v1.20.6
4 安全关闭服务
  • kill -2 pid

应用示例

  • Web浏览器应用示例这里

  • 微信小程序聊天室示例这里

  • Web浏览器聊天室示例(可与微信小程序示例连同一Coolpy7后互相聊天)这里

  • Web浏览器mqtt.js客户端示例这里

性能

Qos0压力测试
./mqtt-stresser-linux-amd64 -broker tcp://172.18.157.151:1883 -num-clients 10 -num-messages 150 -rampup-delay 1s -rampup-size 10 -global-timeout 180s -timeout 20s
# Configuration
Concurrent Clients: 10
Messages / Client:  1500

# Results
Published Messages: 1500 (100%)
Received Messages:  992 (66%)
Completed:          0 (0%)
Errors:             0 (0%)

# Publishing Throughput
Fastest: 84124 msg/sec
Slowest: 19982 msg/sec
Median: 63101 msg/sec

  < 26396 msg/sec  20%
  < 45639 msg/sec  30%
  < 52053 msg/sec  40%
  < 58467 msg/sec  50%
  < 77710 msg/sec  80%
  < 84124 msg/sec  90%
  < 90538 msg/sec  100%

# Receiving Througput
Fastest: 109125 msg/sec
Slowest: 18135 msg/sec
Median: 28378 msg/sec

  < 27234 msg/sec  50%
  < 36333 msg/sec  60%
  < 45432 msg/sec  80%
  < 90927 msg/sec  90%
  < 118224 msg/sec  100%
Qos1压力测试
./mqtt-stresser-linux-amd64 -broker tcp://172.18.157.151:1883 -num-clients 10 -num-messages 150 -rampup-delay 1s -rampup-size 10 -global-timeout 180s -timeout 20s -publisher-qos 1  -subscriber-qos 1
..........
# Configuration
Concurrent Clients: 10
Messages / Client:  1500

# Results
Published Messages: 1500 (100%)
Received Messages:  1500 (100%)
Completed:          10 (100%)
Errors:             0 (0%)

# Publishing Throughput
Fastest: 5699 msg/sec
Slowest: 5046 msg/sec
Median: 5295 msg/sec

  < 5111 msg/sec  10%
  < 5176 msg/sec  20%
  < 5241 msg/sec  30%
  < 5307 msg/sec  60%
  < 5437 msg/sec  80%
  < 5503 msg/sec  90%
  < 5764 msg/sec  100%

# Receiving Througput
Fastest: 59043 msg/sec
Slowest: 25028 msg/sec
Median: 31189 msg/sec

  < 28429 msg/sec  40%
  < 31831 msg/sec  50%
  < 35232 msg/sec  70%
  < 38634 msg/sec  80%
  < 52240 msg/sec  90%
  < 62445 msg/sec  100%
Qos2压力测试
./mqtt-stresser-linux-amd64 -broker tcp://172.18.157.151:1883 -num-clients 10 -num-messages 150 -rampup-delay 1s -rampup-size 10 -global-timeout 180s -timeout 20s -publisher-qos 2  -subscriber-qos 2
# Configuration
Concurrent Clients: 10
Messages / Client:  1500

# Results
Published Messages: 1500 (100%)
Received Messages:  1500 (100%)
Completed:          10 (100%)
Errors:             0 (0%)

# Publishing Throughput
Fastest: 3187 msg/sec
Slowest: 2841 msg/sec
Median: 3101 msg/sec

  < 2876 msg/sec  10%
  < 2910 msg/sec  20%
  < 2945 msg/sec  30%
  < 3049 msg/sec  40%
  < 3083 msg/sec  50%
  < 3152 msg/sec  80%
  < 3187 msg/sec  90%
  < 3221 msg/sec  100%

# Receiving Througput
Fastest: 36544 msg/sec
Slowest: 12518 msg/sec
Median: 22943 msg/sec

  < 14921 msg/sec  20%
  < 17323 msg/sec  40%
  < 22128 msg/sec  50%
  < 26934 msg/sec  70%
  < 31739 msg/sec  80%
  < 34141 msg/sec  90%
  < 38946 msg/sec  100%

Documentation

Overview

Copyright 2022 LiDonghai Email:[email protected] Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
extension
tls
Package packet implements functionality for encoding and decoding MQTT packets.
Package packet implements functionality for encoding and decoding MQTT packets.
std
crypto/tls
Package tls partially implements TLS 1.2, as specified in RFC 5246, and TLS 1.3, as specified in RFC 8446.
Package tls partially implements TLS 1.2, as specified in RFC 5246, and TLS 1.3, as specified in RFC 8446.
internal/cpu
Package cpu implements processor feature detection used by the Go standard library.
Package cpu implements processor feature detection used by the Go standard library.
internal/nettrace
Package nettrace contains internal hooks for tracing activity in the net package.
Package nettrace contains internal hooks for tracing activity in the net package.
internal/testenv
Package testenv provides information about what functionality is available in different testing environments run by the Go team.
Package testenv provides information about what functionality is available in different testing environments run by the Go team.
net/http
Package http provides HTTP client and server implementations.
Package http provides HTTP client and server implementations.
net/http/cgi
Package cgi implements CGI (Common Gateway Interface) as specified in RFC 3875.
Package cgi implements CGI (Common Gateway Interface) as specified in RFC 3875.
net/http/cookiejar
Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
net/http/fcgi
Package fcgi implements the FastCGI protocol.
Package fcgi implements the FastCGI protocol.
net/http/httptest
Package httptest provides utilities for HTTP testing.
Package httptest provides utilities for HTTP testing.
net/http/httptrace
Package httptrace provides mechanisms to trace the events within HTTP client requests.
Package httptrace provides mechanisms to trace the events within HTTP client requests.
net/http/httputil
Package httputil provides HTTP utility functions, complementing the more common ones in the net/http package.
Package httputil provides HTTP utility functions, complementing the more common ones in the net/http package.
net/http/internal
Package internal contains HTTP internals shared by net/http and net/http/httputil.
Package internal contains HTTP internals shared by net/http and net/http/httputil.
net/http/pprof
Package pprof serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool.
Package pprof serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL