You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by "tungtose (via GitHub)" <gi...@apache.org> on 2026/03/12 13:13:57 UTC
[PR] feat(server): aligned buffer memory pool [iggy]
tungtose opened a new pull request, #2921:
URL: https://github.com/apache/iggy/pull/2921
Prepare the memory pool and buffer infrastructure for O_DIRECT I/O. Direct I/O requires buffers to be aligned to the underlying block size (commonly 4096 bytes). This allows the kernel to bypass the page cache, reducing double buffering and giving more predictable I/O latency.
Known Trade-offs:
+ Minimum allocation size is now 4096 bytes, meaning small utility buffers (e.g. put_u32_le, put_u64_le) now consume more memory than before
+ freeze() performs a copy instead of the previous zero-copy freeze: a TODO is left to address this
+ make_mutable in the HTTP path now copies buffers due to alignment incompatibility with Bytes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "tungtose (via GitHub)" <gi...@apache.org>.
tungtose commented on PR #2921:
URL: https://github.com/apache/iggy/pull/2921#issuecomment-4098351902
@hubcio Here is a benchmark update using the command line below. I believe the slow performance come from the frozen code. Regarding that section (converting from AVec back to Byte), the current implementation is temporary. It will be improved in an upcoming PR that integrates DirectIOFile and a proper implementation of the frozen function
`sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'`
`target/release/iggy-bench --rate-limit 500MB --warmup-time 3s --total-data 10GB pinned-producer-and-consumer --producers 4 --consumers 4 tcp`
### master:
bench_report::prints: \x1b[32mProducers Results: Total throughput: 249.96 MB/s, 249964 messages/s, average throughput per Producer: 62.49 MB/s, p50 latency: 1.02 ms, p90 latency: 1.81 ms, p95 latency: 2.02 ms, p99 latency: 2.68 ms, p999 latency: 8.90 ms, p9999 latency: 11.91 ms, average latency: 1.17 ms, median latency: 1.02 ms, min: 0.46 ms, max: 13.07 ms, std dev: 0.13 ms, total time: 39.98 s\x1b[0m 2026-03-20T12:14:11.068760Z INFO bench_report::prints: \x1b[32mConsumers Results: Total throughput: 249.97 MB/s, 249971 messages/s, average throughput per Consumer: 62.49 MB/s, p50 latency: 1.47 ms, p90 latency: 2.31 ms, p95 latency: 2.58 ms, p99 latency: 3.34 ms, p999 latency: 10.22 ms, p9999 latency: 13.16 ms, average latency: 1.62 ms, median latency: 1.47 ms, min: 0.67 ms, max: 14.89 ms, std dev: 0.43 ms, total time: 40.08 s\x1b[0m
### PR:
x1b[32mProducers Results: Total throughput: 249.97 MB/s, 249968 messages/s, average throughput per Producer: 62.49 MB/s, p50 latency: 0.90 ms, p90 latency: 1.39 ms, p95 latency: 1.74 ms, p99 latency: 2.39 ms, p999 latency: 9.49 ms, p9999 latency: 16.87 ms, average latency: 1.02 ms, median latency: 0.90 ms, min: 0.43 ms, max: 11.01 ms, std dev: 0.13 ms, total time: 39.98 s\x1b[0m 2026-03-20T13:15:34.355418Z INFO bench_report::prints: \x1b[32mConsumers Results: Total throughput: 249.92 MB/s, 249916 messages/s, average throughput per Consumer: 62.48 MB/s, p50 latency: 1.27 ms, p90 latency: 1.97 ms, p95 latency: 2.34 ms, p99 latency: 3.16 ms, p999 latency: 10.42 ms, p9999 latency: 17.44 ms, average latency: 1.42 ms, median latency: 1.27 ms, min: 0.65 ms, max: 20.51 ms, std dev: 0.30 ms, total time: 40.04 s\x1b[0m 2026-03-20T13:15:34.355422Z INFO bench_report::prints: \x1b[31mAggregate Results: Total throughput: 499.89 MB/s, 499885 messages/s, average throughput per Actor: 62.49 MB/
s, p50 latency: 1.08 ms, p90 latency: 1.68 ms, p95 latency: 2.04 ms, p99 latency: 2.77 ms, p999 latency: 9.95 ms, p9999 latency: 17.16 ms, average latency: 1.22 ms, median latency: 1.08 ms, min: 0.43 ms, max: 20.51 ms, std dev: 0.14 ms, total time: 40.04 s\x1b[0m
### Producers
| Metric | Master | PR | delta |
|----------------|------------|------------|---------|
| p50 latency | 1.02 ms | 0.90 ms | -11.8% |
| p90 latency | 1.81 ms | 1.39 ms | -23.2% |
| p95 latency | 2.02 ms | 1.74 ms | -13.9% |
| p99 latency | 2.68 ms | 2.39 ms | -10.8% |
| p999 latency | 8.90 ms | 9.49 ms | +6.6% |
| p9999 latency | 11.91 ms | 16.87 ms | +41.6% |
| Std dev | 0.13 ms | 0.13 ms | 0% |
### Consumers
| Metric | Master | PR | delta |
|----------------|------------|------------|---------|
| p50 latency | 1.47 ms | 1.27 ms | -13.6% |
| p90 latency | 2.31 ms | 1.97 ms | -14.7% |
| p95 latency | 2.58 ms | 2.34 ms | -9.3% |
| p99 latency | 3.34 ms | 3.16 ms | -5.4% |
| p999 latency | 10.22 ms | 10.42 ms | +2.0% |
| p9999 latency | 13.16 ms | 17.44 ms | +32.5% |
| Std dev | 0.43 ms | 0.30 ms | -30.2% |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on PR #2921:
URL: https://github.com/apache/iggy/pull/2921#issuecomment-4062873916
> make_mutable in the HTTP path now copies buffers due to alignment incompatibility with Bytes
can you elaborate?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio merged PR #2921:
URL: https://github.com/apache/iggy/pull/2921
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on PR #2921:
URL: https://github.com/apache/iggy/pull/2921#issuecomment-4089117913
could you please run benchmarks with rate limit, 4 producers / consumers, total rate limit equal to 500MB? this way we'll see the p50.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on code in PR #2921:
URL: https://github.com/apache/iggy/pull/2921#discussion_r2936618957
##########
core/common/src/alloc/memory_pool.rs:
##########
@@ -16,26 +16,25 @@
* under the License.
*/
-use bytes::BytesMut;
+use aligned_vec::{AVec, ConstAlign};
use crossbeam::queue::ArrayQueue;
use human_repr::HumanCount;
use once_cell::sync::OnceCell;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use tracing::{info, trace, warn};
+pub const ALIGNMENT: usize = 4096;
Review Comment:
please make it configurable via compilation feature. it can be either 512 or 4096. make 512 a default feature - is that reasonable? or, is there any reason why is 4096 hardcoded?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "tungtose (via GitHub)" <gi...@apache.org>.
tungtose commented on PR #2921:
URL: https://github.com/apache/iggy/pull/2921#issuecomment-4069733918
Since this PR deeply affect to the core, could you also please take a look @numinnex @spetz
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "tungtose (via GitHub)" <gi...@apache.org>.
tungtose commented on code in PR #2921:
URL: https://github.com/apache/iggy/pull/2921#discussion_r2954580961
##########
core/partitions/src/lib.rs:
##########
@@ -54,8 +54,8 @@ pub(crate) fn decode_send_messages_batch(body: Bytes) -> Option<IggyMessagesBatc
}
let indexes_bytes = body.split_to(indexes_len);
- let indexes = IggyIndexesMut::from_bytes(PooledBuffer::from(indexes_bytes), 0);
- let messages = PooledBuffer::from(body);
+ let indexes = IggyIndexesMut::from_bytes(PooledBuffer::from(indexes_bytes.as_ref()), 0);
Review Comment:
@numinnex I have updated the code, please help me to check
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "tungtose (via GitHub)" <gi...@apache.org>.
tungtose commented on PR #2921:
URL: https://github.com/apache/iggy/pull/2921#issuecomment-4097024891
> could you please run benchmarks with rate limit, 4 producers / consumers, total rate limit equal to 500MB? this way we'll see the p50. run it for like 30s or so
@hubcio here is the bench result with this bench cmd: ` target/release/iggy-bench
--rate-limit 500MB
--warmup-time 3s
--total-data 10GB
pinned-producer-and-consumer
--producers 4
--consumers 4
tcp`
### on this branch:
\x1b[34mBenchmark: Pinned Producer And Consumer, 4 producers, 4 consumers, 4 streams, 1 topic per stream, 1 partitions per topic, 20000000 messages, 1000 messages per batch, 20000 message batches, 1000 bytes per message, 20GB of data processed
\x1b[0m
2026-03-20T10:05:19.783194Z INFO bench_report::prints: \x1b[32mProducers Results: Total throughput: 249.96 MB/s, 249960 messages/s, average throughput per Producer: 62.49 MB/s, p50 latency: 1.14 ms, p90 latency: 1.99 ms, p95 latency: 2.30 ms, p99 latency: 2.97 ms, p999 latency: 6.18 ms, p9999 latency: 13.36 ms, average latency: 1.30 ms, median latency: 1.14 ms, min: 0.51 ms, max: 13.47 ms, std dev: 0.26 ms, total time: 39.98 s\x1b[0m
2026-03-20T10:05:19.783203Z INFO bench_report::prints: \x1b[32mConsumers Results: Total throughput: 251.13 MB/s, 251131 messages/s, average throughput per Consumer: 62.78 MB/s, p50 latency: 1.79 ms, p90 latency: 17.87 ms, p95 latency: 76.84 ms, p99 latency: 147.42 ms, p999 latency: 168.97 ms, p9999 latency: 171.45 ms, average latency: 10.04 ms, median latency: 1.79 ms, min: 0.83 ms, max: 286.22 ms, std dev: 22.96 ms, total time: 39.92 s\x1b[0m
2026-03-20T10:05:19.783213Z INFO bench_report::prints: \x1b[31mAggregate Results: Total throughput: 501.09 MB/s, 501091 messages/s, average throughput per Actor: 62.64 MB/s, p50 latency: 1.46 ms, p90 latency: 9.93 ms, p95 latency: 39.57 ms, p99 latency: 75.19 ms, p999 latency: 87.57 ms, p9999 latency: 92.40 ms, average latency: 5.67 ms, median latency: 1.46 ms, min: 0.51 ms, max: 286.22 ms, std dev: 14.20 ms, total time: 39.98 s\x1b[0m
### on master branch:
\x1b[34mBenchmark: Pinned Producer And Consumer, 4 producers, 4 consumers, 4 streams, 1 topic per stream, 1 partitions per topic, 20000000 messages, 1000 messages per batch, 20000 message batches, 1000 bytes per message, 20GB of data processed \x1b[0m 2026-03-20T09:50:53.541140Z INFO bench_report::prints: \x1b[32mProducers Results: Total throughput: 249.96 MB/s, 249962 messages/s, average throughput per Producer: 62.49 MB/s, p50 latency: 0.91 ms, p90 latency: 1.53 ms, p95 latency: 1.85 ms, p99 latency: 2.89 ms, p999 latency: 11.57 ms, p9999 latency: 12.51 ms, average latency: 1.06 ms, median latency: 0.91 ms, min: 0.42 ms, max: 13.61 ms, std dev: 0.25 ms, total time: 39.98 s\x1b[0m 2026-03-20T09:50:53.541151Z INFO bench_report::prints: \x1b[32mConsumers Results: Total throughput: 252.47 MB/s, 252466 messages/s, average throughput per Consumer: 63.12 MB/s, p50 latency: 1.31 ms, p90 latency: 152.23 ms, p95 latency: 247.42 ms, p99 latency: 340.48 ms, p999 latency: 362.19 ms, p9999
latency: 364.22 ms, average latency: 34.25 ms, median latency: 1.31 ms, min: 0.70 ms, max: 526.35 ms, std dev: 64.63 ms, total time: 39.82 s\x1b[0m 2026-03-20T09:50:53.541162Z INFO bench_report::prints: \x1b[31mAggregate Results: Total throughput: 502.43 MB/s, 502428 messages/s, average throughput per Actor: 62.80 MB/s, p50 latency: 1.11 ms, p90 latency: 76.88 ms, p95 latency: 124.63 ms, p99 latency: 171.68 ms, p999 latency: 186.88 ms, p9999 latency: 188.36 ms, average latency: 17.66 ms, median latency: 1.11 ms, min: 0.42 ms, max: 526.35 ms, std dev: 38.38 ms, total time: 39.98 s\x1b[0m
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #2921:
URL: https://github.com/apache/iggy/pull/2921#issuecomment-4046751942
## [Codecov](https://app.codecov.io/gh/apache/iggy/pull/2921?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 64.94%. Comparing base ([`c151006`](https://app.codecov.io/gh/apache/iggy/commit/c15100698874c38f88f36a4bb62ba205c3e53db2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`143f961`](https://app.codecov.io/gh/apache/iggy/commit/143f9610c2ef590b7f4ad0ed39ed5eef0da88f33?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #2921 +/- ##
============================================
- Coverage 70.10% 64.94% -5.17%
Complexity 776 776
============================================
Files 1028 965 -63
Lines 85279 80389 -4890
Branches 62655 62494 -161
============================================
- Hits 59786 52207 -7579
- Misses 22966 25857 +2891
+ Partials 2527 2325 -202
```
| [Flag](https://app.codecov.io/gh/apache/iggy/pull/2921/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [csharp](https://app.codecov.io/gh/apache/iggy/pull/2921/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `12.56% <ø> (-55.08%)` | :arrow_down: |
| [node](https://app.codecov.io/gh/apache/iggy/pull/2921/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `87.29% <ø> (-4.09%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Files with missing lines](https://app.codecov.io/gh/apache/iggy/pull/2921?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [core/common/src/alloc/buffer.rs](https://app.codecov.io/gh/apache/iggy/pull/2921?src=pr&el=tree&filepath=core%2Fcommon%2Fsrc%2Falloc%2Fbuffer.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9jb21tb24vc3JjL2FsbG9jL2J1ZmZlci5ycw==) | `84.84% <ø> (+6.06%)` | :arrow_up: |
| [core/common/src/alloc/memory\_pool.rs](https://app.codecov.io/gh/apache/iggy/pull/2921?src=pr&el=tree&filepath=core%2Fcommon%2Fsrc%2Falloc%2Fmemory_pool.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9jb21tb24vc3JjL2FsbG9jL21lbW9yeV9wb29sLnJz) | `70.77% <ø> (+0.46%)` | :arrow_up: |
| [...ore/common/src/types/message/messages\_batch\_mut.rs](https://app.codecov.io/gh/apache/iggy/pull/2921?src=pr&el=tree&filepath=core%2Fcommon%2Fsrc%2Ftypes%2Fmessage%2Fmessages_batch_mut.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9jb21tb24vc3JjL3R5cGVzL21lc3NhZ2UvbWVzc2FnZXNfYmF0Y2hfbXV0LnJz) | `48.14% <ø> (+0.39%)` | :arrow_up: |
| [...e/common/src/types/segment\_storage/index\_reader.rs](https://app.codecov.io/gh/apache/iggy/pull/2921?src=pr&el=tree&filepath=core%2Fcommon%2Fsrc%2Ftypes%2Fsegment_storage%2Findex_reader.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9jb21tb24vc3JjL3R5cGVzL3NlZ21lbnRfc3RvcmFnZS9pbmRleF9yZWFkZXIucnM=) | `71.93% <ø> (-1.31%)` | :arrow_down: |
| [...ommon/src/types/segment\_storage/messages\_reader.rs](https://app.codecov.io/gh/apache/iggy/pull/2921?src=pr&el=tree&filepath=core%2Fcommon%2Fsrc%2Ftypes%2Fsegment_storage%2Fmessages_reader.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9jb21tb24vc3JjL3R5cGVzL3NlZ21lbnRfc3RvcmFnZS9tZXNzYWdlc19yZWFkZXIucnM=) | `80.64% <ø> (+3.42%)` | :arrow_up: |
| [.../binary/handlers/messages/send\_messages\_handler.rs](https://app.codecov.io/gh/apache/iggy/pull/2921?src=pr&el=tree&filepath=core%2Fserver%2Fsrc%2Fbinary%2Fhandlers%2Fmessages%2Fsend_messages_handler.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXIvc3JjL2JpbmFyeS9oYW5kbGVycy9tZXNzYWdlcy9zZW5kX21lc3NhZ2VzX2hhbmRsZXIucnM=) | `100.00% <ø> (ø)` | |
| [core/server/src/http/messages.rs](https://app.codecov.io/gh/apache/iggy/pull/2921?src=pr&el=tree&filepath=core%2Fserver%2Fsrc%2Fhttp%2Fmessages.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXIvc3JjL2h0dHAvbWVzc2FnZXMucnM=) | `83.78% <ø> (-0.84%)` | :arrow_down: |
... and [163 files with indirect coverage changes](https://app.codecov.io/gh/apache/iggy/pull/2921/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "tungtose (via GitHub)" <gi...@apache.org>.
tungtose commented on code in PR #2921:
URL: https://github.com/apache/iggy/pull/2921#discussion_r2936877789
##########
core/common/src/alloc/memory_pool.rs:
##########
@@ -16,26 +16,25 @@
* under the License.
*/
-use bytes::BytesMut;
+use aligned_vec::{AVec, ConstAlign};
use crossbeam::queue::ArrayQueue;
use human_repr::HumanCount;
use once_cell::sync::OnceCell;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use tracing::{info, trace, warn};
+pub const ALIGNMENT: usize = 4096;
Review Comment:
@hubcio Can I set this option to 512 or 4096, with 4096 as the default?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "tungtose (via GitHub)" <gi...@apache.org>.
tungtose commented on code in PR #2921:
URL: https://github.com/apache/iggy/pull/2921#discussion_r2936830414
##########
core/common/src/alloc/memory_pool.rs:
##########
@@ -16,26 +16,25 @@
* under the License.
*/
-use bytes::BytesMut;
+use aligned_vec::{AVec, ConstAlign};
use crossbeam::queue::ArrayQueue;
use human_repr::HumanCount;
use once_cell::sync::OnceCell;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use tracing::{info, trace, warn};
+pub const ALIGNMENT: usize = 4096;
Review Comment:
This is the issue I am referencing: https://github.com/DataDog/glommio/issues/7 and this [answer](https://unix.stackexchange.com/questions/761398/are-there-any-benefits-in-setting-a-hdds-logical-sector-size-to-4kn#:~:text=I%20still%20don't%20have,4096%20bytes%20won't%20hurt.&text=It%20can%20then%20be%20changed,with%20the%20manufacturer's%20proprietary%20tools.)
and for my naive thinking is that, 4096 is aligned to both 512 and 4096 but 512 is only aligned to 512. and most modern devices use 4096
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "tungtose (via GitHub)" <gi...@apache.org>.
tungtose commented on PR #2921:
URL: https://github.com/apache/iggy/pull/2921#issuecomment-4063195196
> > make_mutable in the HTTP path now copies buffers due to alignment incompatibility with Bytes
>
> can you elaborate?
Correct me if I'm wrong, to make the make_mutable function in the HTTP path zero copy, we need to change `IggyMessagesBatch` to store `PooledBuffer` instead of `Bytes`. However, `IggyMessagesBatch` is a core type with dependencies throughout the codebase, so this could be refactored in a separate PR if needed
Other than that, make_mutable is not in the hot path. If user is using the HTTP API for high-throughput message sending, they already have bigger problems than this one copy
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "tungtose (via GitHub)" <gi...@apache.org>.
tungtose commented on PR #2921:
URL: https://github.com/apache/iggy/pull/2921#issuecomment-4083508290
> @tungtose did you check the performance? is there any difference?
@hubcio here is the bench result running `run-benches.sh`:
### on main:
2026-03-18T13:40:40.123993Z INFO bench_report::prints: Producers Results: Total throughput: 3854.07 MB/s, 3854076 messages/s, average throughput per Producer: 481.76 MB/s, p50 latency: 1.30 ms, p90 latency: 2.75 ms, p95 latency: 7.14 ms, p99 latency: 18.61 ms, p999 latency: 44.92 ms, p9999 latency: 91.50 ms, average latency: 2.12 ms, median latency: 1.30 ms, min: 0.51 ms, max: 209.82 ms, std dev: 2.34 ms, total time: 2.50 s
Running iggy-bench pinned-consumer tcp...
Poll results:
2026-03-18T13:40:44.577717Z INFO bench_report::prints: Consumers Results: Total throughput: 2748.06 MB/s, 2748056 messages/s, average throughput per Consumer: 343.51 MB/s, p50 latency: 2.73 ms, p90 latency: 4.15 ms, p95 latency: 4.62 ms, p99 latency: 5.60 ms, p999 latency: 6.58 ms, p9999 latency: 7.35 ms, average latency: 2.84 ms, median latency: 2.73 ms, min: 1.22 ms, max: 8.01 ms, std dev: 0.44 ms, total time: 3.17 s
### on this branch:
Send results:
2026-03-18T11:49:46.897632Z INFO bench_report::prints: Producers Results: Total throughput: 4115.45 MB/s, 4115452 messages/s, average throughput per Producer: 514.43 MB/s, p50 latency: 1.18 ms, p90 latency: 2.44 ms, p95 latency: 3.30 ms, p99 latency: 18.39 ms, p999 latency: 61.13 ms, p9999 latency: 115.81 ms, average latency: 1.94 ms, median latency: 1.18 ms, min: 0.38 ms, max: 213.28 ms, std dev: 2.38 ms, total time: 2.22 s
Running iggy-bench pinned-consumer tcp...
Poll results:
2026-03-18T11:49:51.299828Z INFO bench_report::prints: Consumers Results: Total throughput: 2920.55 MB/s, 2920547 messages/s, average throughput per Consumer: 365.07 MB/s, p50 latency: 2.54 ms, p90 latency: 4.05 ms, p95 latency: 4.44 ms, p99 latency: 5.72 ms, p999 latency: 9.07 ms, p9999 latency: 11.36 ms, average latency: 2.68 ms, median latency: 2.54 ms, min: 0.73 ms, max: 19.75 ms, std dev: 0.66 ms, total time: 3.10 s
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "numinnex (via GitHub)" <gi...@apache.org>.
numinnex commented on code in PR #2921:
URL: https://github.com/apache/iggy/pull/2921#discussion_r2962186900
##########
core/common/src/alloc/memory_pool.rs:
##########
@@ -16,26 +16,25 @@
* under the License.
*/
-use bytes::BytesMut;
+use aligned_vec::{AVec, ConstAlign};
use crossbeam::queue::ArrayQueue;
use human_repr::HumanCount;
use once_cell::sync::OnceCell;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use tracing::{info, trace, warn};
+pub const ALIGNMENT: usize = 4096;
Review Comment:
I think we should stick to 4096, for the reasons that you've mentioned.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on PR #2921:
URL: https://github.com/apache/iggy/pull/2921#issuecomment-4097174453
so the results for producers:
| Metric | Master | PR | Delta |
|--------|--------|----|-------|
| p50 | 0.91 ms | 1.14 ms | +25% |
| p90 | 1.53 ms | 1.99 ms | +30% |
| p99 | 2.89 ms | 2.97 ms | +3% |
consumers:
| Metric | Master | PR | Delta |
|--------|--------|----|-------|
| p50 | 1.31 ms | 1.79 ms | +37% |
| p90 | 152.23 ms | 17.87 ms | -88% |
| p99 | 340.48 ms | 147.42 ms | -57% |
| max | 526.35 ms | 286.22 ms | -46% |
| std dev | 64.63 ms | 22.96 ms | -64% |
p50 regressed ~25-37%. any clue why? but tail latencies (p90+) improved 57-88%, especially on consumer side.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(server): aligned buffer memory pool [iggy]
Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on PR #2921:
URL: https://github.com/apache/iggy/pull/2921#issuecomment-4116747088
@numinnex what are we doing with this one?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org