Honor the yield_each_delivered_bytes setting for MQTT#1783
Conversation
|
Code Review: No issues found. The changes correctly align the MQTT session's deliver loop with the existing AMQP consumer pattern (
|
This is the "same" as we do it for AMQP. The default `yield_each_delivered_bytes`of 1 MB roughly means that we will yield twice as often with a 16 bytes payload: ``` For a 16-byte payload MQTT message, the per-message sp.bytesize is roughly: 32 bytes (fixed overhead) + topic_length + 1 + 16 bytes (payload) ≈ 49 + topic_length So with the old count-based yield every 32,768 messages: ┌────────────────────┬──────────────────────┬───────────────────────────────────────┐ │ Topic length │ Per-message bytesize │ Equivalent yield_each_delivered_bytes │ ├────────────────────┼──────────────────────┼───────────────────────────────────────┤ │ short (~8 bytes) │ ~58 bytes │ ~1.9 MB │ ├────────────────────┼──────────────────────┼───────────────────────────────────────┤ │ medium (~16 bytes) │ ~66 bytes │ ~2.2 MB │ └────────────────────┴──────────────────────┴───────────────────────────────────────┘ ```
85fb0d2 to
707de3f
Compare
|
PR Review No issues found. The change correctly mirrors the existing AMQP consumer pattern ( |
spuun
left a comment
There was a problem hiding this comment.
MQTT::Protocol::Packet has a #bytesize which I hope is correct :)
| get_packet do |pub_packet, bytesize| | ||
| consumer.deliver(pub_packet) | ||
| delivered_bytes &+= bytesize |
There was a problem hiding this comment.
I think this should work
| get_packet do |pub_packet, bytesize| | |
| consumer.deliver(pub_packet) | |
| delivered_bytes &+= bytesize | |
| get_packet do |pub_packet| | |
| consumer.deliver(pub_packet) | |
| delivered_bytes &+= pub_packet.bytesize |
There was a problem hiding this comment.
Yes, that works but then it would be a bit different to how we do it for AMQP, essentially it would be "on wire size" vs "message store size" if I get it right. I guess for AMQP they are closer to each other(?). No strong opinion here though and it's all the same to you I think I prefer to keep what we have 😇
It's "just" yielding anyway.
WHAT is this pull request doing?
This is the "same" as we do it for AMQP.
The default
yield_each_delivered_bytesof 1 MB roughly means that we will yield twice as often with a 16 bytes payload:Benchmarks (
bin/lavinmqperf mqtt throughput -z 30 -s <size>):Looks like the difference is basically just noise.
HOW can this pull request be tested?
Tests + for instance benchmarking:
bin/lavinmqperf mqtt throughput -z 30 -s 16