从嵌入式到企业级的分布式 C++ 服务
Building an application with AREG using an AI agent? Start at
AGENTS.md. The task pages for agents are indocs/agent/, and complete copyable projects indocs/agent/recipes/.
Most C++ projects don't fail on algorithms. They fail on threads, IPC, and brittle integration code.
Areg SDK eliminates that category of failure – and does it without sacrificing throughput.
If you answered yes to three or more – Areg SDK is worth your time.
Areg SDK is a C++ service framework that automates threading, inter-process communication, service discovery, fault recovery, and message dispatch – across thread boundaries, process boundaries, and network boundaries – using a single consistent programming model.
The same service code runs:
No code changes. Configuration only.
[!NOTE] Best for: C++ applications requiring reliable service communication, automated threading, high-throughput IPC, or location-transparent services – from embedded edge devices to high-performance distributed systems.
Not for: RTOS hard real-time targets (planned), web services, or non-C++ ecosystems.
If you build C++ systems with threads, processes, or networked devices – embedded, edge, or enterprise – here is what changes when you use Areg SDK.
Areg SDK implements Object RPC (ORPC) – a service model where components expose typed interfaces and communicate through generated proxies, regardless of where they run. Unlike gRPC or ZeroMQ, the same proxy code calls a thread, a process, or a networked device – the framework resolves the location at runtime with no API changes.
┌─────────────────────────────────────────────────────────┐
│ Same code. Same interface. Different deployment. │
│ │
│ Thread A ──────────────── Thread B (in-process) │
│ Process A ─── mtrouter ── Process B (same machine) │
│ Device A ─── mtrouter ── Device B (network) │
└─────────────────────────────────────────────────────────┘Consumers reference services by name, not by network address or endpoint. The framework connects a consumer to the named service wherever it runs – whether in the same process, on the same machine, or on a remote node.
What the framework handles automatically:
What you write:
.siml file) – designed visually with Lusan or edited as XMLThe code generator produces all RPC infrastructure – serialization, proxies, events, and service provider and consumer base classes. You fill in the logic.
Full definitions of service interface, service, and consumer are in Service Identity Model. The workflow from interface definition to running code:
MyService.siml ──► codegen.jar ──► MyServiceProviderBase.hpp
(design in Lusan) │ MyServiceConsumerBase.hpp
│ MyServiceProxy.hpp
│ Serialization code
| Event objectsCMake integration – one line generates and links all infrastructure:
addServiceInterface(MyServiceLib ./services/MyService.siml)For full details, see the Service Interface Guide.
Measured on mobile-class consumer hardware, full stack active – data serialization, event dispatching, and multithreading. These are not raw socket numbers. Raw benchmark output is published alongside the full methodology for independent verification: current latency dataset (bare TTY) · earlier round (gnome-terminal).
localhost, 1:1, measured at mtrouter| Platform | CPU Type | ~3 MB, GB/s | ~0.5 KB, msg/s |
|---|---|---|---|
| Linux Ubuntu ¹ | i7-13700H (DDR4) | ~6.5 sust. / ~8.0 peak | ~2.0M sust. / ~2.5M peak |
| macOS native ² | M3 Pro (LPDDR5) | ~6.5 sust. / –7.0 peak | ~2.5M sust. / ~3.0M peak |
| Windows 11 ³ | i7-13700H (DDR4) | ~2.2 sust. / ~3.0 peak | ~1.8M sust. / ~2.5M peak |
| WSL2 Ubuntu ⁴ | i7-13700H (DDR4) | ~4.0 sust. / –4.5 peak | ~1.0M sust. / ~1.5M peak |
¹ Ubuntu 26.04, Performance power mode. Peak = best short-run measure; sustained = 5+ min run.
² No network tuning; M4 chip (separate supplementary test) reached up to 3.0M msg/s.
³ Stable dispatch is ~1.8M msg/s; above that, the dispatch thread becomes the bottleneck.
⁴ With network tuning, up to ~5.0–5.6 GB/s.
localhost, full stack, 204-byte messagesTimestamps span the full call path: before serialization (sender) to after deserialization and dispatch (receiver). OWT = one-way (2-hop). RTT = round-trip through mtrouter (4-hop). Linux figures are measured from a bare TTY session (no desktop GUI) with mtrouter, provider, and consumer each pinned to a dedicated CPU core via taskset – see the raw data and methodology.
| Platform | CPU | OWT Min | OWT P50 | RTT Min | RTT P50 |
|---|---|---|---|---|---|
| Linux Ubuntu ¹ | i7-13700H (DDR4) | 9.6 μs | ~9.9 μs | 19.1 μs | ~19.6 μs |
| macOS M3 Pro | Apple M3 (LPDDR5) | 21.6 μs | 31.4 μs | 46.0 μs | 62.5 μs |
| Windows 11 | i7-13700H (DDR4) | 32.5 μs | 40.3 μs | 64.0 μs | 82.5 μs |
¹ Ubuntu 26.04, Performance power mode, bare TTY, cores pinned via taskset. The single
lowest sample observed to date is 9.14 μs (OWT) / 18.34 μs (RTT). A desktop gnome-terminal
session reads ~0.9–1.4 μs higher; not pinning cores adds a further ~2–4 μs on top of either –
still the fastest measured TCP framework in its class either way (see
framework rankings).
For comparison: gRPC C++ sequential RTT ~116–167 μs over Unix domain socket – despite fewer hops and no service dispatch (MPI-HD, F. Werner, 2021). Latency is payload-insensitive up to 4 KB – Min rises only 1.0 μs across a 20× size increase; framework overhead dominates.
Real-world fit: covers the software pipeline layer of scientific imaging (laser microscopy, X-ray, electron microscopy) and industrial machine vision on a standard laptop.
Measure your own hardware: 23_pubdatarate (throughput) · 30_publatency (latency)
Read full data & methodology · vs ZMQ/NanoMsg/NNG · framework rankings
| Feature | Areg SDK | gRPC / DDS / ZeroMQ |
|---|---|---|
| Setup Complexity | ✅ Automated, zero boilerplate | ⚠️ Manual configuration, verbose setup |
| Threading | ✅ Automated threading | ⚠️ Manual threading and synchronization |
| Code Generation | ✅ Full ORPC automation | ⚠️ Stubs only, manual |
暂无开放 Issues,或尚未同步最近议题。