From 4aaf42bba526ed1966e45f5eabd36fcbd34f17c2 Mon Sep 17 00:00:00 2001 From: iamazy Date: Sat, 25 Feb 2023 00:14:03 +0800 Subject: [PATCH] build: add unit tests for incremental fetch (#28) * docs: update flamegraph * build: add unit tests * ci: update merge conditions * feat: make fetch records more controllable. * chore: remove dead code. * fix(fetch): fetch records in order. * build: add unit tests for incremental fetch * chore(deps): bump `kafka-protocol` to 0.5.1 --- .mergify.yml | 4 +- Cargo.toml | 6 +- README.md | 2 +- benches/flamegraph.svg | 491 ++++++++++++++++++++++ benchmark/flamegraph.svg | 491 ---------------------- examples/simple_consumer.rs | 6 +- examples/simple_producer.rs | 2 +- src/consumer/fetch_session.rs | 751 +++++++++++++++++++++++++++++++++- src/consumer/fetcher.rs | 90 +++- src/consumer/mod.rs | 123 ++++-- src/coordinator/consumer.rs | 72 +++- src/coordinator/mod.rs | 2 + src/error.rs | 4 +- src/executor/mod.rs | 6 +- src/lib.rs | 6 +- 15 files changed, 1466 insertions(+), 590 deletions(-) create mode 100644 benches/flamegraph.svg delete mode 100644 benchmark/flamegraph.svg diff --git a/.mergify.yml b/.mergify.yml index 715cadb..42c3dcf 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -18,8 +18,8 @@ pull_request_rules: conditions: - or: - and: - - "#approved-reviews-by>=0" - - "#changes-requested-reviews-by=0" + - "#approved-reviews-by>=1" + - "#changes-requested-reviews-by=1" - -draft - check-success=fmt - check-success=test diff --git a/Cargo.toml b/Cargo.toml index 486f08e..cf9b225 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ fnv = "1" futures = "0.3" fxhash = "0.2" indexmap = "1" -kafka-protocol = { git = "https://github.com/iamazy/kafka-protocol-rs", branch = "trunk"} +kafka-protocol = { git = "https://github.com/iamazy/kafka-protocol-rs", rev = "d8a289bbdebd71f89d52838810303902a7368773"} native-tls = "0.2" pin-project-lite = "0.2" rand = "0.8" @@ -37,9 +37,11 @@ tokio-util = { version = "0.7", features = ["codec"], optional = true } tokio-native-tls = { version = "0.3", optional = true } tracing = "0.1" url = "2.1" -uuid = "0.8" +uuid = "1.3" [dev-dependencies] +rand = "0.8" +pretty_assertions = "1" tokio = { version = "1", features = ["full"] } tracing-subscriber = "0.3" diff --git a/README.md b/README.md index 2ec4cad..32555e5 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Examples can be found in [`examples`](https://github.com/iamazy/kafkas/blob/main ## Flame graph -flamegraph +flamegraph ## Rust version requirements diff --git a/benches/flamegraph.svg b/benches/flamegraph.svg new file mode 100644 index 0000000..18f07ae --- /dev/null +++ b/benches/flamegraph.svg @@ -0,0 +1,491 @@ +Flame Graph Reset ZoomSearch libsystem_malloc.dylib`0x7ff814766e2b (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766e3a (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766e45 (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766e57 (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766e60 (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766e70 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147806f8 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780a47 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780a48 (30 samples, 0.02%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (125 samples, 0.07%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (211 samples, 0.12%)simple_producer`<&mut S as futures_sink::Sink<Item>>::start_send (66 samples, 0.04%)simple_producer`DYLD-STUB$$memcpy (40 samples, 0.02%)simple_producer`__rdl_dealloc (60 samples, 0.03%)simple_producer`alloc::fmt::format::format_inner (40 samples, 0.02%)simple_producer`bytes::bytes::Bytes::copy_from_slice (67 samples, 0.04%)simple_producer`core::ptr::drop_in_place<kafkas::producer::Producer<kafkas::executor::TokioExecutor>::send<simple_producer::TestData>::{{closure}}> (35 samples, 0.02%)simple_producer`dashmap::DashMap<K,V,S>::get (30 samples, 0.02%)simple_producer`futures_channel::mpsc::decode_state (22 samples, 0.01%)simple_producer`kafkas::producer::TopicProducer<Exe>::try_push::_{{closure}} (46 samples, 0.03%)libdyld.dylib`0x7ff81491b9f1 (41 samples, 0.02%)libdyld.dylib`0x7ff81491ba03 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766350 (93 samples, 0.05%)libsystem_malloc.dylib`0x7ff8147665b5 (73 samples, 0.04%)libsystem_malloc.dylib`0x7ff8147806fe (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780705 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478070f (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff81478072f (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478074f (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147807e0 (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147807f2 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780802 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780816 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780826 (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff814780835 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780851 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478086d (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780879 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780887 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780891 (354 samples, 0.19%)libsystem_malloc.dylib`0x7ff8147808c2 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147808d5 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147808e5 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780901 (178 samples, 0.10%)libsystem_platform.dylib`_platform_bzero$VARIANT$Haswell (147 samples, 0.08%)libsystem_malloc.dylib`0x7ff814780912 (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff814780934 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff814780947 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478095b (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478096c (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478099b (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff81478099e (228 samples, 0.12%)libsystem_malloc.dylib`0x7ff8147809aa (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147809b7 (547 samples, 0.30%)libsystem_malloc.dylib`0x7ff814780a39 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff814782cdd (97 samples, 0.05%)libsystem_malloc.dylib`0x7ff814782cf1 (88 samples, 0.05%)libsystem_malloc.dylib`0x7ff814782cfd (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff814782d04 (73 samples, 0.04%)libsystem_malloc.dylib`0x7ff814782d0d (88 samples, 0.05%)libsystem_malloc.dylib`0x7ff814782d19 (75 samples, 0.04%)libsystem_malloc.dylib`0x7ff814782d1d (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff814782d28 (72 samples, 0.04%)libsystem_malloc.dylib`0x7ff814789472 (25 samples, 0.01%)libsystem_platform.dylib`DYLD-STUB$$_platform_bzero (45 samples, 0.02%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (80 samples, 0.04%)libsystem_platform.dylib`_platform_bzero$VARIANT$Haswell (52 samples, 0.03%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (1,809 samples, 0.99%)libsystem_malloc.dylib`0x7ff814766393 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766399 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147663a0 (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147663ca (37 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147663d9 (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147663dd (75 samples, 0.04%)libsystem_malloc.dylib`0x7ff8147663e7 (420 samples, 0.23%)libsystem_malloc.dylib`0x7ff8147663eb (34 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147663f8 (40 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766407 (386 samples, 0.21%)libsystem_malloc.dylib`0x7ff81476640a (36 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766414 (31 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476641b (392 samples, 0.21%)libsystem_malloc.dylib`0x7ff81476642b (33 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766439 (33 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766445 (33 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766452 (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766467 (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766484 (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766493 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147664a4 (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147664ce (193 samples, 0.11%)libsystem_malloc.dylib`0x7ff8147664d9 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147664e7 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147664ef (789 samples, 0.43%)libsystem_malloc.dylib`0x7ff814766509 (356 samples, 0.19%)libsystem_malloc.dylib`0x7ff814780669 (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476659d (41 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147665a4 (34 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147665ae (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147665d8 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147665e4 (38 samples, 0.02%)simple_producer`futures_channel::mpsc::decode_state (62 samples, 0.03%)simple_producer`futures_channel::mpsc::encode_state (67 samples, 0.04%)simple_producer`<&mut S as futures_sink::Sink<Item>>::start_send (8,286 samples, 4.53%)simpl..simple_producer`futures_core::task::__internal::atomic_waker::AtomicWaker::wake (1,715 samples, 0.94%)simple_producer`<bytes::bytes::Bytes as core::cmp::PartialEq>::eq (38 samples, 0.02%)simple_producer`<bytes::bytes::Bytes as core::convert::From<alloc::vec::Vec<u8>>>::from (24 samples, 0.01%)simple_producer`<kafkas::producer::partitioner::PartitionerSelector as kafkas::producer::partitioner::PartitionSelector>::select (27 samples, 0.01%)simple_producer`<string::String<T> as core::hash::Hash>::hash (93 samples, 0.05%)simple_producer`DYLD-STUB$$memcpy (33 samples, 0.02%)simple_producer`__rdl_alloc (176 samples, 0.10%)simple_producer`__rust_alloc (59 samples, 0.03%)libsystem_malloc.dylib`0x7ff814766393 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766399 (34 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147663a0 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147663b2 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147663ca (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147663d9 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147663dd (85 samples, 0.05%)libsystem_malloc.dylib`0x7ff8147663e7 (462 samples, 0.25%)libsystem_malloc.dylib`0x7ff8147663eb (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766407 (116 samples, 0.06%)libsystem_malloc.dylib`0x7ff81476640a (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766414 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476641b (193 samples, 0.11%)libsystem_malloc.dylib`0x7ff81476642b (31 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766439 (31 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766445 (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766452 (42 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766467 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766484 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766493 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147664a4 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147664d9 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147664e7 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147664ef (390 samples, 0.21%)libsystem_malloc.dylib`0x7ff8147664fc (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147664fe (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766504 (49 samples, 0.03%)libsystem_malloc.dylib`0x7ff814766509 (543 samples, 0.30%)libsystem_malloc.dylib`0x7ff814780669 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476659d (33 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147665ae (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147665b9 (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147665c6 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147665d8 (24 samples, 0.01%)simple_producer`<&mut W as core::fmt::Write>::write_str (55 samples, 0.03%)simple_producer`core::fmt::num::imp::_<impl core::fmt::Display for i32>::fmt (177 samples, 0.10%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (30 samples, 0.02%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (35 samples, 0.02%)simple_producer`<&mut W as core::fmt::Write>::write_str (443 samples, 0.24%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (163 samples, 0.09%)simple_producer`core::fmt::Formatter::pad_integral (31 samples, 0.02%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (22 samples, 0.01%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (33 samples, 0.02%)simple_producer`<&mut W as core::fmt::Write>::write_str (364 samples, 0.20%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (137 samples, 0.07%)simple_producer`core::fmt::Formatter::pad_integral (413 samples, 0.23%)simple_producer`core::fmt::Formatter::pad_integral::write_prefix (81 samples, 0.04%)simple_producer`alloc::fmt::format::format_inner (6,265 samples, 3.42%)sim..simple_producer`core::fmt::write (2,791 samples, 1.53%)simple_producer`core::fmt::num::imp::_<impl core::fmt::Display for i32>::fmt (1,805 samples, 0.99%)simple_producer`core::fmt::Formatter::pad_integral (174 samples, 0.10%)simple_producer`core::fmt::Formatter::pad_integral::write_prefix (174 samples, 0.10%)libsystem_malloc.dylib`0x7ff814766393 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766399 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147663a0 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147663b2 (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147663d9 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147663dd (118 samples, 0.06%)libsystem_malloc.dylib`0x7ff8147663e7 (440 samples, 0.24%)libsystem_malloc.dylib`0x7ff8147663eb (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147663f8 (43 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766407 (119 samples, 0.07%)libsystem_malloc.dylib`0x7ff81476640a (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766414 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476641b (72 samples, 0.04%)libsystem_malloc.dylib`0x7ff81476642b (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766439 (31 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766445 (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766452 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766467 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766484 (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766493 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147664a4 (33 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147664c1 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147664ce (294 samples, 0.16%)libsystem_malloc.dylib`0x7ff8147664ef (518 samples, 0.28%)libsystem_malloc.dylib`0x7ff814766509 (227 samples, 0.12%)libsystem_malloc.dylib`0x7ff81476654a (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476655a (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476678d (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780669 (87 samples, 0.05%)libsystem_malloc.dylib`0x7ff81476659d (115 samples, 0.06%)libsystem_malloc.dylib`0x7ff8147665a4 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147665ae (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147665e4 (70 samples, 0.04%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (162 samples, 0.09%)simple_producer`<bytes::bytes::Bytes as core::convert::From<alloc::vec::Vec<u8>>>::from (448 samples, 0.24%)simple_producer`alloc::vec::Vec<T,A>::into_boxed_slice (132 samples, 0.07%)simple_producer`bytes::bytes::Bytes::copy_from_slice (3,720 samples, 2.03%)s..simple_producer`alloc::vec::Vec<T,A>::into_boxed_slice (54 samples, 0.03%)simple_producer`core::fmt::write (38 samples, 0.02%)simple_producer`core::ptr::drop_in_place<kafkas::producer::Producer<kafkas::executor::TokioExecutor>::send<simple_producer::TestData>::{{closure}}> (98 samples, 0.05%)libsystem_platform.dylib`DYLD-STUB$$_platform_memcmp (25 samples, 0.01%)libsystem_platform.dylib`_platform_memcmp$VARIANT$Base (29 samples, 0.02%)libsystem_pthread.dylib`cthread_yield (36 samples, 0.02%)simple_producer`<bytes::bytes::Bytes as core::cmp::PartialEq>::eq (353 samples, 0.19%)libsystem_platform.dylib`_platform_memcmp$VARIANT$Base (210 samples, 0.11%)simple_producer`<string::String<T> as core::hash::Hash>::hash (496 samples, 0.27%)simple_producer`DYLD-STUB$$memcmp (29 samples, 0.02%)libsystem_kernel.dylib`__psynch_cvwait (2,372 samples, 1.30%)libsystem_kernel.dylib`swtch_pri (4,087 samples, 2.23%)l..libsystem_pthread.dylib`_pthread_mutex_droplock (26 samples, 0.01%)libsystem_pthread.dylib`_pthread_cond_wait (111 samples, 0.06%)libsystem_pthread.dylib`cthread_yield (76 samples, 0.04%)simple_producer`dashmap::lock::RawRwLock::lock_shared_slow (8,478 samples, 4.63%)simpl..simple_producer`dashmap::DashMap<K,V,S>::get (11,362 samples, 6.21%)simple_p..simple_producer`std::thread::yield_now (19 samples, 0.01%)simple_producer`futures_channel::mpsc::decode_state (76 samples, 0.04%)simple_producer`futures_channel::mpsc::encode_state (40 samples, 0.02%)simple_producer`futures_core::task::__internal::atomic_waker::AtomicWaker::wake (39 samples, 0.02%)libsystem_kernel.dylib`madvise (50 samples, 0.03%)libsystem_kernel.dylib`_kernelrpc_mach_vm_deallocate_trap (493 samples, 0.27%)libsystem_malloc.dylib`0x7ff81477aa5f (550 samples, 0.30%)libsystem_malloc.dylib`0x7ff8147717a3 (496 samples, 0.27%)libsystem_malloc.dylib`0x7ff814772ce7 (496 samples, 0.27%)simple_producer`<alloc::vec::Vec<T,A> as core::ops::drop::Drop>::drop (45 samples, 0.02%)simple_producer`__rdl_dealloc (22 samples, 0.01%)libsystem_kernel.dylib`madvise (218 samples, 0.12%)libsystem_malloc.dylib`0x7ff814780dbf (220 samples, 0.12%)libsystem_malloc.dylib`0x7ff8147700c9 (223 samples, 0.12%)libsystem_malloc.dylib`0x7ff814780891 (142 samples, 0.08%)libsystem_malloc.dylib`0x7ff8147808c6 (359 samples, 0.20%)libsystem_malloc.dylib`0x7ff814780901 (57 samples, 0.03%)libsystem_platform.dylib`_platform_bzero$VARIANT$Haswell (49 samples, 0.03%)libsystem_malloc.dylib`0x7ff81478099e (57 samples, 0.03%)libsystem_malloc.dylib`0x7ff8147809b7 (205 samples, 0.11%)simple_producer`core::ptr::drop_in_place<kafka_protocol::records::Record> (1,772 samples, 0.97%)simple_producer`bytes::bytes::promotable_even_drop (1,495 samples, 0.82%)simple_producer`<core::sync::atomic::AtomicPtr<T> as bytes::loom::sync::atomic::AtomicMut<T>>::with_mut (60 samples, 0.03%)simple_producer`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (156 samples, 0.09%)simple_producer`crc::crc32::_<impl crc::Crc<u32>>::checksum (2,351 samples, 1.29%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (99 samples, 0.05%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (107 samples, 0.06%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (1,036 samples, 0.57%)libsystem_malloc.dylib`0x7ff81477122e (39 samples, 0.02%)libsystem_malloc.dylib`0x7ff814770794 (39 samples, 0.02%)libsystem_kernel.dylib`_kernelrpc_mach_vm_map_trap (39 samples, 0.02%)libsystem_malloc.dylib`0x7ff814767517 (47 samples, 0.03%)libsystem_malloc.dylib`0x7ff81476a765 (50 samples, 0.03%)libsystem_malloc.dylib`0x7ff81476a7a6 (578 samples, 0.32%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (578 samples, 0.32%)libsystem_kernel.dylib`_kernelrpc_mach_vm_deallocate_trap (91 samples, 0.05%)simple_producer`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (2,556 samples, 1.40%)simple_producer`bytes::bytes_mut::BytesMut::reserve_inner (776 samples, 0.42%)simple_producer`alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle (773 samples, 0.42%)simple_producer`alloc::raw_vec::finish_grow (769 samples, 0.42%)libsystem_malloc.dylib`0x7ff814768235 (762 samples, 0.42%)libsystem_malloc.dylib`0x7ff814769698 (761 samples, 0.42%)libsystem_malloc.dylib`0x7ff81476a7b3 (106 samples, 0.06%)libsystem_malloc.dylib`0x7ff81477aa5f (104 samples, 0.06%)libsystem_malloc.dylib`0x7ff8147717a3 (92 samples, 0.05%)libsystem_malloc.dylib`0x7ff814772ce7 (92 samples, 0.05%)simple_producer`DYLD-STUB$$memcpy (58 samples, 0.03%)simple_producer`kafka_protocol::records::RecordBatchEncoder::encode (6,702 samples, 3.66%)simp..simple_producer`kafka_protocol::records::RecordBatchEncoder::encode_new_records (3,330 samples, 1.82%)s..simple_producer`kafka_protocol::records::Record::compute_size_new (195 samples, 0.11%)simple_producer`kafkas::producer::batch::ProducerBatch::flush (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff814767517 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81477122e (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff814770794 (22 samples, 0.01%)libsystem_kernel.dylib`_kernelrpc_mach_vm_map_trap (22 samples, 0.01%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (21 samples, 0.01%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (57 samples, 0.03%)simple_producer`core::ptr::drop_in_place<futures_channel::oneshot::Sender<core::result::Result<kafkas::producer::RecordMetadata,kafkas::error::Error>>> (26 samples, 0.01%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (341 samples, 0.19%)simple_producer`kafkas::producer::Producer<Exe>::send_raw::_{{closure}} (15,214 samples, 8.32%)simple_produ..simple_producer`kafkas::producer::batch::Thunk::done (5,480 samples, 3.00%)sim..simple_producer`futures_channel::oneshot::Sender<T>::send (5,228 samples, 2.86%)si..simple_producer`core::ptr::drop_in_place<futures_channel::oneshot::Sender<core::result::Result<kafkas::producer::RecordMetadata,kafkas::error::Error>>> (2,178 samples, 1.19%)libsystem_malloc.dylib`0x7ff814766350 (47 samples, 0.03%)libsystem_malloc.dylib`0x7ff814767419 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff814767422 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff814782cdd (31 samples, 0.02%)libsystem_malloc.dylib`0x7ff814782cf1 (40 samples, 0.02%)libsystem_malloc.dylib`0x7ff814782cfd (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff814782d04 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff814782d0d (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff814782d19 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff814782d28 (29 samples, 0.02%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (104 samples, 0.06%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (517 samples, 0.28%)simple_producer`<kafkas::producer::aggregator::RecordAggregator as kafkas::producer::aggregator::Aggregator>::try_push (76 samples, 0.04%)simple_producer`dashmap::DashMap<K,V,S>::get (19 samples, 0.01%)simple_producer`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (68 samples, 0.04%)libsystem_platform.dylib`DYLD-STUB$$_platform_memcmp (22 samples, 0.01%)libsystem_platform.dylib`_platform_memcmp$VARIANT$Base (39 samples, 0.02%)simple_producer`<bytes::bytes::Bytes as core::cmp::PartialEq>::eq (362 samples, 0.20%)libsystem_platform.dylib`_platform_memcmp$VARIANT$Base (241 samples, 0.13%)simple_producer`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (595 samples, 0.33%)simple_producer`dashmap::DashMap<K,V,S>::get (4,178 samples, 2.28%)s..simple_producer`hashbrown::map::make_hash (1,217 samples, 0.67%)simple_producer`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (515 samples, 0.28%)simple_producer`kafkas::metadata::Cluster::available_partitions (4,507 samples, 2.46%)si..simple_producer`hashbrown::map::make_hash (25 samples, 0.01%)simple_producer`<bytes::bytes::Bytes as core::cmp::PartialEq>::eq (28 samples, 0.02%)simple_producer`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (109 samples, 0.06%)libsystem_platform.dylib`DYLD-STUB$$_platform_memcmp (28 samples, 0.02%)libsystem_platform.dylib`_platform_memcmp$VARIANT$Base (39 samples, 0.02%)simple_producer`<bytes::bytes::Bytes as core::cmp::PartialEq>::eq (393 samples, 0.21%)libsystem_platform.dylib`_platform_memcmp$VARIANT$Base (224 samples, 0.12%)simple_producer`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (583 samples, 0.32%)simple_producer`DYLD-STUB$$memcmp (30 samples, 0.02%)simple_producer`dashmap::DashMap<K,V,S>::get (4,871 samples, 2.66%)si..simple_producer`hashbrown::map::make_hash (1,273 samples, 0.70%)simple_producer`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (569 samples, 0.31%)simple_producer`<kafkas::producer::partitioner::RoundRobinPartitioner as kafkas::producer::partitioner::PartitionSelector>::select (12,517 samples, 6.84%)simple_pr..simple_producer`kafkas::metadata::Cluster::partitions (5,301 samples, 2.90%)si..simple_producer`hashbrown::map::make_hash (34 samples, 0.02%)simple_producer`kafkas::metadata::Cluster::available_partitions (56 samples, 0.03%)simple_producer`<kafkas::producer::partitioner::PartitionerSelector as kafkas::producer::partitioner::PartitionSelector>::select (12,687 samples, 6.94%)simple_pr..simple_producer`kafkas::metadata::Cluster::partitions (53 samples, 0.03%)simple_producer`<kafkas::producer::partitioner::RoundRobinPartitioner as kafkas::producer::partitioner::PartitionSelector>::select (67 samples, 0.04%)simple_producer`DYLD-STUB$$memcpy (43 samples, 0.02%)simple_producer`__rdl_alloc (83 samples, 0.05%)libsystem_malloc.dylib`0x7ff814766393 (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766399 (37 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147663a0 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147663b2 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476653a (81 samples, 0.04%)libsystem_malloc.dylib`0x7ff814766543 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff814767428 (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff814767430 (31 samples, 0.02%)libsystem_malloc.dylib`0x7ff814767444 (34 samples, 0.02%)libsystem_malloc.dylib`0x7ff814767452 (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476869a (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147686a2 (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147686aa (31 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147686bb (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147686c2 (81 samples, 0.04%)libsystem_malloc.dylib`0x7ff8147686cd (984 samples, 0.54%)libsystem_malloc.dylib`0x7ff8147686ce (36 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147686d4 (711 samples, 0.39%)libsystem_malloc.dylib`0x7ff8147686e2 (56 samples, 0.03%)libsystem_malloc.dylib`0x7ff8147686ed (36 samples, 0.02%)libsystem_malloc.dylib`0x7ff814768703 (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff814768712 (1,363 samples, 0.75%)libsystem_kernel.dylib`__ulock_wait (2,457 samples, 1.34%)libsystem_malloc.dylib`0x7ff814768721 (2,776 samples, 1.52%)libsystem_platform.dylib`_os_unfair_lock_lock_slow (300 samples, 0.16%)libsystem_malloc.dylib`0x7ff814768725 (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147687c8 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147687cb (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147687d9 (33 samples, 0.02%)libsystem_malloc.dylib`0x7ff814768ddc (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff814768de2 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff814768de9 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff814768e05 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff814768e0a (33 samples, 0.02%)libsystem_malloc.dylib`0x7ff814768e6b (48 samples, 0.03%)libsystem_malloc.dylib`0x7ff814768e6e (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff814768e71 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff814768f9d (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff814768fd0 (41 samples, 0.02%)libsystem_malloc.dylib`0x7ff814768fd7 (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476904b (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff814769053 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476905b (35 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476905d (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff814769064 (46 samples, 0.03%)libsystem_malloc.dylib`0x7ff81476908d (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147690a2 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147690b0 (34 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147690b4 (357 samples, 0.20%)libsystem_malloc.dylib`0x7ff8147690bf (37 samples, 0.02%)libsystem_malloc.dylib`0x7ff814769136 (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147885c5 (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147885d4 (33 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147885f6 (390 samples, 0.21%)libsystem_malloc.dylib`0x7ff814769155 (638 samples, 0.35%)libsystem_malloc.dylib`0x7ff81476919e (89 samples, 0.05%)libsystem_malloc.dylib`0x7ff8147691a1 (234 samples, 0.13%)libsystem_malloc.dylib`0x7ff8147691d8 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147691e6 (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147691ed (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476921c (103 samples, 0.06%)libsystem_malloc.dylib`0x7ff81476957d (35 samples, 0.02%)libsystem_malloc.dylib`0x7ff814769585 (36 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147695f2 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476960d (55 samples, 0.03%)libsystem_malloc.dylib`0x7ff814769617 (35 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476962d (53 samples, 0.03%)libsystem_malloc.dylib`0x7ff814769638 (45 samples, 0.02%)libsystem_malloc.dylib`0x7ff814769646 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff814769652 (37 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147687de (3,838 samples, 2.10%)l..libsystem_malloc.dylib`0x7ff814768a89 (31 samples, 0.02%)libsystem_malloc.dylib`0x7ff814768a98 (1,591 samples, 0.87%)libsystem_kernel.dylib`__ulock_wake (3,126 samples, 1.71%)libsystem_malloc.dylib`0x7ff814768aa2 (3,219 samples, 1.76%)libsystem_platform.dylib`_os_unfair_lock_unlock_slow (63 samples, 0.03%)libsystem_malloc.dylib`0x7ff814768aa9 (72 samples, 0.04%)libsystem_malloc.dylib`0x7ff814768ab5 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff814768b2c (31 samples, 0.02%)libsystem_platform.dylib`os_unfair_lock_lock_with_options (91 samples, 0.05%)libsystem_malloc.dylib`0x7ff814767464 (15,458 samples, 8.45%)libsystem_ma..libsystem_platform.dylib`os_unfair_lock_unlock (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff814767517 (40 samples, 0.02%)libsystem_malloc.dylib`0x7ff814767522 (59 samples, 0.03%)libsystem_malloc.dylib`0x7ff81476754e (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff814767559 (43 samples, 0.02%)libsystem_malloc.dylib`0x7ff814768696 (37 samples, 0.02%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (68 samples, 0.04%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (2,650 samples, 1.45%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (3,834 samples, 2.10%)l..libsystem_malloc.dylib`0x7ff81476a671 (42 samples, 0.02%)libsystem_malloc.dylib`0x7ff814772ddf (38 samples, 0.02%)libsystem_kernel.dylib`vm_allocate (38 samples, 0.02%)libsystem_kernel.dylib`_kernelrpc_mach_vm_allocate_trap (38 samples, 0.02%)libsystem_malloc.dylib`0x7ff814770794 (53 samples, 0.03%)libsystem_kernel.dylib`_kernelrpc_mach_vm_map_trap (52 samples, 0.03%)libsystem_malloc.dylib`0x7ff81477122e (56 samples, 0.03%)libsystem_malloc.dylib`0x7ff81476a765 (59 samples, 0.03%)libsystem_malloc.dylib`0x7ff814767517 (59 samples, 0.03%)libsystem_malloc.dylib`0x7ff81476a7a6 (5,232 samples, 2.86%)li..libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (5,232 samples, 2.86%)li..libsystem_kernel.dylib`madvise (28 samples, 0.02%)libsystem_kernel.dylib`_kernelrpc_mach_vm_deallocate_trap (384 samples, 0.21%)libsystem_malloc.dylib`0x7ff814772ce7 (387 samples, 0.21%)libsystem_malloc.dylib`0x7ff814769698 (5,764 samples, 3.15%)lib..libsystem_malloc.dylib`0x7ff81476a7b3 (429 samples, 0.23%)libsystem_malloc.dylib`0x7ff81477aa5f (426 samples, 0.23%)libsystem_malloc.dylib`0x7ff8147717a3 (388 samples, 0.21%)simple_producer`<kafkas::producer::aggregator::RecordAggregator as kafkas::producer::aggregator::Aggregator>::try_push (9,992 samples, 5.46%)simple_..simple_producer`alloc::raw_vec::RawVec<T,A>::reserve_for_push (5,776 samples, 3.16%)sim..simple_producer`alloc::raw_vec::finish_grow (5,770 samples, 3.15%)sim..libsystem_malloc.dylib`0x7ff814768235 (5,765 samples, 3.15%)lib..simple_producer`DYLD-STUB$$memcpy (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476a671 (42 samples, 0.02%)libsystem_malloc.dylib`0x7ff814772ddf (40 samples, 0.02%)libsystem_kernel.dylib`vm_allocate (40 samples, 0.02%)libsystem_kernel.dylib`_kernelrpc_mach_vm_allocate_trap (40 samples, 0.02%)libsystem_malloc.dylib`0x7ff81477122e (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff814770794 (26 samples, 0.01%)libsystem_kernel.dylib`_kernelrpc_mach_vm_map_trap (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476a765 (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff814767517 (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476a7a6 (606 samples, 0.33%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (606 samples, 0.33%)libsystem_kernel.dylib`madvise (19 samples, 0.01%)libsystem_kernel.dylib`_kernelrpc_mach_vm_deallocate_trap (211 samples, 0.12%)libsystem_malloc.dylib`0x7ff814769698 (915 samples, 0.50%)libsystem_malloc.dylib`0x7ff81476a7b3 (234 samples, 0.13%)libsystem_malloc.dylib`0x7ff81477aa5f (234 samples, 0.13%)libsystem_malloc.dylib`0x7ff8147717a3 (213 samples, 0.12%)libsystem_malloc.dylib`0x7ff814772ce7 (213 samples, 0.12%)libsystem_malloc.dylib`0x7ff814768235 (918 samples, 0.50%)simple_producer`kafkas::producer::TopicProducer<Exe>::try_push::_{{closure}} (49,883 samples, 27.27%)simple_producer`kafkas::producer::TopicProdu..simple_producer`kafkas::producer::batch::ProducerBatch::try_push (32,071 samples, 17.53%)simple_producer`kafkas::pro..simple_producer`alloc::raw_vec::RawVec<T,A>::reserve_for_push (923 samples, 0.50%)simple_producer`alloc::raw_vec::finish_grow (921 samples, 0.50%)simple_producer`kafkas::producer::batch::ProducerBatch::try_push (49 samples, 0.03%)simple_producer`simple_producer::main::_{{closure}} (104,223 samples, 56.97%)simple_producer`simple_producer::main::_{{closure}}dyld`start (105,240 samples, 57.53%)dyld`startsimple_producer`main (105,239 samples, 57.53%)simple_producer`mainsimple_producer`std::rt::lang_start_internal (105,239 samples, 57.53%)simple_producer`std::rt::lang_start_internalsimple_producer`std::rt::lang_start::_{{closure}} (105,239 samples, 57.53%)simple_producer`std::rt::lang_start::_{{closure}}simple_producer`std::sys_common::backtrace::__rust_begin_short_backtrace (105,239 samples, 57.53%)simple_producer`std::sys_common::backtrace::__rust_begin_short_backtracesimple_producer`simple_producer::main (105,239 samples, 57.53%)simple_producer`simple_producer::mainsimple_producer`tokio::runtime::runtime::Runtime::block_on (105,238 samples, 57.53%)simple_producer`tokio::runtime::runtime::Runtime::block_onsimple_producer`tokio::runtime::scheduler::multi_thread::MultiThread::block_on (105,238 samples, 57.53%)simple_producer`tokio::runtime::scheduler::multi_thread::MultiThread::block_onsimple_producer`tokio::runtime::park::CachedParkThread::block_on (105,237 samples, 57.53%)simple_producer`tokio::runtime::park::CachedParkThread::block_onsimple_producer`tokio::runtime::scheduler::multi_thread::idle::Idle::transition_worker_to_parked (31 samples, 0.02%)simple_producer`tokio::runtime::scheduler::multi_thread::queue::Steal<T>::steal_into (105 samples, 0.06%)libdyld.dylib`0x7ff81491b9f1 (20 samples, 0.01%)simple_producer`tokio::runtime::context::with_defer (49 samples, 0.03%)libsystem_kernel.dylib`__psynch_cvwait (2,125 samples, 1.16%)libsystem_pthread.dylib`pthread_mutex_lock (39 samples, 0.02%)libsystem_pthread.dylib`_pthread_cond_wait (218 samples, 0.12%)libsystem_pthread.dylib`pthread_testcancel (33 samples, 0.02%)simple_producer`parking_lot::condvar::Condvar::wait_until_internal (2,477 samples, 1.35%)libsystem_kernel.dylib`mach_absolute_time (30 samples, 0.02%)simple_producer`std::time::Instant::checked_duration_since (25 samples, 0.01%)libsystem_kernel.dylib`kevent (1,018 samples, 0.56%)simple_producer`mio::poll::Poll::poll (58 samples, 0.03%)simple_producer`tokio::runtime::scheduler::multi_thread::worker::_<impl tokio::runtime::scheduler::multi_thread::handle::Handle>::schedule_task (28 samples, 0.02%)simple_producer`tokio::runtime::io::scheduled_io::ScheduledIo::wake (80 samples, 0.04%)simple_producer`tokio::runtime::task::waker::wake_by_val (40 samples, 0.02%)simple_producer`tokio::runtime::io::Driver::turn (1,228 samples, 0.67%)simple_producer`tokio::runtime::time::wheel::Wheel::next_expiration (21 samples, 0.01%)simple_producer`tokio::runtime::time::_<impl tokio::runtime::time::handle::Handle>::process_at_time (54 samples, 0.03%)simple_producer`tokio::runtime::time::wheel::Wheel::poll (27 samples, 0.01%)simple_producer`tokio::runtime::time::Driver::park_internal (1,406 samples, 0.77%)simple_producer`tokio::runtime::scheduler::multi_thread::park::Parker::park (4,143 samples, 2.26%)s..libsystem_kernel.dylib`kevent (37 samples, 0.02%)simple_producer`tokio::runtime::io::Driver::turn (41 samples, 0.02%)simple_producer`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout (4,360 samples, 2.38%)si..simple_producer`tokio::runtime::time::Driver::park_internal (53 samples, 0.03%)libsystem_kernel.dylib`__psynch_cvsignal (484 samples, 0.26%)simple_producer`parking_lot::condvar::Condvar::notify_one_slow (605 samples, 0.33%)simple_producer`tokio::runtime::scheduler::multi_thread::park::Unparker::unpark (22 samples, 0.01%)simple_producer`tokio::runtime::scheduler::multi_thread::worker::_<impl tokio::runtime::scheduler::multi_thread::handle::Handle>::transition_worker_from_searching (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766e2b (38 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766e3a (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766e45 (34 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766e57 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766e60 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766e70 (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476ae03 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff81477b493 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147806f8 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780a48 (34 samples, 0.02%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (42 samples, 0.02%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (58 samples, 0.03%)libsystem_platform.dylib`os_unfair_lock_unlock (26 samples, 0.01%)libsystem_kernel.dylib`__ulock_wake (2,380 samples, 1.30%)libsystem_malloc.dylib`0x7ff81476ae09 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476ae10 (34 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476ae1b (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476ae28 (102 samples, 0.06%)libsystem_malloc.dylib`0x7ff81476ae3a (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476ae49 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476ae64 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476ae73 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476ae7f (26 samples, 0.01%)libsystem_platform.dylib`_platform_bzero$VARIANT$Haswell (233 samples, 0.13%)libsystem_malloc.dylib`0x7ff81476ae86 (311 samples, 0.17%)libsystem_platform.dylib`_platform_memset$VARIANT$Haswell (78 samples, 0.04%)libsystem_malloc.dylib`0x7ff81476aea8 (1,014 samples, 0.55%)libsystem_kernel.dylib`__ulock_wait (3,038 samples, 1.66%)libsystem_malloc.dylib`0x7ff81476aeba (3,416 samples, 1.87%)l..libsystem_platform.dylib`_os_unfair_lock_lock_slow (368 samples, 0.20%)libsystem_malloc.dylib`0x7ff81476aece (31 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476af7b (136 samples, 0.07%)libsystem_malloc.dylib`0x7ff81476afde (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476aff5 (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b143 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b14a (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b158 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b173 (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b181 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b193 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b1a3 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b1b1 (34 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b1c1 (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b1ff (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b20d (31 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b211 (216 samples, 0.12%)libsystem_malloc.dylib`0x7ff81476b21b (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b223 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b241 (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b255 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b26a (39 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b276 (35 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b28b (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b28f (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b29b (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b42f (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b43e (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b46c (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b488 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b48c (117 samples, 0.06%)libsystem_malloc.dylib`0x7ff81476b499 (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b4ad (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b4bd (44 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b4c2 (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b4cf (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bdb7 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bdbe (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bdcc (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bdeb (31 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476be01 (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476be0b (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476be1f (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476be2c (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476be41 (31 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476be53 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476beb3 (322 samples, 0.18%)libsystem_malloc.dylib`0x7ff81476bec1 (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bed2 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bedb (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bee4 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476bef8 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476befb (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bf1d (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b4da (1,205 samples, 0.66%)libsystem_malloc.dylib`0x7ff81476b4e4 (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b4f9 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b509 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b546 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b57d (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b588 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476ba36 (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476ba3c (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476ba46 (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476ba55 (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476ba6c (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476ba7b (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476ba93 (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476ba98 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476baa2 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476baae (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476bac4 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bae5 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bafe (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bb0c (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bb1a (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bb2a (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bb3e (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bcae (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bccc (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bcd5 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bce2 (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476bd8d (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b58d (979 samples, 0.54%)libsystem_malloc.dylib`0x7ff81476b598 (354 samples, 0.19%)libsystem_malloc.dylib`0x7ff81476b5a5 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b5ad (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b5b4 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b5bb (28 samples, 0.02%)libsystem_kernel.dylib`madvise (1,860 samples, 1.02%)libsystem_malloc.dylib`0x7ff814770161 (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff814786b8a (1,921 samples, 1.05%)libsystem_malloc.dylib`0x7ff814786b98 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b687 (2,052 samples, 1.12%)libsystem_malloc.dylib`0x7ff81476b727 (88 samples, 0.05%)libsystem_malloc.dylib`0x7ff81476b777 (96 samples, 0.05%)libsystem_malloc.dylib`0x7ff81477265f (452 samples, 0.25%)libsystem_kernel.dylib`madvise (452 samples, 0.25%)libsystem_malloc.dylib`0x7ff81476b850 (530 samples, 0.29%)libsystem_malloc.dylib`0x7ff81476b8a0 (181 samples, 0.10%)libsystem_malloc.dylib`0x7ff814772ce7 (181 samples, 0.10%)libsystem_kernel.dylib`_kernelrpc_mach_vm_deallocate_trap (181 samples, 0.10%)libsystem_malloc.dylib`0x7ff81476b8ab (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff814776d5f (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff814776d6e (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff814776d91 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff814776d9e (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff814776da2 (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff814776dae (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff814776db2 (50 samples, 0.03%)libsystem_malloc.dylib`0x7ff814776db8 (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b006 (7,650 samples, 4.18%)libsy..libsystem_malloc.dylib`0x7ff81476b012 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b01a (1,458 samples, 0.80%)libsystem_malloc.dylib`0x7ff81476b024 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b029 (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b032 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b044 (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b051 (33 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b067 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b078 (31 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b082 (37 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b087 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b099 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476b09f (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476b0ab (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81477a7bf (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff81477a7c5 (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff81477a7f5 (38 samples, 0.02%)libsystem_malloc.dylib`0x7ff81477a80f (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81477a820 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff81477a834 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff81477a83d (37 samples, 0.02%)libsystem_malloc.dylib`0x7ff81477a844 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81477a849 (33 samples, 0.02%)libsystem_malloc.dylib`0x7ff81477a875 (33 samples, 0.02%)libsystem_malloc.dylib`0x7ff81477a9dc (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81477a9e4 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147806fe (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780705 (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff81478070f (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478072f (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147808a9 (41 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147808b6 (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147808bd (26 samples, 0.01%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (66 samples, 0.04%)libsystem_platform.dylib`DYLD-STUB$$_platform_memset (48 samples, 0.03%)libsystem_platform.dylib`_os_unfair_lock_unlock_slow (62 samples, 0.03%)libsystem_platform.dylib`_platform_bzero$VARIANT$Haswell (33 samples, 0.02%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (518 samples, 0.28%)libsystem_platform.dylib`_platform_memset$VARIANT$Haswell (31 samples, 0.02%)libsystem_platform.dylib`os_unfair_lock_lock_with_options (96 samples, 0.05%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (1,333 samples, 0.73%)simple_producer`<kafkas::producer::SendFuture as core::future::future::Future>::poll (3,618 samples, 1.98%)s..simple_producer`DYLD-STUB$$memcpy (27 samples, 0.01%)simple_producer`alloc::sync::Arc<T>::drop_slow (759 samples, 0.41%)simple_producer`futures_channel::mpsc::queue::Queue<T>::pop_spin (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766e2b (40 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766e3a (33 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766e45 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766e57 (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff814766e60 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766e70 (55 samples, 0.03%)libsystem_malloc.dylib`0x7ff8147806f8 (37 samples, 0.02%)libsystem_malloc.dylib`0x7ff814780a48 (36 samples, 0.02%)simple_producer`__rdl_dealloc (58 samples, 0.03%)simple_producer`__rust_dealloc (21 samples, 0.01%)libsystem_kernel.dylib`madvise (178 samples, 0.10%)libsystem_malloc.dylib`0x7ff814780dbf (183 samples, 0.10%)libsystem_malloc.dylib`0x7ff8147700c9 (188 samples, 0.10%)libsystem_malloc.dylib`0x7ff8147806fe (33 samples, 0.02%)libsystem_malloc.dylib`0x7ff814780705 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478070f (35 samples, 0.02%)libsystem_malloc.dylib`0x7ff81478072f (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478074f (29 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147807e0 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147807f2 (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff814780816 (39 samples, 0.02%)libsystem_malloc.dylib`0x7ff814780826 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478082d (166 samples, 0.09%)libsystem_malloc.dylib`0x7ff814780835 (34 samples, 0.02%)libsystem_malloc.dylib`0x7ff814780851 (34 samples, 0.02%)libsystem_malloc.dylib`0x7ff81478086d (32 samples, 0.02%)libsystem_malloc.dylib`0x7ff814780891 (453 samples, 0.25%)libsystem_malloc.dylib`0x7ff814780912 (39 samples, 0.02%)libsystem_malloc.dylib`0x7ff814780939 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478099e (223 samples, 0.12%)libsystem_malloc.dylib`0x7ff8147809b7 (1,302 samples, 0.71%)libsystem_malloc.dylib`0x7ff8147809fa (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780a3d (21 samples, 0.01%)simple_producer`futures_util::stream::stream::StreamExt::poll_next_unpin (6,243 samples, 3.41%)sim..simple_producer`futures_channel::mpsc::queue::Queue<T>::pop_spin (4,809 samples, 2.63%)si..simple_producer`<core::pin::Pin<P> as core::future::future::Future>::poll (33,804 samples, 18.48%)simple_producer`<core::pin::P..libsystem_malloc.dylib`0x7ff814780dbf (21 samples, 0.01%)libsystem_kernel.dylib`madvise (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147700c9 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780901 (131 samples, 0.07%)libsystem_platform.dylib`_platform_bzero$VARIANT$Haswell (131 samples, 0.07%)simple_producer`futures_channel::mpsc::queue::Queue<T>::pop_spin (194 samples, 0.11%)simple_producer`<futures_channel::mpsc::UnboundedReceiver<T> as futures_core::stream::Stream>::poll_next (232 samples, 0.13%)simple_producer`<futures_channel::oneshot::Receiver<T> as core::future::future::Future>::poll (35 samples, 0.02%)simple_producer`<tokio_util::codec::length_delimited::LengthDelimitedCodec as tokio_util::codec::decoder::Decoder>::decode (23 samples, 0.01%)simple_producer`<bytes::bytes_mut::BytesMut as kafka_protocol::protocol::buf::ByteBuf>::peek_bytes (50 samples, 0.03%)simple_producer`bytes::bytes::Bytes::copy_from_slice (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff814767669 (31 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476748f (46 samples, 0.03%)simple_producer`<kafka_protocol::messages::produce_response::PartitionProduceResponse as kafka_protocol::protocol::Decodable>::decode (77 samples, 0.04%)simple_producer`bytes::bytes_mut::BytesMut::set_start (22 samples, 0.01%)simple_producer`<kafka_protocol::protocol::types::CompactArray<E> as kafka_protocol::protocol::Decoder<alloc::vec::Vec<T>>>::decode (164 samples, 0.09%)simple_producer`<kafka_protocol::protocol::types::CompactString as kafka_protocol::protocol::Decoder<T>>::decode (20 samples, 0.01%)simple_producer`<kafka_protocol::messages::produce_response::TopicProduceResponse as kafka_protocol::protocol::MapDecodable>::decode (203 samples, 0.11%)libsystem_malloc.dylib`0x7ff8147687de (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff814767464 (32 samples, 0.02%)simple_producer`alloc::raw_vec::finish_grow (37 samples, 0.02%)simple_producer`hashbrown::raw::inner::RawTable<T,A>::insert (31 samples, 0.02%)simple_producer`hashbrown::raw::inner::RawTable<T,A>::reserve_rehash (27 samples, 0.01%)simple_producer`indexmap::map::IndexMap<K,V,S>::insert (109 samples, 0.06%)simple_producer`indexmap::map::core::IndexMapCore<K,V>::insert_full (91 samples, 0.05%)simple_producer`<kafka_protocol::protocol::types::CompactArray<E> as kafka_protocol::protocol::Decoder<indexmap::map::IndexMap<K,V>>>::decode (330 samples, 0.18%)simple_producer`<kafka_protocol::messages::produce_response::ProduceResponse as kafka_protocol::protocol::Decodable>::decode (353 samples, 0.19%)simple_producer`core::hash::BuildHasher::hash_one (141 samples, 0.08%)simple_producer`<kafkas::protocol::KafkaCodec as tokio_util::codec::decoder::Decoder>::decode (706 samples, 0.39%)simple_producer`kafkas::protocol::KafkaCodec::decode_response (625 samples, 0.34%)libsystem_kernel.dylib`__recvfrom (985 samples, 0.54%)simple_producer`<&mio::net::tcp::stream::TcpStream as std::io::Read>::read (1,012 samples, 0.55%)simple_producer`tokio::runtime::io::registration::Registration::poll_ready (29 samples, 0.02%)simple_producer`tokio::io::poll_evented::PollEvented<E>::poll_read (1,061 samples, 0.58%)simple_producer`<tokio_util::codec::framed_impl::FramedImpl<T,U,R> as futures_core::stream::Stream>::poll_next (1,862 samples, 1.02%)simple_producer`tokio_util::util::poll_read_buf (1,086 samples, 0.59%)simple_producer`futures_util::lock::bilock::BiLock<T>::poll_lock (37 samples, 0.02%)simple_producer`<futures_util::stream::stream::split::SplitStream<S> as futures_core::stream::Stream>::poll_next (1,940 samples, 1.06%)simple_producer`futures_channel::oneshot::Sender<T>::send (41 samples, 0.02%)simple_producer`<kafkas::connection::Receiver<S> as core::future::future::Future>::poll (2,335 samples, 1.28%)simple_producer`<futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll (2,363 samples, 1.29%)simple_producer`<tokio::runtime::task::core::TaskIdGuard as core::ops::drop::Drop>::drop (127 samples, 0.07%)simple_producer`DYLD-STUB$$memcpy (40 samples, 0.02%)simple_producer`__rdl_dealloc (52 samples, 0.03%)simple_producer`alloc::sync::Arc<T>::drop_slow (55 samples, 0.03%)simple_producer`futures_util::stream::stream::StreamExt::poll_next_unpin (36 samples, 0.02%)libsystem_kernel.dylib`madvise (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81477aa5f (64 samples, 0.03%)libsystem_malloc.dylib`0x7ff8147717a3 (38 samples, 0.02%)libsystem_malloc.dylib`0x7ff814772ce7 (38 samples, 0.02%)libsystem_kernel.dylib`_kernelrpc_mach_vm_deallocate_trap (38 samples, 0.02%)simple_producer`<bytes::bytes_mut::BytesMut as core::ops::drop::Drop>::drop (78 samples, 0.04%)simple_producer`<bytes::bytes_mut::BytesMut as kafka_protocol::protocol::buf::ByteBuf>::get_bytes (29 samples, 0.02%)simple_producer`bytes::bytes_mut::BytesMut::split_to (24 samples, 0.01%)simple_producer`bytes::bytes_mut::BytesMut::extend_from_slice (267 samples, 0.15%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (267 samples, 0.15%)simple_producer`<tokio_util::codec::length_delimited::LengthDelimitedCodec as tokio_util::codec::encoder::Encoder<bytes::bytes::Bytes>>::encode (283 samples, 0.15%)simple_producer`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476a7a6 (77 samples, 0.04%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (77 samples, 0.04%)simple_producer`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (150 samples, 0.08%)simple_producer`bytes::bytes_mut::BytesMut::reserve_inner (129 samples, 0.07%)simple_producer`alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle (128 samples, 0.07%)simple_producer`alloc::raw_vec::finish_grow (126 samples, 0.07%)libsystem_malloc.dylib`0x7ff814768235 (121 samples, 0.07%)libsystem_malloc.dylib`0x7ff814769698 (121 samples, 0.07%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (608 samples, 0.33%)libsystem_malloc.dylib`0x7ff8147697a0 (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476a587 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476a7a6 (560 samples, 0.31%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (560 samples, 0.31%)libsystem_malloc.dylib`0x7ff8147717a3 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff814772ce7 (28 samples, 0.02%)libsystem_kernel.dylib`_kernelrpc_mach_vm_deallocate_trap (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476a7b3 (45 samples, 0.02%)libsystem_malloc.dylib`0x7ff81477aa5f (42 samples, 0.02%)libsystem_malloc.dylib`0x7ff814769698 (686 samples, 0.38%)libsystem_malloc.dylib`0x7ff814768235 (689 samples, 0.38%)simple_producer`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (1,331 samples, 0.73%)simple_producer`bytes::bytes_mut::BytesMut::reserve_inner (709 samples, 0.39%)simple_producer`alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle (706 samples, 0.39%)simple_producer`alloc::raw_vec::finish_grow (704 samples, 0.38%)simple_producer`<kafka_protocol::protocol::types::CompactBytes as kafka_protocol::protocol::Encoder<core::option::Option<&bytes::bytes::Bytes>>>::encode (1,352 samples, 0.74%)simple_producer`<kafka_protocol::messages::produce_request::PartitionProduceData as kafka_protocol::protocol::Encodable>::encode (1,522 samples, 0.83%)simple_producer`<kafka_protocol::protocol::types::CompactArray<E> as kafka_protocol::protocol::Encoder<&alloc::vec::Vec<T>>>::encode (1,555 samples, 0.85%)simple_producer`<kafka_protocol::messages::produce_request::TopicProduceData as kafka_protocol::protocol::MapEncodable>::encode (1,572 samples, 0.86%)simple_producer`<kafka_protocol::protocol::types::CompactArray<E> as kafka_protocol::protocol::Encoder<&indexmap::map::IndexMap<K,V>>>::encode (1,584 samples, 0.87%)simple_producer`<kafka_protocol::messages::produce_request::ProduceRequest as kafka_protocol::protocol::Encodable>::encode (1,601 samples, 0.88%)simple_producer`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (25 samples, 0.01%)simple_producer`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (39 samples, 0.02%)simple_producer`bytes::bytes_mut::BytesMut::reserve_inner (36 samples, 0.02%)simple_producer`alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle (32 samples, 0.02%)simple_producer`alloc::raw_vec::finish_grow (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff814768235 (22 samples, 0.01%)simple_producer`<kafka_protocol::protocol::types::String as kafka_protocol::protocol::Encoder<core::option::Option<&str>>>::encode (42 samples, 0.02%)simple_producer`<kafka_protocol::messages::request_header::RequestHeader as kafka_protocol::protocol::Encodable>::encode (78 samples, 0.04%)libsystem_kernel.dylib`_kernelrpc_mach_vm_deallocate_trap (371 samples, 0.20%)libsystem_malloc.dylib`0x7ff814772ce7 (373 samples, 0.20%)libsystem_malloc.dylib`0x7ff81477aa5f (384 samples, 0.21%)libsystem_malloc.dylib`0x7ff8147717a3 (374 samples, 0.20%)simple_producer`core::ptr::drop_in_place<kafka_protocol::messages::produce_request::ProduceRequest> (598 samples, 0.33%)simple_producer`core::ptr::drop_in_place<kafka_protocol::messages::produce_request::TopicProduceData> (557 samples, 0.30%)simple_producer`bytes::bytes::shared_drop (499 samples, 0.27%)simple_producer`kafkas::protocol::KafkaCodec::encode0 (2,393 samples, 1.31%)simple_producer`kafkas::protocol::KafkaCodec::encode_request (2,367 samples, 1.29%)simple_producer`<kafkas::protocol::KafkaCodec as tokio_util::codec::encoder::Encoder<kafkas::protocol::Command>>::encode (2,816 samples, 1.54%)libsystem_kernel.dylib`writev (1,790 samples, 0.98%)simple_producer`<&mio::net::tcp::stream::TcpStream as std::io::Write>::write_vectored (1,803 samples, 0.99%)simple_producer`<tokio::net::tcp::stream::TcpStream as tokio::io::async_write::AsyncWrite>::poll_write_vectored (1,842 samples, 1.01%)simple_producer`tokio::runtime::io::registration::Registration::poll_write_io (1,830 samples, 1.00%)simple_producer`<tokio_util::codec::framed_impl::FramedImpl<T,U,W> as futures_sink::Sink<I>>::poll_flush (1,873 samples, 1.02%)simple_producer`tokio_util::util::poll_write_buf (1,859 samples, 1.02%)simple_producer`<futures_util::stream::stream::split::SplitSink<S,Item> as futures_sink::Sink<Item>>::poll_flush (4,762 samples, 2.60%)si..simple_producer`tokio::runtime::task::waker::wake_by_val (25 samples, 0.01%)simple_producer`futures_channel::mpsc::UnboundedReceiver<T>::next_message (75 samples, 0.04%)simple_producer`futures_channel::mpsc::queue::Queue<T>::pop_spin (53 samples, 0.03%)simple_producer`futures_util::stream::stream::StreamExt::poll_next_unpin (99 samples, 0.05%)simple_producer`kafkas::connection::Connection<Exe>::connect::_{{closure}}::_{{closure}} (4,917 samples, 2.69%)si..simple_producer`<tokio::time::sleep::Sleep as core::future::future::Future>::poll (22 samples, 0.01%)simple_producer`<kafkas::executor::Interval as futures_core::stream::Stream>::poll_next (64 samples, 0.03%)simple_producer`tokio::time::interval::Interval::poll_tick (56 samples, 0.03%)libsystem_malloc.dylib`0x7ff81476b006 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff81477a844 (47 samples, 0.03%)libsystem_kernel.dylib`madvise (2,035 samples, 1.11%)libsystem_malloc.dylib`0x7ff814770e84 (41 samples, 0.02%)libsystem_malloc.dylib`0x7ff81477135e (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff814771487 (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff814771588 (24 samples, 0.01%)libsystem_kernel.dylib`_kernelrpc_mach_vm_deallocate_trap (71 samples, 0.04%)libsystem_malloc.dylib`0x7ff8147717a3 (72 samples, 0.04%)libsystem_malloc.dylib`0x7ff814772ce7 (72 samples, 0.04%)libsystem_malloc.dylib`0x7ff8147717b9 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81477aa5f (2,393 samples, 1.31%)libsystem_malloc.dylib`0x7ff81476b006 (22 samples, 0.01%)simple_producer`<alloc::collections::btree::map::BTreeMap<K,V,A> as core::ops::drop::Drop>::drop (50 samples, 0.03%)simple_producer`<alloc::vec::Vec<T,A> as core::ops::drop::Drop>::drop (26 samples, 0.01%)simple_producer`<bytes::bytes::Bytes as core::convert::From<alloc::vec::Vec<u8>>>::from (42 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147809b7 (28 samples, 0.02%)simple_producer`<dashmap::iter::Iter<K,V,S,M> as core::iter::traits::iterator::Iterator>::next (317 samples, 0.17%)simple_producer`alloc::sync::Arc<T>::drop_slow (45 samples, 0.02%)simple_producer`alloc::collections::btree::map::BTreeMap<K,V,A>::remove (43 samples, 0.02%)simple_producer`alloc::collections::btree::map::entry::VacantEntry<K,V,A>::insert (86 samples, 0.05%)simple_producer`alloc::collections::btree::node::Handle<alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Mut,K,V,alloc::collections::btree::node::marker::Leaf>,alloc::collections::btree::node::marker::Edge>::insert_recursing (50 samples, 0.03%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (30 samples, 0.02%)simple_producer`alloc::collections::btree::remove::_<impl alloc::collections::btree::node::Handle<alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Mut,K,V,alloc::collections::btree::node::marker::LeafOrInternal>,alloc::collections::btree::node::marker::KV>>::remove_kv_tracking (67 samples, 0.04%)simple_producer`alloc::collections::btree::remove::_<impl alloc::collections::btree::node::Handle<alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Mut,K,V,alloc::collections::btree::node::marker::Leaf>,alloc::collections::btree::node::marker::KV>>::remove_leaf_kv (60 samples, 0.03%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476a765 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff814769698 (98 samples, 0.05%)libsystem_malloc.dylib`0x7ff814768235 (100 samples, 0.05%)simple_producer`alloc::raw_vec::RawVec<T,A>::reserve_for_push (147 samples, 0.08%)simple_producer`alloc::raw_vec::finish_grow (137 samples, 0.07%)simple_producer`bytes::bytes::promotable_even_drop (47 samples, 0.03%)libsystem_malloc.dylib`0x7ff814766e2b (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff814766e45 (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147806f8 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780a48 (22 samples, 0.01%)simple_producer`<alloc::vec::Vec<T,A> as core::ops::drop::Drop>::drop (72 samples, 0.04%)simple_producer`<core::sync::atomic::AtomicPtr<T> as bytes::loom::sync::atomic::AtomicMut<T>>::with_mut (21 samples, 0.01%)simple_producer`__rdl_dealloc (34 samples, 0.02%)libsystem_kernel.dylib`madvise (164 samples, 0.09%)libsystem_malloc.dylib`0x7ff814780dbf (166 samples, 0.09%)libsystem_malloc.dylib`0x7ff8147700c9 (169 samples, 0.09%)libsystem_malloc.dylib`0x7ff8147806fe (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478070f (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147807e0 (28 samples, 0.02%)libsystem_malloc.dylib`0x7ff814780826 (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780835 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478086d (30 samples, 0.02%)libsystem_malloc.dylib`0x7ff814780887 (25 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780891 (314 samples, 0.17%)libsystem_malloc.dylib`0x7ff8147808c6 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780901 (124 samples, 0.07%)libsystem_platform.dylib`_platform_bzero$VARIANT$Haswell (101 samples, 0.06%)libsystem_malloc.dylib`0x7ff814780912 (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780934 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff814780947 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478095b (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478096c (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff81478099e (202 samples, 0.11%)libsystem_malloc.dylib`0x7ff8147809aa (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147809b7 (403 samples, 0.22%)libsystem_malloc.dylib`0x7ff8147809f6 (22 samples, 0.01%)libsystem_platform.dylib`DYLD-STUB$$_platform_bzero (20 samples, 0.01%)libsystem_platform.dylib`_platform_bzero$VARIANT$Haswell (25 samples, 0.01%)simple_producer`core::ptr::drop_in_place<kafka_protocol::records::Record> (2,587 samples, 1.41%)simple_producer`bytes::bytes::promotable_even_drop (2,131 samples, 1.16%)simple_producer`<core::sync::atomic::AtomicPtr<T> as bytes::loom::sync::atomic::AtomicMut<T>>::with_mut (90 samples, 0.05%)simple_producer`<string::String<T> as core::hash::Hash>::hash (32 samples, 0.02%)simple_producer`dashmap::DashMap<K,V,S>::get_mut (270 samples, 0.15%)simple_producer`dashmap::lock::RawRwLock::lock_exclusive_slow (40 samples, 0.02%)libsystem_kernel.dylib`__psynch_cvsignal (1,734 samples, 0.95%)libsystem_pthread.dylib`pthread_cond_signal (51 samples, 0.03%)libsystem_pthread.dylib`pthread_mutex_lock (48 samples, 0.03%)simple_producer`dashmap::lock::RawRwLock::unlock_exclusive_slow (1,930 samples, 1.06%)simple_producer`futures_channel::oneshot::Sender<T>::send (24 samples, 0.01%)simple_producer`indexmap::map::IndexMap<K,V,S>::get_mut (70 samples, 0.04%)simple_producer`hashbrown::raw::inner::RawTable<T,A>::insert (21 samples, 0.01%)simple_producer`indexmap::map::core::IndexMapCore<K,V>::insert_full (64 samples, 0.03%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (37 samples, 0.02%)libsystem_malloc.dylib`0x7ff814767004 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147664ef (50 samples, 0.03%)libsystem_malloc.dylib`0x7ff814766509 (26 samples, 0.01%)libsystem_malloc.dylib`0x7ff814769852 (135 samples, 0.07%)libsystem_malloc.dylib`0x7ff81476987c (49 samples, 0.03%)libsystem_malloc.dylib`0x7ff814769698 (241 samples, 0.13%)libsystem_malloc.dylib`0x7ff814768235 (254 samples, 0.14%)simple_producer`alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle (393 samples, 0.21%)simple_producer`alloc::raw_vec::finish_grow (371 samples, 0.20%)simple_producer`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (759 samples, 0.41%)simple_producer`bytes::bytes_mut::BytesMut::reserve_inner (426 samples, 0.23%)libsystem_malloc.dylib`0x7ff814768235 (23 samples, 0.01%)simple_producer`bytes::bytes_mut::BytesMut::resize (94 samples, 0.05%)simple_producer`bytes::bytes_mut::BytesMut::reserve_inner (81 samples, 0.04%)simple_producer`alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle (72 samples, 0.04%)simple_producer`alloc::raw_vec::finish_grow (59 samples, 0.03%)simple_producer`crc::crc32::_<impl crc::Crc<u32>>::checksum (4,762 samples, 2.60%)si..simple_producer`kafka_protocol::records::Record::compute_size_new (21 samples, 0.01%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (153 samples, 0.08%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (176 samples, 0.10%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (1,029 samples, 0.56%)libsystem_malloc.dylib`0x7ff814766f7b (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff814767004 (27 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147698d5 (49 samples, 0.03%)libsystem_malloc.dylib`0x7ff814768184 (79 samples, 0.04%)libsystem_malloc.dylib`0x7ff8147671cb (20 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147687de (54 samples, 0.03%)libsystem_malloc.dylib`0x7ff814767464 (103 samples, 0.06%)libsystem_malloc.dylib`0x7ff8147697a0 (111 samples, 0.06%)libsystem_malloc.dylib`0x7ff814766407 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147664ef (34 samples, 0.02%)libsystem_malloc.dylib`0x7ff814769852 (123 samples, 0.07%)libsystem_malloc.dylib`0x7ff81476986f (44 samples, 0.02%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (44 samples, 0.02%)libsystem_malloc.dylib`0x7ff814780891 (23 samples, 0.01%)libsystem_malloc.dylib`0x7ff8147809b7 (21 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476987c (102 samples, 0.06%)libsystem_malloc.dylib`0x7ff81476a469 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476c4a6 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476a587 (76 samples, 0.04%)libsystem_malloc.dylib`0x7ff8147675f5 (22 samples, 0.01%)libsystem_malloc.dylib`0x7ff814767669 (69 samples, 0.04%)libsystem_malloc.dylib`0x7ff814767a48 (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff81476748f (137 samples, 0.07%)libsystem_malloc.dylib`0x7ff81476a765 (140 samples, 0.08%)libsystem_malloc.dylib`0x7ff81476a7a6 (52 samples, 0.03%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (52 samples, 0.03%)libsystem_malloc.dylib`0x7ff81476b006 (39 samples, 0.02%)libsystem_malloc.dylib`0x7ff81476a7b3 (100 samples, 0.05%)libsystem_malloc.dylib`0x7ff814769698 (902 samples, 0.49%)libsystem_malloc.dylib`0x7ff814768235 (938 samples, 0.51%)simple_producer`alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle (1,205 samples, 0.66%)simple_producer`alloc::raw_vec::finish_grow (1,179 samples, 0.64%)simple_producer`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (3,653 samples, 2.00%)s..simple_producer`bytes::bytes_mut::BytesMut::reserve_inner (1,239 samples, 0.68%)simple_producer`DYLD-STUB$$memcpy (91 samples, 0.05%)simple_producer`kafka_protocol::records::RecordBatchEncoder::encode (11,650 samples, 6.37%)simple_p..simple_producer`kafka_protocol::records::RecordBatchEncoder::encode_new_records (5,130 samples, 2.80%)si..simple_producer`kafka_protocol::records::Record::compute_size_new (376 samples, 0.21%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (25 samples, 0.01%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (29 samples, 0.02%)simple_producer`<kafkas::executor::TokioExecutor as kafkas::executor::Executor>::delay (43 samples, 0.02%)simple_producer`tokio::time::sleep::sleep (39 samples, 0.02%)simple_producer`tokio::time::sleep::Sleep::new_timeout (30 samples, 0.02%)simple_producer`tokio::runtime::time::entry::TimerEntry::reset (28 samples, 0.02%)simple_producer`tokio::runtime::time::_<impl tokio::runtime::time::handle::Handle>::reregister (22 samples, 0.01%)simple_producer`<tokio::time::sleep::Sleep as core::future::future::Future>::poll (43 samples, 0.02%)libsystem_kernel.dylib`__psynch_cvsignal (176 samples, 0.10%)simple_producer`parking_lot::condvar::Condvar::notify_one_slow (227 samples, 0.12%)simple_producer`tokio::runtime::driver::Handle::unpark (60 samples, 0.03%)libsystem_kernel.dylib`kevent (58 samples, 0.03%)simple_producer`tokio::runtime::scheduler::multi_thread::worker::_<impl tokio::runtime::scheduler::multi_thread::handle::Handle>::schedule_task (354 samples, 0.19%)simple_producer`futures_channel::mpsc::UnboundedSender<T>::unbounded_send (438 samples, 0.24%)simple_producer`tokio::runtime::task::waker::wake_by_val (370 samples, 0.20%)libsystem_malloc.dylib`0x7ff81476b006 (20 samples, 0.01%)simple_producer`<futures_channel::oneshot::Receiver<T> as core::future::future::Future>::poll (26 samples, 0.01%)simple_producer`futures_util::future::future::FutureExt::poll_unpin (96 samples, 0.05%)simple_producer`kafkas::connection::ConnectionSender<Exe>::send::_{{closure}} (789 samples, 0.43%)simple_producer`kafkas::connection_manager::ConnectionManager<Exe>::invoke::_{{closure}} (920 samples, 0.50%)simple_producer`kafkas::metadata::Cluster::drain_node (24 samples, 0.01%)libsystem_malloc.dylib`0x7ff814771166 (33 samples, 0.02%)libsystem_malloc.dylib`0x7ff8147711bb (19 samples, 0.01%)libsystem_malloc.dylib`0x7ff814767517 (135 samples, 0.07%)simple_producer`kafkas::producer::batch::ProducerBatch::flush (173 samples, 0.09%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (40 samples, 0.02%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (84 samples, 0.05%)simple_producer`<i16 as kafka_protocol::error::ParseResponseErrorCode>::is_ok (22 samples, 0.01%)simple_producer`DYLD-STUB$$memcpy (20 samples, 0.01%)simple_producer`core::ptr::drop_in_place<futures_channel::oneshot::Sender<core::result::Result<kafkas::producer::RecordMetadata,kafkas::error::Error>>> (42 samples, 0.02%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (588 samples, 0.32%)simple_producer`kafkas::producer::batch::Thunk::done (6,696 samples, 3.66%)simp..simple_producer`futures_channel::oneshot::Sender<T>::send (6,219 samples, 3.40%)sim..simple_producer`core::ptr::drop_in_place<futures_channel::oneshot::Sender<core::result::Result<kafkas::producer::RecordMetadata,kafkas::error::Error>>> (3,164 samples, 1.73%)simple_producer`kafkas::producer::Producer<Exe>::send_raw::_{{closure}} (29,712 samples, 16.24%)simple_producer`kafkas::p..simple_producer`kafkas::producer::batch::Thunk::done (21 samples, 0.01%)simple_producer`kafkas::producer::Producer<Exe>::new::_{{closure}}::_{{closure}} (29,983 samples, 16.39%)simple_producer`kafkas::p..simple_producer`<core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once (71,858 samples, 39.28%)simple_producer`<core::panic::unwind_safe::AssertUnwindSafe<F> a..simple_producer`tokio::runtime::task::harness::Harness<T,S>::poll (72,014 samples, 39.37%)simple_producer`tokio::runtime::task::harness::Harness<T,S>::pollsimple_producer`tokio::runtime::scheduler::multi_thread::worker::Context::run_task (72,791 samples, 39.79%)simple_producer`tokio::runtime::scheduler::multi_thread::worker::..simple_producer`tokio::runtime::scheduler::multi_thread::worker::Context::run (77,648 samples, 42.45%)simple_producer`tokio::runtime::scheduler::multi_thread::worker::Cont..simple_producer`tokio::runtime::task::raw::poll (22 samples, 0.01%)all (182,929 samples, 100%)libsystem_pthread.dylib`thread_start (77,685 samples, 42.47%)libsystem_pthread.dylib`thread_startlibsystem_pthread.dylib`_pthread_start (77,685 samples, 42.47%)libsystem_pthread.dylib`_pthread_startsimple_producer`std::sys::unix::thread::Thread::new::thread_start (77,683 samples, 42.47%)simple_producer`std::sys::unix::thread::Thread::new::thread_startsimple_producer`core::ops::function::FnOnce::call_once{{vtable.shim}} (77,682 samples, 42.47%)simple_producer`core::ops::function::FnOnce::call_once{{vtable.shim}}simple_producer`std::sys_common::backtrace::__rust_begin_short_backtrace (77,682 samples, 42.47%)simple_producer`std::sys_common::backtrace::__rust_begin_short_backtr..simple_producer`tokio::runtime::blocking::pool::Inner::run (77,682 samples, 42.47%)simple_producer`tokio::runtime::blocking::pool::Inner::runsimple_producer`tokio::runtime::task::harness::Harness<T,S>::poll (77,682 samples, 42.47%)simple_producer`tokio::runtime::task::harness::Harness<T,S>::pollsimple_producer`tokio::runtime::task::core::Core<T,S>::poll (77,682 samples, 42.47%)simple_producer`tokio::runtime::task::core::Core<T,S>::pollsimple_producer`tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut (77,682 samples, 42.47%)simple_producer`tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mutsimple_producer`tokio::runtime::scheduler::multi_thread::worker::run (77,681 samples, 42.47%)simple_producer`tokio::runtime::scheduler::multi_thread::worker::runsimple_producer`tokio::macros::scoped_tls::ScopedKey<T>::set (77,681 samples, 42.47%)simple_producer`tokio::macros::scoped_tls::ScopedKey<T>::set \ No newline at end of file diff --git a/benchmark/flamegraph.svg b/benchmark/flamegraph.svg deleted file mode 100644 index 59ff86d..0000000 --- a/benchmark/flamegraph.svg +++ /dev/null @@ -1,491 +0,0 @@ -Flame Graph Reset ZoomSearch hello_kafka`<&mut S as futures_sink::Sink<Item>>::start_send (76 samples, 0.04%)hello_kafka`DYLD-STUB$$memcpy (65 samples, 0.03%)hello_kafka`bytes::bytes::Bytes::copy_from_slice (81 samples, 0.04%)hello_kafka`core::ptr::drop_in_place<kafkas::producer::Producer<kafkas::executor::TokioExecutor>::send<hello_kafka::TestData,&str>::{{closure}}> (29 samples, 0.01%)hello_kafka`dashmap::DashMap<K,V,S>::get (34 samples, 0.02%)hello_kafka`futures_channel::mpsc::decode_state (53 samples, 0.03%)hello_kafka`futures_channel::mpsc::encode_state (117 samples, 0.06%)hello_kafka`futures_core::task::__internal::atomic_waker::AtomicWaker::wake (2,217 samples, 1.14%)hello_kafka`<&mut S as futures_sink::Sink<Item>>::start_send (10,063 samples, 5.17%)hello_..libsystem_malloc.dylib`nanov2_malloc (4,237 samples, 2.18%)l..libsystem_malloc.dylib`nanov2_allocate_outlined (35 samples, 0.02%)libsystem_malloc.dylib`nanov2_find_block_and_allocate (21 samples, 0.01%)hello_kafka`DYLD-STUB$$memcmp (32 samples, 0.02%)hello_kafka`DYLD-STUB$$memcpy (91 samples, 0.05%)hello_kafka`__rdl_alloc (167 samples, 0.09%)hello_kafka`__rust_alloc (41 samples, 0.02%)hello_kafka`alloc::vec::Vec<T,A>::into_boxed_slice (67 samples, 0.03%)hello_kafka`alloc::vec::Vec<T,A>::into_boxed_slice (211 samples, 0.11%)libsystem_malloc.dylib`nanov2_malloc (3,682 samples, 1.89%)l..libsystem_malloc.dylib`nanov2_allocate_outlined (32 samples, 0.02%)libsystem_malloc.dylib`nanov2_find_block_and_allocate (27 samples, 0.01%)hello_kafka`bytes::bytes::Bytes::copy_from_slice (4,433 samples, 2.28%)h..libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (163 samples, 0.08%)hello_kafka`core::hash::Hasher::write_str (66 samples, 0.03%)hello_kafka`core::ptr::drop_in_place<kafkas::producer::Producer<kafkas::executor::TokioExecutor>::send<hello_kafka::TestData,&str>::{{closure}}> (211 samples, 0.11%)hello_kafka`core::hash::Hasher::write_str (247 samples, 0.13%)hello_kafka`dashmap::DashMap<K,V,S>::get (2,766 samples, 1.42%)libsystem_platform.dylib`_platform_memcmp$VARIANT$Base (293 samples, 0.15%)hello_kafka`futures_channel::mpsc::decode_state (78 samples, 0.04%)hello_kafka`futures_channel::mpsc::encode_state (27 samples, 0.01%)hello_kafka`futures_core::task::__internal::atomic_waker::AtomicWaker::wake (43 samples, 0.02%)hello_kafka`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (78 samples, 0.04%)hello_kafka`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (649 samples, 0.33%)hello_kafka`hashbrown::map::make_hash (1,603 samples, 0.82%)hello_kafka`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (635 samples, 0.33%)hello_kafka`<dashmap::DashMap<K,V,S> as dashmap::t::Map<K,V,S>>::_get (5,901 samples, 3.03%)hel..libsystem_platform.dylib`_platform_memcmp$VARIANT$Base (421 samples, 0.22%)hello_kafka`dashmap::DashMap<K,V,S>::get (49 samples, 0.03%)hello_kafka`hashbrown::map::make_hash (42 samples, 0.02%)hello_kafka`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (65 samples, 0.03%)hello_kafka`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (727 samples, 0.37%)hello_kafka`hashbrown::map::make_hash (1,574 samples, 0.81%)hello_kafka`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (644 samples, 0.33%)hello_kafka`dashmap::DashMap<K,V,S>::get (5,531 samples, 2.84%)he..libsystem_platform.dylib`_platform_memcmp$VARIANT$Base (329 samples, 0.17%)hello_kafka`hashbrown::map::make_hash (38 samples, 0.02%)libsystem_platform.dylib`DYLD-STUB$$_platform_memcmp (50 samples, 0.03%)hello_kafka`kafkas::metadata::Cluster::partitions (6,104 samples, 3.14%)hel..libsystem_platform.dylib`_platform_memcmp$VARIANT$Base (55 samples, 0.03%)libsystem_platform.dylib`DYLD-STUB$$_platform_memcmp (40 samples, 0.02%)libsystem_platform.dylib`_platform_memcmp$VARIANT$Base (68 samples, 0.03%)hello_kafka`kafkas::client::Kafka<Exe>::partitions::_{{closure}} (14,212 samples, 7.31%)hello_kafk..libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (721 samples, 0.37%)hello_kafka`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (82 samples, 0.04%)hello_kafka`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (720 samples, 0.37%)hello_kafka`hashbrown::map::make_hash (1,590 samples, 0.82%)hello_kafka`<core::hash::sip::Hasher<S> as core::hash::Hasher>::write (684 samples, 0.35%)hello_kafka`dashmap::DashMap<K,V,S>::get (5,486 samples, 2.82%)he..libsystem_platform.dylib`_platform_memcmp$VARIANT$Base (339 samples, 0.17%)hello_kafka`hashbrown::map::make_hash (37 samples, 0.02%)libsystem_platform.dylib`DYLD-STUB$$_platform_memcmp (47 samples, 0.02%)hello_kafka`kafkas::metadata::Cluster::available_partitions (6,048 samples, 3.11%)hel..libsystem_platform.dylib`_platform_memcmp$VARIANT$Base (70 samples, 0.04%)hello_kafka`kafkas::metadata::Cluster::partitions (44 samples, 0.02%)hello_kafka`<kafkas::producer::aggregator::RecordAggregator as kafkas::producer::aggregator::Aggregator>::try_push (55 samples, 0.03%)hello_kafka`DYLD-STUB$$memcpy (82 samples, 0.04%)hello_kafka`__rdl_alloc (86 samples, 0.04%)libsystem_kernel.dylib`__psynch_cvwait (2,187 samples, 1.12%)libsystem_kernel.dylib`swtch_pri (3,859 samples, 1.98%)l..libsystem_pthread.dylib`pthread_mutex_lock (72 samples, 0.04%)libsystem_pthread.dylib`_pthread_cond_wait (213 samples, 0.11%)libsystem_pthread.dylib`pthread_testcancel (41 samples, 0.02%)libsystem_pthread.dylib`cthread_yield (91 samples, 0.05%)hello_kafka`dashmap::lock::RawRwLock::lock_exclusive_slow (7,471 samples, 3.84%)hell..hello_kafka`dashmap::lock::RawRwLock::unlock_exclusive_slow (70 samples, 0.04%)hello_kafka`<kafkas::producer::aggregator::RecordAggregator as kafkas::producer::aggregator::Aggregator>::try_push (3,369 samples, 1.73%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (2,851 samples, 1.47%)libsystem_malloc.dylib`nanov2_allocate_outlined (31 samples, 0.02%)libsystem_malloc.dylib`nanov2_allocate_outlined (1,101 samples, 0.57%)libsystem_malloc.dylib`nanov2_find_block_and_allocate (602 samples, 0.31%)libsystem_malloc.dylib`nanov2_allocate_from_block (63 samples, 0.03%)libsystem_malloc.dylib`nanov2_malloc (7,080 samples, 3.64%)libs..libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (84 samples, 0.04%)hello_kafka`kafkas::producer::batch::ProducerBatch::try_push (17,764 samples, 9.13%)hello_kafka`k..libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (1,613 samples, 0.83%)libsystem_malloc.dylib`_malloc_zone_malloc (524 samples, 0.27%)libsystem_malloc.dylib`malloc (67 samples, 0.03%)libsystem_malloc.dylib`nanov2_malloc (47 samples, 0.02%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (150 samples, 0.08%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (703 samples, 0.36%)libsystem_pthread.dylib`cthread_yield (54 samples, 0.03%)hello_kafka`kafkas::producer::TopicProducer<Exe>::try_push::_{{closure}} (34,843 samples, 17.91%)hello_kafka`kafkas::producer..libsystem_pthread.dylib`pthread_mutex_unlock (36 samples, 0.02%)hello_kafka`kafkas::producer::batch::ProducerBatch::try_push (56 samples, 0.03%)hello_kafka`kafkas::producer::partitioner::RoundRobinPartitioner::next_value (868 samples, 0.45%)libdyld.dylib`0x7ff8143c99f1 (48 samples, 0.02%)libdyld.dylib`0x7ff8143c99f5 (21 samples, 0.01%)libdyld.dylib`0x7ff8143c99fe (47 samples, 0.02%)libdyld.dylib`0x7ff8143c9a03 (23 samples, 0.01%)libsystem_malloc.dylib`_malloc_zone_malloc (534 samples, 0.27%)libsystem_malloc.dylib`malloc (92 samples, 0.05%)libsystem_malloc.dylib`nanov2_malloc (59 samples, 0.03%)libsystem_platform.dylib`DYLD-STUB$$_platform_memcmp (41 samples, 0.02%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (115 samples, 0.06%)libsystem_platform.dylib`_platform_memcmp$VARIANT$Base (50 samples, 0.03%)hello_kafka`hello_kafka::main::_{{closure}} (87,288 samples, 44.87%)hello_kafka`hello_kafka::main::_{{closure}}libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (2,011 samples, 1.03%)hello_kafka`kafkas::client::Kafka<Exe>::partitions::_{{closure}} (39 samples, 0.02%)hello_kafka`kafkas::metadata::Cluster::available_partitions (33 samples, 0.02%)hello_kafka`kafkas::producer::TopicProducer<Exe>::try_push::_{{closure}} (40 samples, 0.02%)hello_kafka`kafkas::producer::partitioner::RoundRobinPartitioner::next_value (81 samples, 0.04%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (169 samples, 0.09%)hello_kafka`main (88,302 samples, 45.39%)hello_kafka`mainhello_kafka`std::rt::lang_start_internal (88,302 samples, 45.39%)hello_kafka`std::rt::lang_start_internalhello_kafka`std::rt::lang_start::_{{closure}} (88,302 samples, 45.39%)hello_kafka`std::rt::lang_start::_{{closure}}hello_kafka`std::sys_common::backtrace::__rust_begin_short_backtrace (88,302 samples, 45.39%)hello_kafka`std::sys_common::backtrace::__rust_begin_short_backtracehello_kafka`hello_kafka::main (88,302 samples, 45.39%)hello_kafka`hello_kafka::mainhello_kafka`tokio::runtime::runtime::Runtime::block_on (88,301 samples, 45.39%)hello_kafka`tokio::runtime::runtime::Runtime::block_onhello_kafka`tokio::runtime::context::BlockingRegionGuard::block_on (88,301 samples, 45.39%)hello_kafka`tokio::runtime::context::BlockingRegionGuard::block_onlibsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (360 samples, 0.19%)dyld`start (88,303 samples, 45.39%)dyld`starthello_kafka`tokio::runtime::scheduler::multi_thread::idle::Idle::transition_worker_to_parked (34 samples, 0.02%)hello_kafka`tokio::runtime::scheduler::multi_thread::idle::Idle::unpark_worker_by_id (20 samples, 0.01%)hello_kafka`tokio::runtime::scheduler::multi_thread::queue::Steal<T>::steal_into (155 samples, 0.08%)libsystem_kernel.dylib`__psynch_cvwait (2,221 samples, 1.14%)libsystem_kernel.dylib`__psynch_mutexwait (45 samples, 0.02%)libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_slow (47 samples, 0.02%)libsystem_pthread.dylib`pthread_mutex_lock (54 samples, 0.03%)libsystem_pthread.dylib`_pthread_cond_wait (276 samples, 0.14%)libsystem_pthread.dylib`pthread_testcancel (52 samples, 0.03%)hello_kafka`parking_lot::condvar::Condvar::wait_until_internal (2,675 samples, 1.38%)hello_kafka`std::time::Instant::checked_duration_since (30 samples, 0.02%)hello_kafka`mio::poll::Poll::poll (51 samples, 0.03%)hello_kafka`tokio::macros::scoped_tls::ScopedKey<T>::with (30 samples, 0.02%)hello_kafka`tokio::runtime::scheduler::multi_thread::worker::_<impl tokio::runtime::task::Schedule for alloc::sync::Arc<tokio::runtime::scheduler::multi_thread::handle::Handle>>::schedule (39 samples, 0.02%)hello_kafka`tokio::runtime::io::scheduled_io::ScheduledIo::wake0 (68 samples, 0.03%)hello_kafka`tokio::runtime::task::waker::wake_by_val (46 samples, 0.02%)hello_kafka`tokio::runtime::io::Driver::turn (1,822 samples, 0.94%)libsystem_kernel.dylib`kevent (1,601 samples, 0.82%)hello_kafka`tokio::runtime::time::wheel::Wheel::next_expiration (32 samples, 0.02%)hello_kafka`tokio::runtime::time::wheel::level::Level::next_expiration (21 samples, 0.01%)hello_kafka`tokio::runtime::time::_<impl tokio::runtime::time::handle::Handle>::process_at_time (86 samples, 0.04%)hello_kafka`tokio::runtime::time::Driver::park_internal (2,055 samples, 1.06%)libsystem_kernel.dylib`mach_absolute_time (21 samples, 0.01%)hello_kafka`tokio::runtime::scheduler::multi_thread::park::Parker::park (5,104 samples, 2.62%)he..libsystem_pthread.dylib`pthread_mutex_unlock (44 samples, 0.02%)hello_kafka`tokio::runtime::io::Driver::turn (45 samples, 0.02%)libsystem_kernel.dylib`kevent (41 samples, 0.02%)hello_kafka`tokio::runtime::scheduler::multi_thread::worker::Context::park_timeout (5,247 samples, 2.70%)he..hello_kafka`tokio::runtime::time::Driver::park_internal (59 samples, 0.03%)hello_kafka`parking_lot_core::parking_lot::lock_bucket_pair (29 samples, 0.01%)libsystem_kernel.dylib`__psynch_cvsignal (605 samples, 0.31%)libsystem_kernel.dylib`__psynch_mutexdrop (30 samples, 0.02%)libsystem_pthread.dylib`_pthread_mutex_firstfit_unlock_slow (32 samples, 0.02%)libsystem_pthread.dylib`pthread_cond_signal (21 samples, 0.01%)hello_kafka`parking_lot::condvar::Condvar::notify_one_slow (769 samples, 0.40%)hello_kafka`tokio::runtime::scheduler::multi_thread::idle::Idle::worker_to_notify (22 samples, 0.01%)hello_kafka`<futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll (26 samples, 0.01%)hello_kafka`kafkas::producer::Producer<Exe>::new::_{{closure}}::_{{closure}} (20 samples, 0.01%)libsystem_kernel.dylib`__psynch_cvsignal (224 samples, 0.12%)hello_kafka`parking_lot::condvar::Condvar::notify_one_slow (266 samples, 0.14%)hello_kafka`tokio::runtime::driver::Handle::unpark (80 samples, 0.04%)libsystem_kernel.dylib`kevent (79 samples, 0.04%)hello_kafka`tokio::runtime::scheduler::multi_thread::worker::_<impl tokio::runtime::scheduler::multi_thread::handle::Handle>::schedule_local (46 samples, 0.02%)hello_kafka`tokio::runtime::scheduler::multi_thread::worker::_<impl tokio::runtime::scheduler::multi_thread::handle::Handle>::schedule_task::_{{closure}} (413 samples, 0.21%)hello_kafka`tokio::macros::scoped_tls::ScopedKey<T>::with (418 samples, 0.21%)hello_kafka`tokio::runtime::scheduler::multi_thread::worker::_<impl tokio::runtime::task::Schedule for alloc::sync::Arc<tokio::runtime::scheduler::multi_thread::handle::Handle>>::yield_now (427 samples, 0.22%)hello_kafka`<futures_channel::oneshot::Receiver<T> as core::future::future::Future>::poll (64 samples, 0.03%)hello_kafka`<futures_channel::oneshot::Receiver<T> as core::future::future::Future>::poll (3,800 samples, 1.95%)h..libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (1,105 samples, 0.57%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (32 samples, 0.02%)hello_kafka`<kafkas::producer::SendFuture as core::future::future::Future>::poll (4,474 samples, 2.30%)h..libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (470 samples, 0.24%)hello_kafka`DYLD-STUB$$memcpy (31 samples, 0.02%)hello_kafka`alloc::sync::Arc<T>::drop_slow (769 samples, 0.40%)hello_kafka`futures_channel::mpsc::queue::Queue<T>::pop_spin (44 samples, 0.02%)hello_kafka`__rdl_dealloc (77 samples, 0.04%)hello_kafka`__rust_dealloc (24 samples, 0.01%)libsystem_malloc.dylib`_nanov2_free (3,350 samples, 1.72%)libsystem_kernel.dylib`madvise (107 samples, 0.06%)hello_kafka`futures_channel::mpsc::queue::Queue<T>::pop_spin (5,297 samples, 2.72%)he..libsystem_malloc.dylib`nanov2_madvise_block (111 samples, 0.06%)libsystem_malloc.dylib`nanov2_madvise_block_locked (111 samples, 0.06%)libsystem_malloc.dylib`_nanov2_free (44 samples, 0.02%)libsystem_malloc.dylib`free (330 samples, 0.17%)hello_kafka`futures_util::stream::stream::StreamExt::poll_next_unpin (7,285 samples, 3.74%)hell..libsystem_malloc.dylib`nanov2_try_free_default (27 samples, 0.01%)libsystem_malloc.dylib`DYLD-STUB$$_platform_bzero (33 samples, 0.02%)libsystem_malloc.dylib`_nanov2_free (3,126 samples, 1.61%)libsystem_platform.dylib`_platform_bzero$VARIANT$Haswell (374 samples, 0.19%)libsystem_kernel.dylib`madvise (6,100 samples, 3.14%)lib..libsystem_malloc.dylib`mvm_madvise_free (134 samples, 0.07%)libsystem_malloc.dylib`nanov2_madvise_block_locked (6,374 samples, 3.28%)lib..libsystem_malloc.dylib`nanov2_madvise_block (6,423 samples, 3.30%)lib..libsystem_platform.dylib`DYLD-STUB$$_platform_bzero (38 samples, 0.02%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (43 samples, 0.02%)libsystem_platform.dylib`_platform_bzero$VARIANT$Haswell (88 samples, 0.05%)hello_kafka`<core::pin::Pin<P> as core::future::future::Future>::poll (27,950 samples, 14.37%)hello_kafka`<core::pin..libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (520 samples, 0.27%)libsystem_malloc.dylib`_nanov2_free (137 samples, 0.07%)libsystem_platform.dylib`_platform_bzero$VARIANT$Haswell (118 samples, 0.06%)hello_kafka`futures_channel::mpsc::queue::Queue<T>::pop_spin (173 samples, 0.09%)hello_kafka`futures_core::task::__internal::atomic_waker::AtomicWaker::register (22 samples, 0.01%)hello_kafka`<futures_channel::mpsc::UnboundedReceiver<T> as futures_core::stream::Stream>::poll_next (254 samples, 0.13%)hello_kafka`<futures_channel::oneshot::Receiver<T> as core::future::future::Future>::poll (47 samples, 0.02%)hello_kafka`<tokio_util::codec::length_delimited::LengthDelimitedCodec as tokio_util::codec::decoder::Decoder>::decode (45 samples, 0.02%)hello_kafka`<kafka_protocol::messages::produce_response::PartitionProduceResponse as kafka_protocol::protocol::Decodable>::decode (71 samples, 0.04%)hello_kafka`bytes::bytes_mut::BytesMut::set_start (23 samples, 0.01%)libsystem_malloc.dylib`szone_malloc_should_clear (67 samples, 0.03%)libsystem_malloc.dylib`small_malloc_should_clear (61 samples, 0.03%)libsystem_malloc.dylib`small_malloc_from_free_list (37 samples, 0.02%)hello_kafka`<kafka_protocol::protocol::types::Array<E> as kafka_protocol::protocol::Decoder<alloc::vec::Vec<T>>>::decode (205 samples, 0.11%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (24 samples, 0.01%)hello_kafka`<kafka_protocol::protocol::types::String as kafka_protocol::protocol::Decoder<T>>::decode (20 samples, 0.01%)hello_kafka`<kafka_protocol::messages::produce_response::TopicProduceResponse as kafka_protocol::protocol::MapDecodable>::decode (290 samples, 0.15%)libsystem_malloc.dylib`szone_malloc_should_clear (52 samples, 0.03%)libsystem_malloc.dylib`tiny_malloc_should_clear (52 samples, 0.03%)libsystem_malloc.dylib`tiny_malloc_from_free_list (36 samples, 0.02%)hello_kafka`alloc::raw_vec::finish_grow (56 samples, 0.03%)libsystem_malloc.dylib`nanov2_malloc (23 samples, 0.01%)hello_kafka`hashbrown::raw::inner::RawTable<T,A>::reserve_rehash (41 samples, 0.02%)hello_kafka`hashbrown::raw::inner::RawTable<T,A>::insert (51 samples, 0.03%)hello_kafka`indexmap::map::core::IndexMapCore<K,V>::insert_full (138 samples, 0.07%)hello_kafka`indexmap::map::IndexMap<K,V,S>::insert (161 samples, 0.08%)hello_kafka`<kafka_protocol::protocol::types::Array<E> as kafka_protocol::protocol::Decoder<indexmap::map::IndexMap<K,V>>>::decode (475 samples, 0.24%)hello_kafka`<kafka_protocol::messages::produce_response::ProduceResponse as kafka_protocol::protocol::Decodable>::decode (501 samples, 0.26%)hello_kafka`core::hash::BuildHasher::hash_one (111 samples, 0.06%)hello_kafka`kafkas::protocol::KafkaCodec::decode_response (679 samples, 0.35%)hello_kafka`<kafkas::protocol::KafkaCodec as tokio_util::codec::decoder::Decoder>::decode (775 samples, 0.40%)hello_kafka`<&mio::net::tcp::stream::TcpStream as std::io::Read>::read (1,326 samples, 0.68%)libsystem_kernel.dylib`__recvfrom (1,296 samples, 0.67%)hello_kafka`tokio::runtime::io::scheduled_io::ScheduledIo::poll_readiness (23 samples, 0.01%)hello_kafka`tokio::runtime::io::registration::Registration::poll_ready (45 samples, 0.02%)hello_kafka`tokio::io::poll_evented::PollEvented<E>::poll_read (1,414 samples, 0.73%)hello_kafka`tokio_util::util::poll_read_buf (1,429 samples, 0.73%)hello_kafka`<tokio_util::codec::framed_impl::FramedImpl<T,U,R> as futures_core::stream::Stream>::poll_next (2,303 samples, 1.18%)hello_kafka`futures_util::lock::bilock::BiLock<T>::poll_lock (34 samples, 0.02%)hello_kafka`<futures_util::stream::stream::split::SplitStream<S> as futures_core::stream::Stream>::poll_next (2,388 samples, 1.23%)hello_kafka`alloc::collections::btree::map::entry::OccupiedEntry<K,V,A>::remove_entry (30 samples, 0.02%)hello_kafka`tokio::runtime::scheduler::multi_thread::worker::_<impl tokio::runtime::task::Schedule for alloc::sync::Arc<tokio::runtime::scheduler::multi_thread::handle::Handle>>::schedule (20 samples, 0.01%)hello_kafka`tokio::runtime::task::waker::wake_by_val (33 samples, 0.02%)hello_kafka`futures_channel::oneshot::Sender<T>::send (72 samples, 0.04%)hello_kafka`<kafkas::connection::Receiver<S> as core::future::future::Future>::poll (2,903 samples, 1.49%)hello_kafka`<futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll (2,966 samples, 1.52%)hello_kafka`<kafkas::executor::Interval as futures_core::stream::Stream>::poll_next (21 samples, 0.01%)hello_kafka`<kafkas::producer::SendFuture as core::future::future::Future>::poll (34 samples, 0.02%)hello_kafka`<tokio::runtime::task::core::TaskIdGuard as core::ops::drop::Drop>::drop (143 samples, 0.07%)hello_kafka`DYLD-STUB$$memcpy (38 samples, 0.02%)hello_kafka`__rdl_dealloc (68 samples, 0.03%)hello_kafka`alloc::sync::Arc<T>::drop_slow (68 samples, 0.03%)hello_kafka`core::ptr::drop_in_place<kafkas::producer::Producer<kafkas::executor::TokioExecutor>::send_raw::{{closure}}> (21 samples, 0.01%)hello_kafka`futures_util::stream::stream::StreamExt::poll_next_unpin (47 samples, 0.02%)hello_kafka`<bytes::bytes_mut::BytesMut as core::ops::drop::Drop>::drop (23 samples, 0.01%)hello_kafka`bytes::bytes_mut::BytesMut::split_to (23 samples, 0.01%)hello_kafka`<bytes::bytes_mut::BytesMut as kafka_protocol::protocol::buf::ByteBuf>::get_bytes (28 samples, 0.01%)hello_kafka`bytes::bytes_mut::BytesMut::extend_from_slice (129 samples, 0.07%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (129 samples, 0.07%)hello_kafka`<tokio_util::codec::length_delimited::LengthDelimitedCodec as tokio_util::codec::encoder::Encoder<bytes::bytes::Bytes>>::encode (152 samples, 0.08%)hello_kafka`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (21 samples, 0.01%)hello_kafka`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (30 samples, 0.02%)libsystem_malloc.dylib`malloc_zone_realloc (27 samples, 0.01%)libsystem_malloc.dylib`szone_realloc (25 samples, 0.01%)hello_kafka`bytes::bytes_mut::BytesMut::reserve_inner (35 samples, 0.02%)hello_kafka`alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle (33 samples, 0.02%)hello_kafka`alloc::raw_vec::finish_grow (33 samples, 0.02%)libsystem_malloc.dylib`realloc (31 samples, 0.02%)hello_kafka`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (52 samples, 0.03%)hello_kafka`<kafka_protocol::messages::produce_request::PartitionProduceData as kafka_protocol::protocol::Encodable>::encode (67 samples, 0.03%)libsystem_malloc.dylib`szone_malloc_should_clear (20 samples, 0.01%)libsystem_malloc.dylib`nanov2_realloc (30 samples, 0.02%)libsystem_malloc.dylib`small_try_realloc_in_place (40 samples, 0.02%)libsystem_malloc.dylib`large_malloc (21 samples, 0.01%)libsystem_malloc.dylib`szone_malloc_should_clear (22 samples, 0.01%)libsystem_malloc.dylib`szone_realloc (135 samples, 0.07%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (57 samples, 0.03%)libsystem_malloc.dylib`malloc_zone_realloc (171 samples, 0.09%)hello_kafka`alloc::raw_vec::finish_grow (204 samples, 0.10%)libsystem_malloc.dylib`realloc (191 samples, 0.10%)hello_kafka`bytes::bytes_mut::BytesMut::reserve_inner (213 samples, 0.11%)hello_kafka`alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle (212 samples, 0.11%)hello_kafka`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (395 samples, 0.20%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (165 samples, 0.08%)hello_kafka`<kafka_protocol::protocol::types::Bytes as kafka_protocol::protocol::Encoder<core::option::Option<&bytes::bytes::Bytes>>>::encode (417 samples, 0.21%)hello_kafka`<kafka_protocol::messages::produce_request::TopicProduceData as kafka_protocol::protocol::MapEncodable>::encode (525 samples, 0.27%)hello_kafka`<kafka_protocol::messages::produce_request::ProduceRequest as kafka_protocol::protocol::Encodable>::encode (568 samples, 0.29%)hello_kafka`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (22 samples, 0.01%)hello_kafka`<kafka_protocol::protocol::types::String as kafka_protocol::protocol::Encoder<core::option::Option<&str>>>::encode (24 samples, 0.01%)hello_kafka`<kafka_protocol::messages::request_header::RequestHeader as kafka_protocol::protocol::Encodable>::encode (45 samples, 0.02%)libsystem_malloc.dylib`_szone_free (20 samples, 0.01%)libsystem_malloc.dylib`small_free_list_add_ptr (21 samples, 0.01%)libsystem_malloc.dylib`free_small (151 samples, 0.08%)libsystem_malloc.dylib`small_free_list_remove_ptr_no_clear (28 samples, 0.01%)hello_kafka`bytes::bytes::promotable_even_drop (194 samples, 0.10%)hello_kafka`core::ptr::drop_in_place<kafka_protocol::messages::produce_request::TopicProduceData> (232 samples, 0.12%)hello_kafka`core::ptr::drop_in_place<kafka_protocol::messages::produce_request::ProduceRequest> (287 samples, 0.15%)libsystem_malloc.dylib`free_tiny (25 samples, 0.01%)hello_kafka`kafkas::protocol::KafkaCodec::encode_request (968 samples, 0.50%)hello_kafka`kafkas::protocol::KafkaCodec::encode0 (1,003 samples, 0.52%)hello_kafka`<kafkas::protocol::KafkaCodec as tokio_util::codec::encoder::Encoder<kafkas::protocol::Command>>::encode (1,235 samples, 0.63%)hello_kafka`<&mio::net::tcp::stream::TcpStream as std::io::Write>::write_vectored (2,044 samples, 1.05%)libsystem_kernel.dylib`writev (2,036 samples, 1.05%)hello_kafka`<tokio::net::tcp::stream::TcpStream as tokio::io::async_write::AsyncWrite>::poll_write_vectored (2,074 samples, 1.07%)hello_kafka`tokio::runtime::io::registration::Registration::poll_write_io (2,072 samples, 1.07%)hello_kafka`<tokio_util::codec::framed_impl::FramedImpl<T,U,W> as futures_sink::Sink<I>>::poll_flush (2,132 samples, 1.10%)hello_kafka`tokio_util::util::poll_write_buf (2,103 samples, 1.08%)hello_kafka`<futures_util::stream::stream::split::SplitSink<S,Item> as futures_sink::Sink<Item>>::poll_flush (3,438 samples, 1.77%)libsystem_malloc.dylib`free_tiny (21 samples, 0.01%)hello_kafka`futures_channel::mpsc::queue::Queue<T>::pop_spin (54 samples, 0.03%)hello_kafka`futures_channel::mpsc::UnboundedReceiver<T>::next_message (80 samples, 0.04%)hello_kafka`futures_util::stream::stream::StreamExt::poll_next_unpin (103 samples, 0.05%)hello_kafka`kafkas::connection::Connection<Exe>::connect::_{{closure}}::_{{closure}} (3,626 samples, 1.86%)h..hello_kafka`<alloc::collections::btree::map::BTreeMap<K,V,A> as core::ops::drop::Drop>::drop (24 samples, 0.01%)hello_kafka`std::time::Instant::now (22 samples, 0.01%)hello_kafka`<std::time::Instant as core::ops::arith::Add<core::time::Duration>>::add (1,198 samples, 0.62%)hello_kafka`<tokio::time::sleep::Sleep as core::future::future::Future>::poll (874 samples, 0.45%)hello_kafka`tokio::sync::task::atomic_waker::AtomicWaker::register_by_ref (718 samples, 0.37%)hello_kafka`tokio::runtime::task::waker::clone_waker (217 samples, 0.11%)hello_kafka`tokio::runtime::task::state::State::ref_inc (194 samples, 0.10%)hello_kafka`<std::time::Instant as core::ops::arith::Add<core::time::Duration>>::add (546 samples, 0.28%)hello_kafka`std::time::Instant::checked_duration_since (739 samples, 0.38%)hello_kafka`tokio::runtime::task::waker::wake_by_val (204 samples, 0.10%)hello_kafka`tokio::runtime::task::state::State::transition_to_notified_by_val (182 samples, 0.09%)hello_kafka`tokio::runtime::time::entry::TimerEntry::reset (2,589 samples, 1.33%)hello_kafka`tokio::runtime::time::_<impl tokio::runtime::time::handle::Handle>::reregister (911 samples, 0.47%)libdyld.dylib`0x7ff8143c99f1 (20 samples, 0.01%)hello_kafka`tokio::time::interval::Interval::poll_tick (5,406 samples, 2.78%)he..libsystem_kernel.dylib`mach_absolute_time (543 samples, 0.28%)hello_kafka`<kafkas::executor::Interval as futures_core::stream::Stream>::poll_next (5,506 samples, 2.83%)he..hello_kafka`bytes::bytes::promotable_even_drop (78 samples, 0.04%)hello_kafka`bytes::bytes::static_drop (20 samples, 0.01%)hello_kafka`core::ptr::drop_in_place<kafkas::producer::Producer<kafkas::executor::TokioExecutor>::send_raw::{{closure}}> (29 samples, 0.01%)libsystem_malloc.dylib`tiny_free_no_lock (22 samples, 0.01%)libsystem_malloc.dylib`free_tiny (48 samples, 0.02%)hello_kafka`<alloc::collections::btree::map::BTreeMap<K,V,A> as core::ops::drop::Drop>::drop (77 samples, 0.04%)hello_kafka`<alloc::string::String as core::fmt::Write>::write_str (23 samples, 0.01%)hello_kafka`<alloc::vec::into_iter::IntoIter<T,A> as core::ops::drop::Drop>::drop (29 samples, 0.01%)libsystem_malloc.dylib`nanov2_size (21 samples, 0.01%)libsystem_malloc.dylib`szone_realloc (42 samples, 0.02%)libsystem_malloc.dylib`malloc_zone_realloc (60 samples, 0.03%)libsystem_malloc.dylib`small_size (24 samples, 0.01%)libsystem_malloc.dylib`realloc (126 samples, 0.06%)hello_kafka`alloc::vec::Vec<T,A>::into_boxed_slice (163 samples, 0.08%)hello_kafka`<bytes::bytes::Bytes as core::convert::From<alloc::vec::Vec<u8>>>::from (188 samples, 0.10%)hello_kafka`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (21 samples, 0.01%)hello_kafka`<core::sync::atomic::AtomicPtr<T> as bytes::loom::sync::atomic::AtomicMut<T>>::with_mut (38 samples, 0.02%)hello_kafka`alloc::sync::Arc<T>::drop_slow (58 samples, 0.03%)libsystem_malloc.dylib`_nanov2_free (91 samples, 0.05%)libsystem_malloc.dylib`nanov2_malloc (80 samples, 0.04%)hello_kafka`<dashmap::iter::Iter<K,V,S,M> as core::iter::traits::iterator::Iterator>::next (339 samples, 0.17%)hello_kafka`<std::time::Instant as core::ops::arith::Add<core::time::Duration>>::add (24 samples, 0.01%)libsystem_kernel.dylib`__psynch_cvsignal (1,209 samples, 0.62%)libsystem_pthread.dylib`pthread_cond_signal (42 samples, 0.02%)libsystem_pthread.dylib`pthread_mutex_lock (52 samples, 0.03%)hello_kafka`dashmap::lock::RawRwLock::unlock_exclusive_slow (1,462 samples, 0.75%)hello_kafka`alloc::sync::Arc<T>::drop_slow (1,545 samples, 0.79%)libsystem_malloc.dylib`_nanov2_free (98 samples, 0.05%)libsystem_malloc.dylib`nanov2_malloc (123 samples, 0.06%)hello_kafka`<dashmap::iter::IterMut<K,V,S,M> as core::iter::traits::iterator::Iterator>::next (2,026 samples, 1.04%)hello_kafka`<i16 as kafka_protocol::error::ParseResponseErrorCode>::is_ok (37 samples, 0.02%)hello_kafka`__rdl_dealloc (70 samples, 0.04%)hello_kafka`alloc::collections::btree::map::entry::OccupiedEntry<K,V,A>::remove_entry (20 samples, 0.01%)hello_kafka`alloc::collections::btree::map::BTreeMap<K,V,A>::remove (34 samples, 0.02%)libsystem_malloc.dylib`szone_malloc_should_clear (25 samples, 0.01%)libsystem_malloc.dylib`tiny_malloc_should_clear (23 samples, 0.01%)hello_kafka`alloc::collections::btree::node::Handle<alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Mut,K,V,alloc::collections::btree::node::marker::Leaf>,alloc::collections::btree::node::marker::Edge>::insert_recursing (249 samples, 0.13%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (140 samples, 0.07%)libsystem_malloc.dylib`szone_malloc_should_clear (20 samples, 0.01%)hello_kafka`alloc::collections::btree::map::entry::VacantEntry<K,V,A>::insert (340 samples, 0.17%)libsystem_malloc.dylib`free_tiny (40 samples, 0.02%)hello_kafka`alloc::collections::btree::node::BalancingContext<K,V>::merge_tracking_child_edge (68 samples, 0.03%)hello_kafka`alloc::collections::btree::remove::_<impl alloc::collections::btree::node::Handle<alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Mut,K,V,alloc::collections::btree::node::marker::Leaf>,alloc::collections::btree::node::marker::KV>>::remove_leaf_kv (234 samples, 0.12%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (72 samples, 0.04%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (27 samples, 0.01%)hello_kafka`alloc::collections::btree::remove::_<impl alloc::collections::btree::node::Handle<alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Mut,K,V,alloc::collections::btree::node::marker::LeafOrInternal>,alloc::collections::btree::node::marker::KV>>::remove_kv_tracking (327 samples, 0.17%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (30 samples, 0.02%)libsystem_malloc.dylib`szone_malloc_should_clear (28 samples, 0.01%)libsystem_malloc.dylib`small_malloc_should_clear (27 samples, 0.01%)libsystem_malloc.dylib`szone_realloc (86 samples, 0.04%)libsystem_malloc.dylib`malloc_zone_realloc (110 samples, 0.06%)libsystem_malloc.dylib`realloc (118 samples, 0.06%)hello_kafka`alloc::raw_vec::finish_grow (150 samples, 0.08%)hello_kafka`alloc::raw_vec::RawVec<T,A>::reserve_for_push (165 samples, 0.08%)libsystem_kernel.dylib`__psynch_cvsignal (39 samples, 0.02%)hello_kafka`dashmap::lock::RawRwLock::unlock_exclusive_slow (46 samples, 0.02%)hello_kafka`alloc::sync::Arc<T>::drop_slow (56 samples, 0.03%)hello_kafka`<core::sync::atomic::AtomicPtr<T> as bytes::loom::sync::atomic::AtomicMut<T>>::with_mut (151 samples, 0.08%)hello_kafka`bytes::bytes::promotable_even_drop (3,196 samples, 1.64%)libsystem_malloc.dylib`_nanov2_free (2,987 samples, 1.54%)hello_kafka`futures_channel::oneshot::Sender<T>::send (41 samples, 0.02%)hello_kafka`hashbrown::raw::inner::RawTable<T,A>::reserve_rehash (25 samples, 0.01%)hello_kafka`hashbrown::raw::inner::RawTable<T,A>::insert (33 samples, 0.02%)hello_kafka`indexmap::map::IndexMap<K,V,S>::insert (82 samples, 0.04%)hello_kafka`indexmap::map::core::IndexMapCore<K,V>::insert_full (70 samples, 0.04%)libsystem_malloc.dylib`nanov2_malloc (117 samples, 0.06%)libsystem_malloc.dylib`nanov2_size (77 samples, 0.04%)libsystem_malloc.dylib`nanov2_pointer_size (84 samples, 0.04%)libsystem_malloc.dylib`_nanov2_free (99 samples, 0.05%)libsystem_malloc.dylib`nanov2_malloc (187 samples, 0.10%)libsystem_malloc.dylib`nanov2_realloc (322 samples, 0.17%)hello_kafka`alloc::raw_vec::finish_grow (712 samples, 0.37%)libsystem_malloc.dylib`realloc (481 samples, 0.25%)libsystem_malloc.dylib`malloc_zone_realloc (443 samples, 0.23%)libsystem_malloc.dylib`_malloc_zone_malloc (27 samples, 0.01%)hello_kafka`alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle (790 samples, 0.41%)hello_kafka`bytes::bytes_mut::BytesMut::reserve_inner (840 samples, 0.43%)hello_kafka`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (1,407 samples, 0.72%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (80 samples, 0.04%)libsystem_malloc.dylib`nanov2_size (42 samples, 0.02%)libsystem_malloc.dylib`default_zone_realloc (20 samples, 0.01%)libsystem_malloc.dylib`nanov2_pointer_size (33 samples, 0.02%)libsystem_malloc.dylib`malloc_zone_realloc (54 samples, 0.03%)hello_kafka`alloc::raw_vec::finish_grow (154 samples, 0.08%)libsystem_malloc.dylib`realloc (97 samples, 0.05%)hello_kafka`alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle (185 samples, 0.10%)hello_kafka`bytes::bytes_mut::BytesMut::reserve_inner (197 samples, 0.10%)hello_kafka`bytes::bytes_mut::BytesMut::resize (245 samples, 0.13%)hello_kafka`crc::crc32::_<impl crc::Crc<u32>>::checksum (5,071 samples, 2.61%)he..hello_kafka`kafka_protocol::records::Record::compute_size_new (49 samples, 0.03%)hello_kafka`__rdl_realloc (22 samples, 0.01%)libsystem_malloc.dylib`nanov2_size (166 samples, 0.09%)libsystem_malloc.dylib`nanov2_pointer_size (102 samples, 0.05%)libsystem_malloc.dylib`_nanov2_free (228 samples, 0.12%)libsystem_platform.dylib`_platform_bzero$VARIANT$Haswell (26 samples, 0.01%)libsystem_malloc.dylib`nanov2_malloc (255 samples, 0.13%)libsystem_malloc.dylib`szone_malloc_should_clear (245 samples, 0.13%)libsystem_malloc.dylib`tiny_malloc_should_clear (231 samples, 0.12%)libsystem_malloc.dylib`tiny_malloc_from_free_list (97 samples, 0.05%)libsystem_malloc.dylib`nanov2_realloc (880 samples, 0.45%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (85 samples, 0.04%)libsystem_malloc.dylib`tiny_free_no_lock (101 samples, 0.05%)libsystem_platform.dylib`_platform_bzero$VARIANT$Haswell (23 samples, 0.01%)libsystem_malloc.dylib`free_tiny (213 samples, 0.11%)libsystem_malloc.dylib`small_free_list_add_ptr (35 samples, 0.02%)libsystem_malloc.dylib`szone_malloc_should_clear (316 samples, 0.16%)libsystem_malloc.dylib`small_malloc_should_clear (300 samples, 0.15%)libsystem_malloc.dylib`small_malloc_from_free_list (165 samples, 0.08%)libsystem_malloc.dylib`small_free_list_remove_ptr_no_clear (39 samples, 0.02%)libsystem_malloc.dylib`szone_size (27 samples, 0.01%)libsystem_malloc.dylib`tiny_size (24 samples, 0.01%)libsystem_malloc.dylib`szone_realloc (630 samples, 0.32%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (22 samples, 0.01%)libsystem_malloc.dylib`malloc_zone_realloc (1,707 samples, 0.88%)libsystem_malloc.dylib`szone_size (46 samples, 0.02%)libsystem_malloc.dylib`tiny_size (39 samples, 0.02%)libsystem_malloc.dylib`realloc (1,847 samples, 0.95%)hello_kafka`alloc::raw_vec::finish_grow (2,062 samples, 1.06%)hello_kafka`alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle (2,128 samples, 1.09%)hello_kafka`bytes::bytes_mut::BytesMut::reserve_inner (2,191 samples, 1.13%)hello_kafka`<bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice (6,541 samples, 3.36%)hel..libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (2,090 samples, 1.07%)hello_kafka`DYLD-STUB$$memcpy (122 samples, 0.06%)hello_kafka`kafka_protocol::records::Record::compute_size_new (581 samples, 0.30%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (255 samples, 0.13%)hello_kafka`kafka_protocol::records::RecordBatchEncoder::encode_new_records (8,960 samples, 4.61%)hello..libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (275 samples, 0.14%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (21 samples, 0.01%)hello_kafka`kafka_protocol::records::RecordBatchEncoder::encode (17,333 samples, 8.91%)hello_kafka`k..hello_kafka`tokio::time::sleep::Sleep::new_timeout (23 samples, 0.01%)hello_kafka`tokio::time::sleep::sleep (27 samples, 0.01%)hello_kafka`<kafkas::executor::TokioExecutor as kafkas::executor::Executor>::delay (36 samples, 0.02%)hello_kafka`tokio::runtime::time::entry::TimerEntry::reset (37 samples, 0.02%)hello_kafka`tokio::runtime::time::_<impl tokio::runtime::time::handle::Handle>::reregister (29 samples, 0.01%)hello_kafka`<tokio::time::sleep::Sleep as core::future::future::Future>::poll (64 samples, 0.03%)hello_kafka`core::ptr::drop_in_place<tokio::time::sleep::Sleep> (24 samples, 0.01%)libsystem_kernel.dylib`__psynch_cvsignal (204 samples, 0.10%)hello_kafka`parking_lot::condvar::Condvar::notify_one_slow (256 samples, 0.13%)hello_kafka`tokio::runtime::driver::Handle::unpark (58 samples, 0.03%)libsystem_kernel.dylib`kevent (58 samples, 0.03%)hello_kafka`tokio::runtime::scheduler::multi_thread::worker::_<impl tokio::runtime::scheduler::multi_thread::handle::Handle>::schedule_local (51 samples, 0.03%)hello_kafka`tokio::runtime::scheduler::multi_thread::worker::_<impl tokio::runtime::scheduler::multi_thread::handle::Handle>::schedule_task::_{{closure}} (401 samples, 0.21%)hello_kafka`tokio::macros::scoped_tls::ScopedKey<T>::with (414 samples, 0.21%)hello_kafka`tokio::runtime::scheduler::multi_thread::worker::_<impl tokio::runtime::task::Schedule for alloc::sync::Arc<tokio::runtime::scheduler::multi_thread::handle::Handle>>::schedule (422 samples, 0.22%)hello_kafka`tokio::runtime::task::waker::wake_by_val (440 samples, 0.23%)hello_kafka`futures_channel::mpsc::UnboundedSender<T>::unbounded_send (521 samples, 0.27%)hello_kafka`<futures_channel::oneshot::Receiver<T> as core::future::future::Future>::poll (31 samples, 0.02%)libsystem_malloc.dylib`free_tiny (32 samples, 0.02%)hello_kafka`futures_util::future::future::FutureExt::poll_unpin (116 samples, 0.06%)hello_kafka`kafkas::connection::ConnectionSender<Exe>::send::_{{closure}} (947 samples, 0.49%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (38 samples, 0.02%)hello_kafka`kafkas::connection_manager::ConnectionManager<Exe>::invoke::_{{closure}} (1,129 samples, 0.58%)libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (24 samples, 0.01%)hello_kafka`dashmap::DashMap<K,V,S>::get (26 samples, 0.01%)hello_kafka`kafkas::metadata::Cluster::drain_node (43 samples, 0.02%)libsystem_malloc.dylib`nanov2_malloc (27 samples, 0.01%)libsystem_malloc.dylib`large_entry_grow_and_insert_no_lock (149 samples, 0.08%)libsystem_kernel.dylib`_kernelrpc_mach_vm_map_trap (1,966 samples, 1.01%)libsystem_malloc.dylib`mvm_allocate_pages (2,039 samples, 1.05%)libsystem_kernel.dylib`mach_vm_map (32 samples, 0.02%)libsystem_malloc.dylib`large_malloc (2,425 samples, 1.25%)hello_kafka`kafkas::producer::batch::ProducerBatch::flush (2,553 samples, 1.31%)libsystem_malloc.dylib`szone_malloc_should_clear (2,478 samples, 1.27%)hello_kafka`<i16 as kafka_protocol::error::ParseResponseErrorCode>::is_ok (40 samples, 0.02%)hello_kafka`DYLD-STUB$$memcpy (27 samples, 0.01%)hello_kafka`futures_channel::oneshot::Sender<T>::send (11,973 samples, 6.15%)hello_ka..libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (904 samples, 0.46%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (87 samples, 0.04%)hello_kafka`kafkas::producer::batch::Thunk::done (12,830 samples, 6.60%)hello_kaf..libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (164 samples, 0.08%)libsystem_malloc.dylib`_malloc_zone_malloc (42 samples, 0.02%)libsystem_malloc.dylib`_nanov2_free (128 samples, 0.07%)libsystem_kernel.dylib`madvise (5,059 samples, 2.60%)li..libsystem_malloc.dylib`large_entry_free_no_lock (150 samples, 0.08%)libsystem_kernel.dylib`_kernelrpc_mach_vm_deallocate_trap (4,590 samples, 2.36%)l..libsystem_malloc.dylib`free_large (5,432 samples, 2.79%)li..libsystem_malloc.dylib`mvm_deallocate_pages (4,750 samples, 2.44%)li..libsystem_kernel.dylib`mach_vm_deallocate (99 samples, 0.05%)libsystem_malloc.dylib`large_entry_for_pointer_no_lock (192 samples, 0.10%)libsystem_malloc.dylib`_szone_free (10,827 samples, 5.57%)libsyst..libsystem_malloc.dylib`free (280 samples, 0.14%)libsystem_malloc.dylib`free_small (31 samples, 0.02%)libsystem_malloc.dylib`tiny_free_no_lock (42 samples, 0.02%)libsystem_malloc.dylib`free_tiny (59 samples, 0.03%)libsystem_malloc.dylib`nanov2_try_free_default (38 samples, 0.02%)hello_kafka`kafkas::producer::Producer<Exe>::send_raw::_{{closure}} (56,468 samples, 29.03%)hello_kafka`kafkas::producer::Producer<Exe>::se..libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (24 samples, 0.01%)hello_kafka`kafkas::producer::batch::Thunk::done (58 samples, 0.03%)libsystem_malloc.dylib`free (110 samples, 0.06%)hello_kafka`kafkas::producer::Producer<Exe>::new::_{{closure}}::_{{closure}} (63,100 samples, 32.44%)hello_kafka`kafkas::producer::Producer<Exe>::new::_{..libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (132 samples, 0.07%)libsystem_malloc.dylib`_nanov2_free (43 samples, 0.02%)libsystem_malloc.dylib`free (239 samples, 0.12%)libsystem_malloc.dylib`nanov2_try_free_default (31 samples, 0.02%)libsystem_platform.dylib`DYLD-STUB$$_platform_memmove (40 samples, 0.02%)hello_kafka`tokio::runtime::task::core::Core<T,S>::poll (98,643 samples, 50.71%)hello_kafka`tokio::runtime::task::core::Core<T,S>::polllibsystem_platform.dylib`_platform_memmove$VARIANT$Haswell (110 samples, 0.06%)hello_kafka`tokio::runtime::task::harness::Harness<T,S>::poll (99,245 samples, 51.02%)hello_kafka`tokio::runtime::task::harness::Harness<T,S>::pollhello_kafka`tokio::runtime::task::state::State::transition_to_running (23 samples, 0.01%)hello_kafka`tokio::runtime::scheduler::multi_thread::worker::Context::run_task (100,197 samples, 51.51%)hello_kafka`tokio::runtime::scheduler::multi_thread::worker::Context::run_taskhello_kafka`tokio::runtime::task::raw::poll (51 samples, 0.03%)hello_kafka`tokio::runtime::scheduler::multi_thread::worker::Context::run (106,183 samples, 54.58%)hello_kafka`tokio::runtime::scheduler::multi_thread::worker::Context::runhello_kafka`tokio::runtime::blocking::pool::Inner::run (106,222 samples, 54.60%)hello_kafka`tokio::runtime::blocking::pool::Inner::runhello_kafka`tokio::runtime::task::harness::Harness<T,S>::poll (106,222 samples, 54.60%)hello_kafka`tokio::runtime::task::harness::Harness<T,S>::pollhello_kafka`tokio::runtime::task::core::Core<T,S>::poll (106,222 samples, 54.60%)hello_kafka`tokio::runtime::task::core::Core<T,S>::pollhello_kafka`tokio::runtime::scheduler::multi_thread::worker::run (106,222 samples, 54.60%)hello_kafka`tokio::runtime::scheduler::multi_thread::worker::runhello_kafka`tokio::macros::scoped_tls::ScopedKey<T>::set (106,222 samples, 54.60%)hello_kafka`tokio::macros::scoped_tls::ScopedKey<T>::sethello_kafka`std::sys::unix::thread::Thread::new::thread_start (106,223 samples, 54.60%)hello_kafka`std::sys::unix::thread::Thread::new::thread_starthello_kafka`core::ops::function::FnOnce::call_once{{vtable.shim}} (106,223 samples, 54.60%)hello_kafka`core::ops::function::FnOnce::call_once{{vtable.shim}}hello_kafka`std::sys_common::backtrace::__rust_begin_short_backtrace (106,223 samples, 54.60%)hello_kafka`std::sys_common::backtrace::__rust_begin_short_backtraceall (194,536 samples, 100%)libsystem_pthread.dylib`thread_start (106,231 samples, 54.61%)libsystem_pthread.dylib`thread_startlibsystem_pthread.dylib`_pthread_start (106,230 samples, 54.61%)libsystem_pthread.dylib`_pthread_start \ No newline at end of file diff --git a/examples/simple_consumer.rs b/examples/simple_consumer.rs index 8362ee3..8747b47 100644 --- a/examples/simple_consumer.rs +++ b/examples/simple_consumer.rs @@ -32,12 +32,14 @@ async fn main() -> Result<(), Box> { pin_mut!(consume_stream); while let Some(records) = consume_stream.next().await { + let partition = records.partition_id(); for record in records { if let Some(value) = record.value { println!( - "{:?} - {}", + "value: {} - offset: {} - partition: {}", String::from_utf8(value.to_vec())?, - record.offset + record.offset, + partition ); } } diff --git a/examples/simple_producer.rs b/examples/simple_producer.rs index 38720b3..305a45d 100644 --- a/examples/simple_producer.rs +++ b/examples/simple_producer.rs @@ -40,7 +40,7 @@ async fn main() -> Result<(), Box> { let record = TestData::new(&format!("hello - kafka {i}")); let ret = producer.send(&topic, record).await?; let _ = tx.send(ret).await; - tokio::time::sleep(Duration::from_millis(100)).await; + // tokio::time::sleep(Duration::from_millis(100)).await; } info!("elapsed: {:?}", now.elapsed()); // wait till all cached records send to kafka diff --git a/src/consumer/fetch_session.rs b/src/consumer/fetch_session.rs index c28f608..40cbe11 100644 --- a/src/consumer/fetch_session.rs +++ b/src/consumer/fetch_session.rs @@ -35,7 +35,7 @@ pub struct FetchSession { pub node: NodeId, pub next_metadata: FetchMetadata, pub session_topic_names: HashMap, - pub session_partitions: HashMap, + pub session_partitions: IndexMap, } impl FetchSession { @@ -44,7 +44,7 @@ impl FetchSession { node, next_metadata: FetchMetadata::new(INVALID_SESSION_ID, INITIAL_EPOCH), session_topic_names: HashMap::new(), - session_partitions: HashMap::new(), + session_partitions: IndexMap::new(), } } @@ -332,10 +332,10 @@ fn next_epoch(prev_epoch: i32) -> i32 { #[derive(Debug)] pub struct FetchRequestData { - pub(crate) to_send: HashMap, + pub(crate) to_send: IndexMap, pub(crate) to_forget: Vec, pub(crate) to_replace: Vec, - pub(crate) session_partitions: HashMap, + pub(crate) session_partitions: IndexMap, pub(crate) metadata: FetchMetadata, pub(crate) can_use_topic_ids: bool, } @@ -402,7 +402,7 @@ impl FetchRequestDataBuilder { session.session_topic_names.extend(self.topic_names.drain()); } - let mut to_send = HashMap::with_capacity(session.session_partitions.len()); + let mut to_send = IndexMap::with_capacity(session.session_partitions.len()); for (tp, data) in session.session_partitions.iter() { to_send.insert(tp.clone(), *data); } @@ -499,7 +499,7 @@ impl FetchRequestDataBuilder { session.session_topic_names.extend(self.topic_names.clone()); } - let mut to_send = HashMap::with_capacity(self.next.len()); + let mut to_send = IndexMap::with_capacity(self.next.len()); to_send.extend(self.next.drain(..)); FetchRequestData { @@ -512,3 +512,742 @@ impl FetchRequestDataBuilder { } } } + +#[cfg(test)] +mod tests { + use std::collections::HashMap; + + use indexmap::IndexMap; + use kafka_protocol::{ + messages::{ + fetch_response::{FetchableTopicResponse, PartitionData}, + FetchRequest, FetchResponse, + }, + protocol::{Message, StrBytes}, + }; + use pretty_assertions::assert_eq; + use uuid::Uuid; + + use crate::{ + consumer::fetch_session::{ + FetchRequestDataBuilder, FetchRequestPartitionData, FetchSession, INITIAL_EPOCH, + INVALID_SESSION_ID, + }, + metadata::TopicIdPartition, + TopicPartition, + }; + + struct ReqEntry { + part: TopicPartition, + data: FetchRequestPartitionData, + } + + impl ReqEntry { + fn new( + topic: StrBytes, + topic_id: Uuid, + partition: i32, + fetch_offset: i64, + log_start_offset: i64, + max_bytes: i32, + ) -> Self { + let tp = TopicPartition { + topic: topic.into(), + partition, + }; + let data = FetchRequestPartitionData { + topic_id, + fetch_offset, + log_start_offset, + max_bytes, + last_fetched_epoch: None, + current_leader_epoch: None, + }; + Self { part: tp, data } + } + } + + struct RespEntry { + part: TopicIdPartition, + data: PartitionData, + } + + impl RespEntry { + fn new( + topic: StrBytes, + partition: i32, + topic_id: Uuid, + high_water_mark: i64, + last_stable_offset: i64, + ) -> Self { + let topic_id_partition = TopicIdPartition { + topic_id, + partition: TopicPartition { + topic: topic.into(), + partition, + }, + }; + + let mut data = PartitionData::default(); + data.partition_index = partition; + data.high_watermark = high_water_mark; + data.last_stable_offset = last_stable_offset; + data.log_start_offset = 0; + + Self { + part: topic_id_partition, + data, + } + } + } + + fn req_map(entries: Vec) -> IndexMap { + let mut map = IndexMap::with_capacity(entries.len()); + for entry in entries { + map.insert(entry.part, entry.data); + } + map + } + + fn resp_map(entries: Vec) -> IndexMap { + let mut map = IndexMap::with_capacity(entries.len()); + for entry in entries { + map.insert(entry.part, entry.data); + } + map + } + + fn matching_topic( + prev_topic: &Option<&mut FetchableTopicResponse>, + cur_topic: &TopicIdPartition, + ) -> bool { + if let Some(prev_topic) = prev_topic { + return if prev_topic.topic_id != Uuid::nil() { + prev_topic.topic_id == cur_topic.topic_id + } else { + prev_topic.topic == cur_topic.partition.topic + }; + } + false + } + + fn to_fetch_response( + error: i16, + throttle_time_ms: i32, + session_id: i32, + map: IndexMap, + ) -> FetchResponse { + let mut topic_responses = Vec::new(); + for (tp, mut data) in map { + // Since PartitionData alone doesn't know the partition ID, we set it here + data.partition_index = tp.partition.partition; + // We have to keep the order of input topic-partition. Hence, we batch the partitions + // only if the last batch is in the same topic group. + + let prev_topic = if topic_responses.is_empty() { + None + } else { + topic_responses.last_mut() + }; + + if matching_topic(&prev_topic, &tp) { + if let Some(prev_topic) = prev_topic { + prev_topic.partitions.push(data); + } + } else { + let mut partition_data = FetchableTopicResponse::default(); + partition_data.topic = tp.partition.topic.clone(); + partition_data.topic_id = tp.topic_id; + partition_data.partitions = vec![data]; + + topic_responses.push(partition_data); + } + } + + let mut response = FetchResponse::default(); + response.throttle_time_ms = throttle_time_ms; + response.error_code = error; + response.session_id = session_id; + response.responses = topic_responses; + + response + } + + fn assert_map_equals( + expected: &IndexMap, + actual: &IndexMap, + ) { + let mut i = 1; + + let mut expected_iter = expected.iter(); + let mut actual_iter = actual.iter(); + + loop { + let expected_entry = expected_iter.next(); + if expected_entry.is_none() { + break; + } + + let actual_entry = actual_iter.next(); + if actual_entry.is_none() { + panic!("Element {} not found.", i); + } + + assert_eq!( + expected_entry.unwrap().0, + actual_entry.unwrap().0, + "Element {} had a different TopicPartition than expected.", + i + ); + assert_eq!( + expected_entry.unwrap().1, + actual_entry.unwrap().1, + "Element {} had a different PartitionData than expected.", + i + ); + + i += 1; + } + + if actual_iter.next().is_some() { + panic!("Unexpected element {} found.", i); + } + } + + fn assert_maps_equals( + expected: &IndexMap, + actuals: Vec<&IndexMap>, + ) { + for actual in actuals.iter() { + assert_map_equals(expected, actual); + } + } + + fn assert_list_equals(expected: &[TopicIdPartition], actual: &[TopicIdPartition]) { + for expected_part in expected.iter() { + if !actual.contains(expected_part) { + panic!("Failed to find expected partition {expected_part:?}"); + } + } + + for actual_part in actual.iter() { + if !expected.contains(actual_part) { + panic!("Found unexpected partition {actual_part:?}"); + } + } + } + + fn add_topic_id( + topic_ids: &mut HashMap, + topic_names: &mut HashMap, + name: StrBytes, + version: i16, + ) { + if version >= 13 { + let uuid = Uuid::from_u128(rand::random::()); + topic_ids.insert(name.clone(), uuid); + topic_names.insert(uuid, name); + } + } + + /// Test the handling of SESSIONLESS responses. + /// Pre-KIP-227 brokers always supply this kind of response. + #[test] + fn test_session_less() { + let mut topic_ids = HashMap::new(); + let mut topic_names = HashMap::new(); + + // We want to test both on older versions that do not use topic IDs and on newer versions + // that do. + let versions = vec![12i16, FetchRequest::VERSIONS.max]; + + for version in versions { + let mut fetch_session = FetchSession::new(1); + let mut fetch_session_builder = FetchRequestDataBuilder::new(); + + add_topic_id( + &mut topic_ids, + &mut topic_names, + StrBytes::from_str("foo"), + version, + ); + let foo_id = match topic_ids.get("foo") { + Some(id) => *id, + None => Uuid::nil(), + }; + + fetch_session_builder.add( + TopicPartition::new("foo", 0), + FetchRequestPartitionData { + topic_id: foo_id, + fetch_offset: 0, + log_start_offset: 100, + max_bytes: 200, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + fetch_session_builder.add( + TopicPartition::new("foo", 1), + FetchRequestPartitionData { + topic_id: foo_id, + fetch_offset: 10, + log_start_offset: 110, + max_bytes: 210, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + + let data = fetch_session_builder.build(&mut fetch_session); + + assert_maps_equals( + &req_map(vec![ + ReqEntry::new(StrBytes::from_str("foo"), foo_id, 0, 0, 100, 200), + ReqEntry::new(StrBytes::from_str("foo"), foo_id, 1, 10, 110, 210), + ]), + vec![&data.to_send, &data.session_partitions], + ); + + assert_eq!(INVALID_SESSION_ID, data.metadata.session_id); + assert_eq!(INITIAL_EPOCH, data.metadata.epoch); + + let resp_map = resp_map(vec![ + RespEntry::new(StrBytes::from_str("foo"), 0, foo_id, 0, 0), + RespEntry::new(StrBytes::from_str("foo"), 1, foo_id, 0, 0), + ]); + let resp = to_fetch_response(0, 0, INVALID_SESSION_ID, resp_map); + + fetch_session.handle_fetch_response(&resp, version); + + let mut fetch_session_builder = FetchRequestDataBuilder::new(); + + fetch_session_builder.add( + TopicPartition::new("foo", 0), + FetchRequestPartitionData { + topic_id: foo_id, + fetch_offset: 0, + log_start_offset: 100, + max_bytes: 200, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + + let data = fetch_session_builder.build(&mut fetch_session); + assert_eq!(INVALID_SESSION_ID, data.metadata.session_id); + assert_eq!(INITIAL_EPOCH, data.metadata.epoch); + + assert_maps_equals( + &req_map(vec![ReqEntry::new( + StrBytes::from_str("foo"), + foo_id, + 0, + 0, + 100, + 200, + )]), + vec![&data.to_send, &data.session_partitions], + ); + } + } + + /// Test handling an incremental fetch session. + #[test] + fn test_incremental() { + let mut topic_ids = HashMap::new(); + let mut topic_names = HashMap::new(); + + // We want to test both on older versions that do not use topic IDs and on newer versions + // that do. + let versions = vec![12i16, FetchRequest::VERSIONS.max]; + + for version in versions { + let mut fetch_session = FetchSession::new(1); + let mut fetch_session_builder = FetchRequestDataBuilder::new(); + + add_topic_id( + &mut topic_ids, + &mut topic_names, + StrBytes::from_str("foo"), + version, + ); + let foo_id = match topic_ids.get("foo") { + Some(id) => *id, + None => Uuid::nil(), + }; + + let foo0 = TopicPartition::new("foo", 0); + let foo1 = TopicPartition::new("foo", 1); + + fetch_session_builder.add( + foo0.clone(), + FetchRequestPartitionData { + topic_id: foo_id, + fetch_offset: 0, + log_start_offset: 100, + max_bytes: 200, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + + fetch_session_builder.add( + foo1.clone(), + FetchRequestPartitionData { + topic_id: foo_id, + fetch_offset: 10, + log_start_offset: 110, + max_bytes: 210, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + + let data = fetch_session_builder.build(&mut fetch_session); + + assert_maps_equals( + &req_map(vec![ + ReqEntry::new(StrBytes::from_str("foo"), foo_id, 0, 0, 100, 200), + ReqEntry::new(StrBytes::from_str("foo"), foo_id, 1, 10, 110, 210), + ]), + vec![&data.to_send, &data.session_partitions], + ); + + assert_eq!(INVALID_SESSION_ID, data.metadata.session_id); + assert_eq!(INITIAL_EPOCH, data.metadata.epoch); + + let resp = to_fetch_response( + 0, + 0, + 123, + resp_map(vec![ + RespEntry::new(StrBytes::from_str("foo"), 0, foo_id, 10, 20), + RespEntry::new(StrBytes::from_str("foo"), 1, foo_id, 10, 20), + ]), + ); + + fetch_session.handle_fetch_response(&resp, version); + + // Test an incremental fetch request which adds one partition and modifies another. + let mut fetch_session_builder = FetchRequestDataBuilder::new(); + add_topic_id( + &mut topic_ids, + &mut topic_names, + StrBytes::from_str("bar"), + version, + ); + let bar_id = match topic_ids.get("bar") { + Some(id) => *id, + None => Uuid::nil(), + }; + + let bar0 = TopicPartition::new("bar", 0); + + fetch_session_builder.add( + foo0.clone(), + FetchRequestPartitionData { + topic_id: foo_id, + fetch_offset: 0, + log_start_offset: 100, + max_bytes: 200, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + + fetch_session_builder.add( + foo1.clone(), + FetchRequestPartitionData { + topic_id: foo_id, + fetch_offset: 10, + log_start_offset: 120, + max_bytes: 210, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + + fetch_session_builder.add( + bar0.clone(), + FetchRequestPartitionData { + topic_id: bar_id, + fetch_offset: 20, + log_start_offset: 200, + max_bytes: 200, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + + let data2 = fetch_session_builder.build(&mut fetch_session); + assert_eq!(data2.metadata.is_full(), false); + + assert_map_equals( + &req_map(vec![ + ReqEntry::new(StrBytes::from_str("foo"), foo_id, 0, 0, 100, 200), + ReqEntry::new(StrBytes::from_str("foo"), foo_id, 1, 10, 120, 210), + ReqEntry::new(StrBytes::from_str("bar"), bar_id, 0, 20, 200, 200), + ]), + &data2.session_partitions, + ); + assert_map_equals( + &req_map(vec![ + ReqEntry::new(StrBytes::from_str("bar"), bar_id, 0, 20, 200, 200), + ReqEntry::new(StrBytes::from_str("foo"), foo_id, 1, 10, 120, 210), + ]), + &data2.to_send, + ); + + let resp = to_fetch_response( + 0, + 0, + 123, + resp_map(vec![RespEntry::new( + StrBytes::from_str("foo"), + 1, + foo_id, + 20, + 20, + )]), + ); + + fetch_session.handle_fetch_response(&resp, version); + + // Skip building a new request. Test that handling an invalid fetch session epoch + // response results in a request which closes the session. + // + // 71 -> ResponseError::InvalidFetchSessionEpoch + let resp = to_fetch_response(71, 0, INVALID_SESSION_ID, resp_map(vec![])); + fetch_session.handle_fetch_response(&resp, version); + + let mut fetch_session_builder = FetchRequestDataBuilder::new(); + + fetch_session_builder.add( + foo0, + FetchRequestPartitionData { + topic_id: foo_id, + fetch_offset: 0, + log_start_offset: 100, + max_bytes: 200, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + + fetch_session_builder.add( + foo1, + FetchRequestPartitionData { + topic_id: foo_id, + fetch_offset: 10, + log_start_offset: 120, + max_bytes: 210, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + + fetch_session_builder.add( + bar0, + FetchRequestPartitionData { + topic_id: bar_id, + fetch_offset: 20, + log_start_offset: 200, + max_bytes: 200, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + + let data4 = fetch_session_builder.build(&mut fetch_session); + assert_eq!(data4.metadata.is_full(), true); + assert_eq!(data2.metadata.session_id, data4.metadata.session_id); + assert_eq!(INITIAL_EPOCH, data4.metadata.epoch); + + assert_maps_equals( + &req_map(vec![ + ReqEntry::new(StrBytes::from_str("foo"), foo_id, 0, 0, 100, 200), + ReqEntry::new(StrBytes::from_str("foo"), foo_id, 1, 10, 120, 210), + ReqEntry::new(StrBytes::from_str("bar"), bar_id, 0, 20, 200, 200), + ]), + vec![&data4.session_partitions, &data4.to_send], + ); + } + } + + #[test] + fn test_incremental_partition_removal() { + let mut topic_ids = HashMap::new(); + let mut topic_names = HashMap::new(); + + // We want to test both on older versions that do not use topic IDs and on newer versions + // that do. + let versions = vec![12i16, FetchRequest::VERSIONS.max]; + + for version in versions { + let mut fetch_session = FetchSession::new(1); + let mut fetch_session_builder = FetchRequestDataBuilder::new(); + + add_topic_id( + &mut topic_ids, + &mut topic_names, + StrBytes::from_str("foo"), + version, + ); + add_topic_id( + &mut topic_ids, + &mut topic_names, + StrBytes::from_str("bar"), + version, + ); + + let foo_id = match topic_ids.get("foo") { + Some(id) => *id, + None => Uuid::nil(), + }; + let bar_id = match topic_ids.get("bar") { + Some(id) => *id, + None => Uuid::nil(), + }; + + let foo0 = TopicPartition::new("foo", 0); + let foo1 = TopicPartition::new("foo", 1); + let bar0 = TopicPartition::new("bar", 0); + + fetch_session_builder.add( + foo0.clone(), + FetchRequestPartitionData { + topic_id: foo_id, + fetch_offset: 0, + log_start_offset: 100, + max_bytes: 200, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + fetch_session_builder.add( + foo1.clone(), + FetchRequestPartitionData { + topic_id: foo_id, + fetch_offset: 10, + log_start_offset: 110, + max_bytes: 210, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + fetch_session_builder.add( + bar0.clone(), + FetchRequestPartitionData { + topic_id: bar_id, + fetch_offset: 20, + log_start_offset: 120, + max_bytes: 220, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + let data = fetch_session_builder.build(&mut fetch_session); + assert_maps_equals( + &req_map(vec![ + ReqEntry::new(StrBytes::from_str("foo"), foo_id, 0, 0, 100, 200), + ReqEntry::new(StrBytes::from_str("foo"), foo_id, 1, 10, 110, 210), + ReqEntry::new(StrBytes::from_str("bar"), bar_id, 0, 20, 120, 220), + ]), + vec![&data.to_send, &data.session_partitions], + ); + assert_eq!(data.metadata.is_full(), true); + + let resp = to_fetch_response( + 0, + 0, + 123, + resp_map(vec![ + RespEntry::new(StrBytes::from_str("foo"), 0, foo_id, 10, 20), + RespEntry::new(StrBytes::from_str("foo"), 1, foo_id, 10, 20), + RespEntry::new(StrBytes::from_str("bar"), 0, bar_id, 10, 20), + ]), + ); + + fetch_session.handle_fetch_response(&resp, version); + + // Test an incremental fetch request which removes two partitions. + let mut fetch_session_builder = FetchRequestDataBuilder::new(); + fetch_session_builder.add( + foo1.clone(), + FetchRequestPartitionData { + topic_id: foo_id, + fetch_offset: 10, + log_start_offset: 110, + max_bytes: 210, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + let data = fetch_session_builder.build(&mut fetch_session); + assert_eq!(data.metadata.is_full(), false); + assert_eq!(123, data.metadata.session_id); + assert_eq!(1, data.metadata.epoch); + assert_map_equals( + &req_map(vec![ReqEntry::new( + StrBytes::from_str("foo"), + foo_id, + 1, + 10, + 110, + 210, + )]), + &data.session_partitions, + ); + assert_map_equals(&req_map(vec![]), &data.to_send); + + let expected_to_forget2 = vec![ + TopicIdPartition { + topic_id: foo_id, + partition: foo0.clone(), + }, + TopicIdPartition { + topic_id: bar_id, + partition: bar0.clone(), + }, + ]; + assert_list_equals(&expected_to_forget2, &data.to_forget); + + // A FETCH_SESSION_ID_NOT_FOUND response triggers us to close the session. + // The next request is a session establishing FULL request. + // + // 70 -> ResponseError::FetchSessionIdNotFound + let resp = to_fetch_response(70, 0, INVALID_SESSION_ID, resp_map(vec![])); + + fetch_session.handle_fetch_response(&resp, version); + + let mut fetch_session_builder = FetchRequestDataBuilder::new(); + fetch_session_builder.add( + foo0.clone(), + FetchRequestPartitionData { + topic_id: foo_id, + fetch_offset: 0, + log_start_offset: 100, + max_bytes: 200, + current_leader_epoch: None, + last_fetched_epoch: None, + }, + ); + let data = fetch_session_builder.build(&mut fetch_session); + assert_eq!(data.metadata.is_full(), true); + assert_eq!(INVALID_SESSION_ID, data.metadata.session_id); + assert_eq!(INITIAL_EPOCH, data.metadata.epoch); + assert_maps_equals( + &req_map(vec![ReqEntry::new( + StrBytes::from_str("foo"), + foo_id, + 0, + 0, + 100, + 200, + )]), + vec![&data.session_partitions, &data.to_send], + ); + } + } +} diff --git a/src/consumer/fetcher.rs b/src/consumer/fetcher.rs index 9b847d4..97161d8 100644 --- a/src/consumer/fetcher.rs +++ b/src/consumer/fetcher.rs @@ -1,11 +1,14 @@ use std::{ collections::{HashMap, HashSet}, - sync::Arc, + sync::{ + atomic::{AtomicBool, Ordering}, + Arc, + }, vec::Drain, }; use dashmap::{DashMap, DashSet}; -use futures::channel::{mpsc, mpsc::UnboundedSender, oneshot}; +use futures::channel::{mpsc, oneshot}; use kafka_protocol::{ error::ParseResponseErrorCode, messages::{ @@ -41,18 +44,19 @@ pub struct Fetcher { pub client: Kafka, timestamp: i64, options: Arc, - event_tx: UnboundedSender, + pub event_tx: mpsc::UnboundedSender, sessions: Arc>, completed_fetches_tx: mpsc::UnboundedSender, pub completed_partitions: Arc>, nodes_with_pending_fetch_requests: HashSet, + paused: Arc, } impl Fetcher { pub fn new( client: Kafka, timestamp: i64, - event_tx: UnboundedSender, + event_tx: mpsc::UnboundedSender, options: Arc, completed_fetches_tx: mpsc::UnboundedSender, ) -> Self { @@ -70,9 +74,22 @@ impl Fetcher { completed_partitions: Arc::new(DashSet::with_capacity(100)), options, nodes_with_pending_fetch_requests: HashSet::new(), + paused: Arc::new(AtomicBool::new(true)), } } + pub(crate) fn pause(&self) { + self.paused.store(true, Ordering::Release); + } + + pub(crate) fn is_paused(&self) -> bool { + self.paused.load(Ordering::Acquire) + } + + pub(crate) fn resume(&self) { + self.paused.store(false, Ordering::Release); + } + pub async fn fetch(&mut self) -> Result<()> { match self.client.version_range(ApiKey::FetchKey) { Some(version_range) => { @@ -176,8 +193,8 @@ impl Fetcher { } None => { error!( - "Unable to find FetchSessionHandler for node {}. Ignoring \ - fetch response.", + "Unable to find FetchSession for node {}. Ignoring fetch \ + response.", node.key() ); continue; @@ -206,24 +223,37 @@ impl Fetcher { exclude, partitions_tx: tx, })?; - Ok(rx.await?) + match rx.await { + Ok(partitions) => Ok(partitions), + Err(err) => { + error!("Failed to get fetchable partitions, error: Canceled"); + Err(err.into()) + } + } } async fn validate_position_on_metadata_change(&self) -> Result<()> { let (tx, rx) = oneshot::channel(); self.event_tx .unbounded_send(CoordinatorEvent::Assignments { partitions_tx: tx })?; - for tp in rx.await? { - let current_leader = self.client.cluster_meta.current_leader(&tp); - self.event_tx.unbounded_send( - CoordinatorEvent::MaybeValidatePositionForCurrentLeader { - partition: tp, - current_leader, - }, - )?; + match rx.await { + Ok(partitions) => { + for tp in partitions { + let current_leader = self.client.cluster_meta.current_leader(&tp); + self.event_tx.unbounded_send( + CoordinatorEvent::MaybeValidatePositionForCurrentLeader { + partition: tp, + current_leader, + }, + )?; + } + Ok(()) + } + Err(err) => { + error!("Failed to validate position on metadata change, error: Canceled"); + Err(err.into()) + } } - - Ok(()) } async fn fetch_position(&self, partition: TopicPartition) -> Result> { @@ -233,7 +263,13 @@ impl Fetcher { partition, position_tx: tx, })?; - Ok(rx.await?) + match rx.await { + Ok(position) => Ok(position), + Err(err) => { + error!("Failed to get fetch position, error: Canceled"); + Err(err.into()) + } + } } async fn prepare_fetch_requests(&self) -> Result> { @@ -314,7 +350,13 @@ impl Fetcher { partition, timestamp_tx: tx, })?; - Ok(rx.await?) + match rx.await { + Ok(timestamp) => Ok(timestamp), + Err(err) => { + error!("Failed to get strategy timestamp, error: Canceled"); + Err(err.into()) + } + } } async fn partitions_need_reset(&self, timestamp: i64) -> Result> { @@ -324,7 +366,13 @@ impl Fetcher { timestamp, partition_tx: tx, })?; - Ok(rx.await?) + match rx.await { + Ok(partitions) => Ok(partitions), + Err(err) => { + error!("Failed to partitions which need reset, error: Canceled"); + Err(err.into()) + } + } } pub(crate) async fn reset_offset(&mut self) -> Result<()> { @@ -612,7 +660,7 @@ impl Fetcher { request.forgotten_topics_data = map_to_list(forgotten_topics); let mut topics: HashMap = HashMap::new(); - for (tp, data) in data.to_send.drain() { + for (tp, data) in data.to_send.drain(..) { let mut partition = FetchPartition::default(); partition.partition = tp.partition; partition.current_leader_epoch = data diff --git a/src/consumer/mod.rs b/src/consumer/mod.rs index f2dd37a..c5e2cad 100644 --- a/src/consumer/mod.rs +++ b/src/consumer/mod.rs @@ -1,9 +1,11 @@ mod fetch_session; mod fetcher; +pub use fetcher::Fetcher; + pub(crate) mod partition_assignor; pub(crate) mod subscription_state; -use std::{sync::Arc, time::Duration}; +use std::{collections::VecDeque, sync::Arc, time::Duration}; use async_stream::stream; use bytes::Bytes; @@ -27,14 +29,11 @@ use tracing::{debug, error, info, warn}; use crate::{ client::{DeserializeMessage, Kafka}, - consumer::{ - fetcher::{CompletedFetch, Fetcher}, - subscription_state::FetchPosition, - }, + consumer::{fetcher::CompletedFetch, subscription_state::FetchPosition}, coordinator::{ConsumerCoordinator, CoordinatorEvent}, executor::Executor, metadata::TopicPartition, - NodeId, PartitionId, Result, ToStrBytes, DEFAULT_GENERATION_ID, + Error, NodeId, PartitionId, Result, ToStrBytes, DEFAULT_GENERATION_ID, }; /// High-level consumer record. @@ -65,7 +64,7 @@ impl DeserializeMessage for ConsumerRecord { #[derive(Debug, Clone, PartialEq, Eq)] pub struct ConsumerRecords { partition: TopicPartition, - records: Vec, + records: VecDeque, } impl ConsumerRecords { @@ -73,7 +72,7 @@ impl ConsumerRecords { self.partition.topic() } - pub fn partition(&self) -> PartitionId { + pub fn partition_id(&self) -> PartitionId { self.partition.partition() } } @@ -82,7 +81,7 @@ impl Iterator for ConsumerRecords { type Item = T; fn next(&mut self) -> Option { - self.records.pop() + self.records.pop_back() } } @@ -245,7 +244,7 @@ pub struct Consumer { fetcher: Fetcher, options: Arc, notify_shutdown: broadcast::Sender<()>, - fetches_rx: Option>, + completed_fetches_rx: Option>, } impl Consumer { @@ -253,27 +252,34 @@ impl Consumer { let options = Arc::new(options); let (notify_shutdown, _) = broadcast::channel(1); - let coordinator = - ConsumerCoordinator::new(client.clone(), options.clone(), notify_shutdown.clone()) - .await?; + let (event_tx, event_rx) = mpsc::unbounded(); - let (tx, rx) = mpsc::unbounded(); + let (completed_fetches_tx, completed_fetches_rx) = mpsc::unbounded(); let fetcher = Fetcher::new( client.clone(), Local::now().timestamp(), - coordinator.event_sender(), + event_tx, options.clone(), - tx, + completed_fetches_tx, ); + let coordinator = ConsumerCoordinator::new( + client.clone(), + options.clone(), + fetcher.clone(), + event_rx, + notify_shutdown.clone(), + ) + .await?; + Ok(Self { client, coordinator, fetcher, options, notify_shutdown, - fetches_rx: Some(rx), + completed_fetches_rx: Some(completed_fetches_rx), }) } @@ -325,7 +331,7 @@ impl Consumer { self.client.clone(), self.options.clone(), self.coordinator.event_sender(), - self.fetches_rx.take().unwrap(), + self.completed_fetches_rx.take().unwrap(), self.fetcher.completed_partitions.clone(), reset_offset_tx, self.notify_shutdown.subscribe(), @@ -352,13 +358,29 @@ impl Drop for Consumer { } } -async fn do_fetch(mut fetcher: Fetcher, mut rx: broadcast::Receiver<()>) { +async fn do_fetch( + mut fetcher: Fetcher, + mut notify_shutdown: broadcast::Receiver<()>, +) { let mut interval = fetcher.client.executor.interval(Duration::from_millis(100)); + while interval.next().await.is_some() { + let shutdown = notify_shutdown.recv(); + pin_mut!(shutdown); + + if fetcher.is_paused() { + // Pause fetch thread if coordinator is rebalancing. + let delay_fut = fetcher.client.executor.delay(Duration::from_millis(1000)); + pin_mut!(delay_fut); + + match select(delay_fut, shutdown).await { + Either::Left(_) => continue, + Either::Right(_) => break, + } + } + let fetcher_fut = fetcher.fetch(); - let shutdown = rx.recv(); pin_mut!(fetcher_fut); - pin_mut!(shutdown); match select(fetcher_fut, shutdown).await { Either::Left((Err(err), _)) => { @@ -385,39 +407,49 @@ where T: DeserializeMessage + Sized, { stream! { - while let Some(completed_fetch) = completed_fetches_rx.next().await { - let records_fut = handle_partition_response( - &client, - &mut reset_offset_tx, - completed_fetch, - &options, - &mut event_tx, - &completed_partitions, - ); + loop { + let next_fut = completed_fetches_rx.next(); let shutdown = shutdown_rx.recv(); - pin_mut!(records_fut); + pin_mut!(next_fut); pin_mut!(shutdown); - match select(records_fut, shutdown).await { - Either::Left((Ok(Some((tp, raw_records))), _)) => { - let mut records = Vec::with_capacity(raw_records.len()); - for record in raw_records { - records.push(T::deserialize_message(record)); + match select(next_fut, shutdown).await { + Either::Left((completed_fetch, _)) => { + if let Some(completed_fetch) = completed_fetch { + match handle_partition_response( + &client, + &mut reset_offset_tx, + completed_fetch, + &options, + &mut event_tx, + &completed_partitions, + ).await { + Ok(response) => { + if let Some((tp, raw_records)) = response { + let mut records = VecDeque::with_capacity(raw_records.len()); + for record in raw_records { + records.push_front(T::deserialize_message(record)); + } + yield ConsumerRecords { + partition: tp, + records + }; + } + } + Err(err) => { + error!("Fetch error: {}", err); + } + } } - yield ConsumerRecords { - partition: tp, - records - }; } - Either::Left((Ok(None), _)) => {}, - Either::Left((Err(err), _)) => error!("Fetch error: {}", err), Either::Right(_) => { info!("Fetch task is shutting down"); break } } } + info!("Fetch task is shutting down"); } } @@ -536,7 +568,11 @@ async fn handle_partition_response( data: partition, notify: tx, })?; - rx.await?; + if rx.await.is_err() { + return Err(Error::Custom( + "Failed to await records, error: Canceled".into(), + )); + } completed_partitions.remove(&completed_fetch.partition); return Ok(Some((completed_fetch.partition, records))); } @@ -547,7 +583,6 @@ async fn handle_partition_response( data: partition, notify: tx, })?; - rx.await?; } } } diff --git a/src/coordinator/consumer.rs b/src/coordinator/consumer.rs index feafea6..3a69fda 100644 --- a/src/coordinator/consumer.rs +++ b/src/coordinator/consumer.rs @@ -5,7 +5,7 @@ use std::{ }; use futures::{ - channel::mpsc::{unbounded, UnboundedReceiver, UnboundedSender}, + channel::mpsc, future::{select, Either}, pin_mut, SinkExt, StreamExt, }; @@ -42,7 +42,7 @@ use crate::{ subscription_state::{ OffsetMetadata, SubscriptionState, SubscriptionType, TopicPartitionState, }, - ConsumerGroupMetadata, ConsumerOptions, + ConsumerGroupMetadata, ConsumerOptions, Fetcher, }, coordinator::{find_coordinator, CoordinatorEvent, CoordinatorType}, error::{ConsumeError, Result}, @@ -66,7 +66,7 @@ macro_rules! offset_fetch_block { partition_state.position.offset = partition.committed_offset; partition_state.position.offset_epoch = Some(partition.committed_leader_epoch); - debug!( + info!( "Fetch {tp} offset success, offset: {}", partition.committed_offset ); @@ -145,9 +145,9 @@ pub struct ConsumerCoordinator { client: Kafka, inner: Option>, inner_handle: Option>>, - event_tx: UnboundedSender, + event_tx: mpsc::UnboundedSender, options: Arc, - commit_offset_tx: Option>, + commit_offset_tx: Option>, notify_shutdown: broadcast::Sender<()>, } @@ -155,11 +155,14 @@ impl ConsumerCoordinator { pub async fn new( client: Kafka, options: Arc, + fetcher: Fetcher, + event_rx: mpsc::UnboundedReceiver, notify: broadcast::Sender<()>, ) -> Result> { - let (event_tx, event_rx) = unbounded(); + let event_tx = fetcher.event_tx.clone(); - let inner = CoordinatorInner::new(client.clone(), options.clone(), event_rx).await?; + let inner = + CoordinatorInner::new(client.clone(), options.clone(), fetcher, event_rx).await?; let handle = client.executor.spawn(Box::pin(coordinator_loop(inner))); Ok(Self { @@ -173,7 +176,7 @@ impl ConsumerCoordinator { }) } - pub fn event_sender(&self) -> UnboundedSender { + pub fn event_sender(&self) -> mpsc::UnboundedSender { self.event_tx.clone() } @@ -211,6 +214,17 @@ impl ConsumerCoordinator { Ok(()) } + pub async fn pause(&self) -> Result<()> { + self.event_tx.unbounded_send(CoordinatorEvent::PauseFetch)?; + Ok(()) + } + + pub async fn resume(&self) -> Result<()> { + self.event_tx + .unbounded_send(CoordinatorEvent::ResumeFetch)?; + Ok(()) + } + pub async fn commit_async(&mut self) -> Result<()> { if let Some(ref mut tx) = self.commit_offset_tx { tx.send(()).await?; @@ -241,6 +255,9 @@ impl ConsumerCoordinator { "Heartbeat task is started, which group is [{}].", self.options.group_id ); + + // Start the fetch thread. + self.resume().await?; Ok(()) } @@ -258,7 +275,7 @@ impl ConsumerCoordinator { impl ConsumerCoordinator { async fn async_commit_offset(&mut self) -> Result<()> { - let (commit_offset_tx, mut commit_offset_rx) = unbounded(); + let (commit_offset_tx, mut commit_offset_rx) = mpsc::unbounded(); self.commit_offset_tx = Some(commit_offset_tx); let mut shutdown = self.notify_shutdown.subscribe(); @@ -292,7 +309,8 @@ impl ConsumerCoordinator { struct CoordinatorInner { client: Kafka, node: Node, - event_rx: UnboundedReceiver, + fetcher: Fetcher, + event_rx: mpsc::UnboundedReceiver, pub group_meta: ConsumerGroupMetadata, group_subscription: GroupSubscription, consumer_options: Arc, @@ -305,7 +323,8 @@ impl CoordinatorInner { pub async fn new( client: Kafka, options: Arc, - event_rx: UnboundedReceiver, + fetcher: Fetcher, + event_rx: mpsc::UnboundedReceiver, ) -> Result> { let group_id = options.group_id.clone().to_str_bytes(); @@ -327,6 +346,7 @@ impl CoordinatorInner { Ok(Self { client, node, + fetcher, event_rx, subscriptions: SubscriptionState::default(), group_meta: ConsumerGroupMetadata::new(group_id.into()), @@ -346,9 +366,16 @@ impl CoordinatorInner { } async fn rejoin_group(&mut self) -> Result<()> { + self.fetcher.pause(); + self.join_group().await?; self.sync_group().await?; - self.offset_fetch().await + self.offset_fetch().await?; + + // resume fetch thread. + self.fetcher.resume(); + + Ok(()) } fn reset_state(&mut self, should_reset_member_id: bool) { @@ -632,10 +659,15 @@ impl CoordinatorInner { Err(error.into()) } Some(error @ ResponseError::RebalanceInProgress) => { + // since we may be sending the request during rebalance, we should check + // this case and ignore the REBALANCE_IN_PROGRESS error + warn!( + "Group [{}] is rebalance in progress.", + self.group_meta.group_id.0 + ); if matches!(self.state, MemberState::Stable) { - warn!("Request joining group due to: group is already rebalancing"); self.rejoin_group().await?; - Err(error.into()) + Ok(()) } else { debug!( "Ignoring heartbeat response with error {error} during {:?} state", @@ -947,6 +979,14 @@ async fn coordinator_loop( CoordinatorEvent::SyncGroup => coordinator.sync_group().await, CoordinatorEvent::LeaveGroup(reason) => coordinator.maybe_leave_group(reason).await, CoordinatorEvent::OffsetFetch => coordinator.offset_fetch().await, + CoordinatorEvent::PauseFetch => { + coordinator.fetcher.pause(); + Ok(()) + } + CoordinatorEvent::ResumeFetch => { + coordinator.fetcher.resume(); + Ok(()) + } CoordinatorEvent::OffsetCommit => coordinator.offset_commit().await, CoordinatorEvent::SeekOffset { partition, offset } => { let _ = coordinator @@ -993,8 +1033,8 @@ async fn coordinator_loop( if data.high_watermark >= 0 { tp_state.high_water_mark = data.high_watermark; } - let _ = notify.send(()); } + let _ = notify.send(()); Ok(()) } CoordinatorEvent::FetchablePartitions { @@ -1084,7 +1124,7 @@ async fn coordinator_loop( CoordinatorEvent::Shutdown => break, }; if let Err(err) = ret { - error!("CoordinatorEvent handled error: {err}"); + error!("{err}"); } } coordinator diff --git a/src/coordinator/mod.rs b/src/coordinator/mod.rs index d93f74d..14e6ef2 100644 --- a/src/coordinator/mod.rs +++ b/src/coordinator/mod.rs @@ -42,6 +42,8 @@ pub enum CoordinatorEvent { SyncGroup, LeaveGroup(StrBytes), OffsetFetch, + PauseFetch, + ResumeFetch, OffsetCommit, ResetOffset { partition: TopicPartition, diff --git a/src/error.rs b/src/error.rs index d4bc943..8bad68b 100644 --- a/src/error.rs +++ b/src/error.rs @@ -24,6 +24,7 @@ pub type Result = std::result::Result; #[derive(Debug)] pub enum Error { Custom(String), + KafkaError(ResponseError), Connection(ConnectionError), InvalidVersion(i16), InvalidApiRequest(ApiKey), @@ -55,7 +56,7 @@ impl From<()> for Error { impl From for Error { fn from(value: ResponseError) -> Self { - Error::Custom(value.to_string()) + Error::KafkaError(value) } } @@ -133,6 +134,7 @@ impl std::fmt::Display for Error { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { Error::Custom(e) => write!(f, "{e}"), + Error::KafkaError(e) => write!(f, "{e}"), Error::Connection(e) => write!(f, "{e}"), Error::InvalidVersion(v) => write!(f, "Invalid version: {v}"), Error::InvalidApiRequest(v) => write!(f, "Invalid Api Request: {v:?}"), diff --git a/src/executor/mod.rs b/src/executor/mod.rs index fc8da4d..08aa52c 100644 --- a/src/executor/mod.rs +++ b/src/executor/mod.rs @@ -340,7 +340,11 @@ mod tests { let executor = AsyncStdExecutor; let (_tx, rx) = futures::channel::oneshot::channel::(); // let _ = tx.send(1); - if (executor.timeout(Duration::from_millis(1), rx).await).is_err() { + if executor + .timeout(Duration::from_millis(1), rx) + .await + .is_err() + { println!("did not receive value within 1 ms"); } } diff --git a/src/lib.rs b/src/lib.rs index b17f503..4bfb662 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -94,7 +94,9 @@ fn array_display>(array: I) -> String { for item in array { display.extend(format!("{item}, ").chars()); } - display.remove(display.len() - 1); - display.remove(display.len() - 1); + if display.len() >= 2 { + display.remove(display.len() - 1); + display.remove(display.len() - 1); + } display }