A light IPC DLL based on share memory.
SMIPC 是一个基于 Windows 共享内存(Shared Memory)的轻量级 IPC 库,面向低延迟、高吞吐的本机进程通信场景。
SMIPC 的核心是“数据区 + 事件队列”的双层设计:
- 数据区(Buffer):使用共享内存存放 payload。
- 事件队列(IO Event Queue):仅传递事件元数据(
event_code、event_id、user_tag、buffer_ref)。 - 同步原语:通过互斥量和信号量实现并发安全与阻塞唤醒。
- 业务状态位:
working_flag由业务方维护,表达“是否仍有待处理工作”。
典型流程(进阶模式):
smipc_buffer_write写入 payload,得到buffer_refsmipc_event_push推送事件(携带buffer_ref)- 接收方
smipc_event_pop后smipc_buffer_read取数据
此外也提供简化模式:smipc_send / smipc_receive,用于快速接入。
- 提供一个简单、稳定、可嵌入的 Windows IPC DLL。
- 支持请求-响应、批量消息、优雅关闭等常见业务模式。
- 在保证接口清晰的前提下,提供较好的延迟和吞吐表现。
- 低开销:数据在本机共享内存中流转,避免额外序列化/网络栈开销。
- 接口分层清晰:既有简化 API,也有可控度更高的事件+缓冲区 API。
- 扩展性好:支持批量 push/pop、多线程、可选 TCP 同步通知。
- 工程可落地:仓库内包含
ServerDemo、ClientUI、Tests、Benchmark示例与验证代码。
压测程序:x64/Release/SMIPC.Benchmark.exe
测试命令(本次数据来源):
SMIPC.Benchmark.exe 50000 64 1 1SMIPC.Benchmark.exe 50000 256 1 1SMIPC.Benchmark.exe 50000 1024 1 1SMIPC.Benchmark.exe 30000 64 8 1SMIPC.Benchmark.exe 50000 64 1 4
说明:数据为单机实测结果,用于趋势参考;不同 CPU/负载/编译选项下数值会变化。
| 场景 | 参数(rounds,payload,batch,threads) | QPS (msg/s) | 吞吐 (MB/s) | 平均延迟 (us/msg) | P50 (us) | P90 (us) | P99 (us) |
|---|---|---|---|---|---|---|---|
| 单线程小包 | 50000, 64B, 1, 1 | 89,358.9 | 10.91 | 11.19 | 10.6 | 12.4 | 18.8 |
| 单线程中包 | 50000, 256B, 1, 1 | 86,150.6 | 42.07 | 11.61 | 10.8 | 12.9 | 19.4 |
| 单线程大包 | 50000, 1024B, 1, 1 | 85,817.4 | 167.61 | 11.65 | 11.0 | 12.9 | 19.1 |
| 批处理模式 | 30000, 64B, 8, 1 | 191,637 | 23.39 | 5.22 | 40.8* | 52.6* | 61.3* |
| 4线程并发 | 50000, 64B, 1, 4 | 252,629 | 30.84 | 3.96 | 14.2* | 20.2* | 31.1* |
* 说明:批处理/多线程下,p50/p90/p99 的统计口径与单线程单条消息不同(Benchmark 程序会输出口径说明)。
xychart-beta
title "SMIPC Benchmark QPS"
x-axis ["64B-1T", "256B-1T", "1024B-1T", "64B-B8", "64B-4T"]
y-axis "msg/s" 0 --> 270000
bar [89359, 86151, 85817, 191637, 252629]
为保证团队提交的压测数据可横向对比,建议所有性能结果都按以下模板记录并随 PR 一起提交。
SMIPC.Benchmark.exe <rounds> <payload_bytes> [batch_size] [threads]推荐至少覆盖以下场景:
- 单线程:
50000 64 1 1 - 单线程:
50000 256 1 1 - 单线程:
50000 1024 1 1 - 批处理:
30000 64 8 1 - 多线程:
50000 64 1 4
[Hardware]
CPU Model : <e.g. Intel Core i7-12700H / AMD Ryzen 7 7840H>
CPU Cores : <physical/logical, e.g. 6P+8E / 20 threads>
CPU Frequency : <base/turbo, and whether fixed frequency was used>
Memory : <size + speed, e.g. 32GB DDR5-5600>
Storage : <SSD model, optional>
[OS]
OS Version : <e.g. Windows 10 22H2 build xxxx>
Background Load: <idle / moderate / heavy>
[Build]
Solution/Target: <e.g. SMIPC.sln / x64 Release>
Compiler : <MSVC version>
Optimization : </O2, LTCG on/off, debug symbols on/off>
Runtime Library : </MD or /MT>
[Power]
Power Mode : <Best performance / Balanced / Power saver>
Power Plan : <Windows power plan name>
Thermal State : <normal / throttling observed>
[Benchmark Config]
Executable : <path to SMIPC.Benchmark.exe>
Rounds/Payload : <exact args>
Batch/Threads : <exact args>
Run Count : <e.g. 3 runs, take median>
Case: rounds=50000 payload=64 batch=1 threads=1
Run1: qps=..., throughput=...MB/s, avg=...us, p50=...us, p90=...us, p99=...us
Run2: ...
Run3: ...
Median: qps=..., throughput=...MB/s, avg=...us, p50=...us, p90=...us, p99=...us
Notes: <异常说明,如后台任务、温控降频、首次冷启动等>
- 提交前至少连续运行 3 次,使用中位数作为最终结果。
- 测试期间关闭明显干扰负载(大文件拷贝、杀毒全盘扫描、大型下载等)。
- 优先使用同一编译配置(建议
x64 Release)进行版本间对比。 - 若硬件或电源策略变化,必须在结果中明确标注。
- 批处理/多线程场景需注明统计口径(与单线程单消息口径不同)。