MCPcopy Index your code
hub / github.com/akasamq/akasa

github.com/akasamq/akasa @v0.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.1.1 ↗ · + Follow
454 symbols 1,260 edges 62 files 17 documented · 4%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Akasa (आकाश)

English | 简体中文

Akasa 是一个 Rust 写的高性能,低延迟,高度可扩展的 MQTT 服务器。

它底层的 MQTT 协议消息编解码器 (mqtt-proto) 是为了高性能和 async 环境而精心设计实现的。

特性

  • [x] 完全支持 MQTT v3.1/v3.1.1/v5.0
  • [x] 支持 TLS (包括双向认证)
  • [x] 支持 WebSocket (包括 TLS 支持)
  • [x] 支持 Proxy Protocol V2
  • [x] 使用 Hook trait 来扩展服务器
  • [x] 用一个密码文件来支持简单的认证
  • [ ] 基于 Raft 的服务器集群 (敬请期待)

如何使用

最简单的方法是通过 docker 来使用:

docker run --init -it --rm -p 1883:1883 -v "$HOME/local/etc":/opt thewawar/akasa:0.1.1 akasa start --config /opt/akasa-config.yaml

或者你可以直接从源码编译:

git clone https://github.com/akasamq/akasa.git && cd akasa
# 可能你需要先安装 openssl: https://docs.rs/openssl/latest/openssl/#automatic
cargo build --release

./target/release/akasa --help
# Commands:
#  start            Start the server
#  default-config   Generate default config to stdout
#  insert-password  Insert a password to the password file
#  remove-password  Remove a password from the password file
#  help             Print this message or the help of the given subcommand(s)

更多文档:

性能测试

# 测试环境
CPU    : Intel® Xeon® E5-2678 v3 × 48
Memory : 32GB DDR4/2133
System : Arch Linux

# 参与者
FlashMQ : v1.6.9
  Akasa : v0.1.0
   EMQX : v5.2.1
VerneMQ : v1.13.0

# Connections (clean_session=false)
FlashMQ : 250k connections, 0.9GB memory
  Akasa : 250k connections, 2.8GB memory
   EMQX : 250k connections,   5GB memory
VerneMQ :  50k connections,  20GB memory

# Message/s
FlashMQ : 40k coonections, 600k message/s, 0.6GB memory, CPU  550%
  Akasa : 40k connections, 600k message/s, 0.8GB memory, CPU  580%
   EMQX : 20k connections, 300k message/s, 3.2GB memory, CPU 3000%
VerneMQ : 25k connections, 370k message/s, 6.0GB memory, CPU 2600%

正确性测试

对于可靠的软件来说测试是非常重要的工作。Akasa 目前有 100+ 测试用例, 这些测试用例都是通过仔细阅读 MQTT 规格说明书中的功能点和限制点来收集的。

底层的编解码器 (mqtt-proto) 也包含了相当数量的测试和一些 fuzz 测试。

社区

如果你有任何问题或者想参与到我们的社区中来,可以通过以下方式进入:

License

Akasa 使用 MIT license (LICENSE)

企业版

Akasa 会有一个企业版本,企业版中的额外功能包括:

  • [x] 基于 WebAssembly 的规则引擎
  • 可以跑非常复杂的业务逻辑 (比如 TensorFlow)
  • 相对于脚本语言来说有绝对的性能优势
  • 在线更新
  • [ ] 和 Akasa 交互的 HTTP API
  • [ ] 统计指标
  • [ ] 流量控制
  • [ ] 数据集成 (路由数据到 MySQL/Kafka/InfluxDB...)

Extension points exported contracts — how you extend this code

Hook (Interface)
(no doc) [2 implementers]
akasa-core/src/hook.rs
MqttPacket (Interface)
(no doc) [2 implementers]
akasa-core/src/protocols/mqtt/online_loop.rs
OnlineSession (Interface)
(no doc) [2 implementers]
akasa-core/src/protocols/mqtt/online_loop.rs
ClientV5 (Interface)
(no doc) [1 implementers]
akasa-core/src/tests/protocols/mqtt/v5/mod.rs
ClientV3 (Interface)
(no doc) [1 implementers]
akasa-core/src/tests/protocols/mqtt/v3/mod.rs

Core symbols most depended-on inside this repo

len
called by 45
akasa-core/src/protocols/mqtt/pending.rs
push_back
called by 33
akasa-core/src/protocols/mqtt/pending.rs
is_empty
called by 32
akasa-core/src/protocols/mqtt/route.rs
get_mut
called by 28
akasa-core/src/hook.rs
start
called by 28
akasa-core/src/server/rt.rs
insert
called by 25
akasa-core/src/protocols/mqtt/retain.rs
build_error_connack
called by 24
akasa-core/src/protocols/mqtt/v5/packet/common.rs
build_error_disconnect
called by 23
akasa-core/src/protocols/mqtt/v5/packet/common.rs

Shape

Method 194
Function 182
Class 46
Enum 27
Interface 5

Languages

Rust100%

Modules by API surface

akasa-core/src/tests/utils.rs31 symbols
akasa-core/src/tests/protocols/mqtt/v5/mod.rs28 symbols
akasa-core/src/tests/protocols/mqtt/v3/mod.rs25 symbols
akasa-core/src/protocols/mqtt/v5/message.rs24 symbols
akasa-core/src/protocols/mqtt/v3/message.rs22 symbols
akasa-core/src/protocols/mqtt/route.rs22 symbols
akasa-core/src/hook.rs22 symbols
akasa-core/src/state.rs19 symbols
akasa/src/default_hook.rs17 symbols
akasa-core/src/protocols/mqtt/retain.rs17 symbols
akasa-core/src/config.rs17 symbols
akasa-core/src/protocols/mqtt/v5/session.rs16 symbols

For agents

$ claude mcp add akasa \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page