Skip to content

Commit

Permalink
Standarize existing sizes from 1024 to 1000 bytes (#276)
Browse files Browse the repository at this point in the history
Co-authored-by: Hubert Gruszecki <[email protected]>
  • Loading branch information
spetz and hubcio authored Nov 9, 2023
1 parent 99c1a9c commit 5a81b47
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions bench/src/benchmark_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ impl BenchmarkResults {
.as_secs_f64()
* 1000.0;
let average_throughput =
total_size_bytes as f64 / total_duration / 1024.0 / 1024.0 / self.results.len() as f64;
let total_throughput = total_size_bytes as f64 / total_duration / 1024.0 / 1024.0;
total_size_bytes as f64 / total_duration / 1e6 / self.results.len() as f64;
let total_throughput = total_size_bytes as f64 / total_duration / 1e6;
let messages_per_second = total_messages as f64 / total_duration;

BenchmarkStatistics {
Expand Down
2 changes: 1 addition & 1 deletion bench/src/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl Consumer {
let end_timestamp = Instant::now();
let duration = end_timestamp - start_timestamp;
let average_latency: Duration = latencies.iter().sum::<Duration>() / latencies.len() as u32;
let average_throughput = total_size_bytes as f64 / duration.as_secs_f64() / 1024.0 / 1024.0;
let average_throughput = total_size_bytes as f64 / duration.as_secs_f64() / 1e6;

info!(
"Consumer #{} → polled {} messages ({} batches of {} messages in {} ms, total size: {} bytes, average latency: {:.2} ms, average throughput: {:.2} MB/s",
Expand Down
2 changes: 1 addition & 1 deletion bench/src/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl Producer {
let duration = end_timestamp - start_timestamp;
let average_latency: Duration = latencies.iter().sum::<Duration>() / latencies.len() as u32;
let total_size_bytes = total_messages * self.message_size as u64;
let average_throughput = total_size_bytes as f64 / duration.as_secs_f64() / 1024.0 / 1024.0;
let average_throughput = total_size_bytes as f64 / duration.as_secs_f64() / 1e6;

info!(
"Producer #{} → sent {} messages in {} batches of {} messages in {:.2} s, total size: {} bytes, average latency: {:.2} ms, average throughput: {:.2} MB/s",
Expand Down
4 changes: 2 additions & 2 deletions iggy/src/messages/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub mod poll_messages;
pub mod send_messages;

const MAX_HEADERS_SIZE: u32 = 100 * 1024;
const MAX_PAYLOAD_SIZE: u32 = 10 * 1024 * 1024;
const MAX_HEADERS_SIZE: u32 = 100 * 1000;
const MAX_PAYLOAD_SIZE: u32 = 10 * 1000 * 1000;
2 changes: 1 addition & 1 deletion iggy/src/quic/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl Default for QuicClientConfig {
server_name: "localhost".to_string(),
reconnection_retries: 3,
reconnection_interval: 1000,
response_buffer_size: 1024 * 1024 * 10,
response_buffer_size: 1000 * 1000 * 10,
max_concurrent_bidi_streams: 10000,
datagram_send_buffer_size: 100_000,
initial_mtu: 1200,
Expand Down
2 changes: 1 addition & 1 deletion server/src/configs/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ impl Default for PartitionConfig {
impl Default for SegmentConfig {
fn default() -> SegmentConfig {
SegmentConfig {
size_bytes: 1024 * 1024 * 1024,
size_bytes: 1000 * 1000 * 1000,
cache_indexes: true,
cache_time_indexes: true,
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/quic/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async fn handle_connection(
Ok(stream) => stream,
};

let request = stream.1.read_to_end(10 * 1024 * 1024).await;
let request = stream.1.read_to_end(10 * 1000 * 1000).await;
if request.is_err() {
error!("Error when reading the QUIC request: {:?}", request.err());
continue;
Expand Down
2 changes: 1 addition & 1 deletion server/src/streaming/segments/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::sync::Arc;
pub const LOG_EXTENSION: &str = "log";
pub const INDEX_EXTENSION: &str = "index";
pub const TIME_INDEX_EXTENSION: &str = "timeindex";
pub const MAX_SIZE_BYTES: u32 = 1024 * 1024 * 1024;
pub const MAX_SIZE_BYTES: u32 = 1000 * 1000 * 1000;

#[derive(Debug)]
pub struct Segment {
Expand Down
2 changes: 1 addition & 1 deletion server/src/streaming/segments/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use tracing::{error, info};
const EMPTY_INDEXES: Vec<Index> = vec![];
const EMPTY_TIME_INDEXES: Vec<TimeIndex> = vec![];
const INDEX_SIZE: u32 = 4;
const BUF_READER_CAPACITY_BYTES: usize = 512 * 1024;
const BUF_READER_CAPACITY_BYTES: usize = 512 * 1000;

#[derive(Debug)]
pub struct FileSegmentStorage {
Expand Down

0 comments on commit 5a81b47

Please sign in to comment.