Skip to content

Latest commit

 

History

History
72 lines (49 loc) · 4 KB

File metadata and controls

72 lines (49 loc) · 4 KB

Gitbook Documentation MIT license Telegram Community Twitter Reddit

Benchmarks of the Ergo Framework 3.0 (and above)

The tests below are performed on the Apple M4 Max

Ping

Performs 4 scenarios:

  • 1 process spawns 'pong'-process locally and sends 3M messages
  • N processes spawn 'pong'-process locally and send 1M messages (N = number of CPU)
  • 1 process spawns 'pong'-process on a remote node and sends 3M messages
  • N processes spawn 'pong'-process on a remote node and send 1M messages (N = number of CPU)

image

Memory usage (per process)

Performs the following scenario:

  • Takes node information that includes memory usage value.
  • Starts 1M processes
  • Takes node information 3 times with 1s intervals to make sure the GC has freed unused memory

image

Distributed Pub/Sub (1M subscribers)

Demonstrates event delivery performace by publishing 1 event from 1 producer to 1,000,000 subscribers distributed across 10 nodes.

Key optimization: Instead of 1,000,000 network messages (one per subscriber), only 10 network messages are sent (one per consumer node). Each node locally distributes to its 100K subscribers.

Results:

  • Total subscribers: 1,000,000
  • Producer nodes: 1
  • Consumer nodes: 10
  • Time to deliver all: 342ms
  • Network messages sent: 10
  • Delivery rate: 2.9M msg/sec

Run with go run .

Hardware: Apple M4 Max

Serialization benchmarks: EDF vs Protobuf vs Gob

These benchmarks compare EDF, EDF (+cache), Protobuf, and Gob serialization performance across common data types.

  • EDF and Gob rely on runtime reflection, which dynamically inspects and serializes data structures at runtime
  • Protobuf uses code generation, producing static type-safe marshalling and unmarshalling logic.
Data Type EDF EDF (+cache) Protobuf Gob Winner EDF Advantage
String Encode 29.96ns, 53B, 0a 23.45ns, 0B, 0a 44.37ns, 32B, 1a 76.42ns, 16B, 1a EDF+Cache 47% faster than Protobuf, 69% faster than Gob
String Decode 76.63ns, 72B, 4a 76.62ns, 72B, 4a 67.45ns, 96B, 2a 429.5ns, 1000B, 19a Protobuf EDF 14% slower, but 6x faster than Gob
Map Encode 310.5ns, 325B, 10a 224.7ns, 204B, 5a 339.9ns, 112B, 5a 234.0ns, 32B, 2a EDF+Cache 34% faster than Protobuf, competitive with Gob
Map Decode 557.4ns, 955B, 25a 468.8ns, 846B, 22a 353.3ns, 528B, 13a 6733ns, 8256B, 185a Protobuf EDF+Cache 33% slower, but 14x faster than Gob
Complex Struct Encode 277.8ns, 307B, 6a 269.8ns, 306B, 6a 474.3ns, 224B, 9a 357.1ns, 88B, 5a EDF+Cache 43% faster than Protobuf, 24% faster than Gob
Complex Struct Decode 740.1ns, 1364B, 41a 700.8ns, 1368B, 41a 597.2ns, 824B, 25a 9335ns, 10872B, 255a Protobuf EDF+Cache 17% slower, but 13x faster than Gob
Nested Struct Encode 739.9ns, 732B, 17a 796.2ns, 846B, 17a 1557ns, 640B, 27a 901.4ns, 256B, 15a EDF 52% faster than Protobuf, 18% faster than Gob
Nested Struct Decode 2137ns, 4594B, 107a 2291ns, 5438B, 120a 1684ns, 2544B, 71a 12729ns, 14712B, 342a Protobuf EDF 27% slower, but 6x faster than Gob

Format: time ns/op, memory B/op, allocations/op

Run with go test -bench=. -benchmem

Hardware: Apple M4 Max