diff --git a/src/rust/lqos_bus/src/bus/unix_socket_server.rs b/src/rust/lqos_bus/src/bus/unix_socket_server.rs index 8a1137f9..e209f67b 100644 --- a/src/rust/lqos_bus/src/bus/unix_socket_server.rs +++ b/src/rust/lqos_bus/src/bus/unix_socket_server.rs @@ -12,7 +12,7 @@ use tokio::{ use super::BUS_SOCKET_DIRECTORY; -const READ_BUFFER_SIZE: usize = 2048000; +const READ_BUFFER_SIZE: usize = 20_480; /// Implements a Tokio-friendly server using Unix Sockets and the bus protocol. /// Requests are handled and then forwarded to the handler. diff --git a/src/rust/lqos_python/src/lib.rs b/src/rust/lqos_python/src/lib.rs index a38ccfd0..c90ba177 100644 --- a/src/rust/lqos_python/src/lib.rs +++ b/src/rust/lqos_python/src/lib.rs @@ -178,11 +178,15 @@ impl BatchedCommands { } pub fn submit(&mut self) -> PyResult { + const MAX_BATH_SIZE: usize = 512; // We're draining the request list out, which is a move that // *should* be elided by the optimizing compiler. let len = self.batch.len(); - let batch: Vec = self.batch.drain(0..).collect(); - run_query(batch).unwrap(); + while !self.batch.is_empty() { + let batch_size = usize::min(MAX_BATH_SIZE, self.batch.len()); + let batch: Vec = self.batch.drain(0..batch_size).collect(); + run_query(batch).unwrap(); + } Ok(len) } }