Performance
Cerulion Core is designed for high-performance real-time applications. This page covers performance characteristics, optimization tips, and benchmarking guidance.Performance Characteristics
Latency Measurements
| Operation | Transport | Latency | Notes |
|---|---|---|---|
| Local send | iceoryx2 | < 1 μs | Zero-copy shared memory |
| Local receive | iceoryx2 | < 1 μs | Direct memory read |
| Network send (queue) | Background thread | ~30 ns | Added to fast path |
| Network send (serialization) | Background thread | 1-10 μs | Depends on message size |
| Network send (zenoh) | Background thread | 1-10 ms | Network dependent |
| Network receive | Zenoh | 1-10 ms | Network dependent |
Local communication latency is sub-microsecond for small messages. Network communication adds minimal overhead to the fast path (~30 ns) because serialization and network I/O happen on a background thread.
Throughput
Local transport:- Limited by memory bandwidth
- Typical: 10+ GB/s for small messages
- Scales with message size (larger messages = higher throughput)
- Limited by network bandwidth
- Typical: 1-10 Gbps (depends on network)
- Serialization overhead: ~1-10 μs per message
For high-throughput applications, local transport is ideal. Network transport is suitable for lower-frequency data or distributed systems.
Optimization Tips
1. Use Local Transport When Possible
Local transport provides < 1 μs latency vs 1-10 ms for network. Use local transport whenever possible.
2. Keep Message Types Small
3. Use Copy Types
Copy types enable zero-copy local transport. Non-Copy types require serialization even for local communication, adding overhead.
4. Batch Messages When Possible
Batching reduces the number of send operations and can improve throughput, especially for network transport.
5. Use TopicManager for Multiple Topics
TopicManager shares a single Zenoh session across all publishers/subscribers, reducing memory and connection overhead.
Benchmarking
Local Transport Benchmark
Here’s a simple benchmark for local transport:Expected results for local transport: < 1 μs average latency, 10+ M messages/s throughput for small messages.
Network Transport Benchmark
For network transport, measure end-to-end latency:Network latency depends on network conditions. Typical values: 1-10 ms for local network, 10-100 ms for WAN.
Performance Considerations
Message Size Impact
| Message Size | Local Latency | Network Serialization | Network Latency |
|---|---|---|---|
| 16 bytes | < 1 μs | ~1 μs | 1-10 ms |
| 1 KB | < 1 μs | ~5 μs | 1-10 ms |
| 100 KB | < 10 μs | ~50 μs | 1-10 ms |
| 1 MB | < 100 μs | ~500 μs | 1-10 ms |
Local transport latency is relatively insensitive to message size (memory bandwidth is high). Network serialization time increases with message size, but network latency dominates for larger messages.
CPU Usage
Local transport:- Minimal CPU usage (< 1% for 1 MHz message rate)
- CPU usage scales with message rate
- Background thread handles serialization and network I/O
- Main thread CPU usage: ~30 ns per send (just queueing)
- Background thread CPU usage: Depends on message size and rate
Network transport is designed to minimize impact on the main thread. Serialization and network I/O happen on a background thread, so they don’t block your application.
Best Practices Summary
- ✅ Use local transport when possible (< 1 μs vs 1-10 ms)
- ✅ Keep messages small (< 1 KB for best performance)
- ✅ Use Copy types for zero-copy local transport
- ✅ Batch messages when sending multiple values
- ✅ Use TopicManager for multiple topics (shared session)
- ✅ Profile your application to identify bottlenecks
- ✅ Consider message frequency - high frequency benefits more from local transport
Troubleshooting Performance Issues
”High latency on local transport”
Possible causes:- Message type is not
Copy - Message size is very large
- System is under heavy load
- Ensure message type implements
Copy - Reduce message size or batch messages
- Check system load and CPU usage
”Network messages not arriving”
Possible causes:- Network transport not enabled
- Network connectivity issues
- Subscriber not connected
- Check that network transport is enabled
- Verify network connectivity
- Ensure subscriber is created before publisher sends
”High CPU usage”
Possible causes:- Very high message rate
- Large message sizes
- Multiple background threads
- Reduce message rate if possible
- Reduce message size
- Use TopicManager to share sessions