Skip to content

Commit

Permalink
fill the table
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed May 8, 2024
1 parent 76f6376 commit 8734d7b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
5 changes: 2 additions & 3 deletions _examples/compression_playground/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ func simulateMatch(ctx context.Context, num int32, node *centrifuge.Node, usePro
}

totalSimulationTime := 1 // Total time for the simulation in seconds
totalEvents := 20 // Total number of events to simulate
totalEvents := 30 // Total number of events to simulate
eventInterval := float64(totalSimulationTime) / float64(totalEvents) // Time between events

r := rand.New(rand.NewSource(27))
r := rand.New(rand.NewSource(37))

for i := 0; i < totalEvents; i++ {
// Sleep between events
Expand Down Expand Up @@ -73,7 +73,6 @@ func simulateMatch(ctx context.Context, num int32, node *centrifuge.Node, usePro
}
if err != nil {
log.Fatal(err)

}
ch := "match:js:1"
if useProtobufPayload {
Expand Down
31 changes: 16 additions & 15 deletions _examples/compression_playground/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ caught with WireShark filter:
tcp.srcport == 8000 && websocket
```

| Protocol | Compression | Delta | Bytes sent | Percentage |
|-----------------------------|-------------|-----------|------------|------------|
| JSON over JSON | No | No | 29510 | 100.0 |
| JSON over JSON | Yes | No | 11135 | 37.73 |
| JSON over JSON | No | Yes | 6435 | 21.81 |
| JSON over JSON | Yes | Yes | 4963 | 16.82 |
| JSON over Protobuf | No | No | 28589 | 96.88 |
| JSON over Protobuf | Yes | No | 11133 | 37.73 |
| JSON over Protobuf | No | Yes | 4276 | 14.49 |
| JSON over Protobuf | Yes | Yes | 3454 | 11.70 |
| Protobuf over Protobuf | No | No | ? | ? |
| Protobuf over Protobuf | Yes | No | ? | ? |
| Protobuf over Protobuf | No | Yes | ? | ? |
| Protobuf over Protobuf | Yes | Yes | ? | ? |
| Protobuf over Protobuf | Yes | Yes | ? | ? |
| Protocol | Compression | Delta | Bytes sent | Percentage |
|------------------------------|-------------|-----------|------------|------------|
| JSON over JSON | No | No | 40251 | 100.0 |
| JSON over JSON | Yes | No | 15669 | 38.93 |
| JSON over JSON | No | Yes | 6043 | 15.01 |
| JSON over JSON | Yes | Yes | 5360 | 13.32 |
| JSON over Protobuf | No | No | 39180 | 97.34 |
| JSON over Protobuf | Yes | No | 15542 | 38.61 |
| JSON over Protobuf | No | Yes | 4287 | 10.65 |
| JSON over Protobuf | Yes | Yes | 4126 | 10.25 |
| Protobuf over Protobuf | No | No | 16562 | 41.15 |
| Protobuf over Protobuf | Yes | No | 13115 | 32.58 |
| Protobuf over Protobuf | No | Yes | 4382 | 10.89 |
| Protobuf over Protobuf | Yes | Yes | 4473 | 11.11 |
| JSON over Protobuf 200ms | Yes | Yes | 2008 | 4.99 |
| Protobuf over Protobuf 200ms | Yes | Yes | 2315 | 5.75 |

Note: since we send JSON over Protobuf, the JSON size is the same as the JSON over JSON case.
In this case Centrifugal protocol gives lower overhead, but the main part comes from the JSON payload size.
Expand Down

0 comments on commit 8734d7b

Please sign in to comment.