1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
use enum_map::Enum;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
/// Configuration for generating Nexmark input data.
///
/// This connector must be used exactly three times in a pipeline if it is used
/// at all, once for each [`NexmarkTable`].
#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, ToSchema)]
pub struct NexmarkInputConfig {
/// Which table is this?
///
/// Each table must appear in one connector.
pub table: NexmarkTable,
/// Overall behavior of the three linked input connectors.
///
/// This may be specified only on one of the connectors and applies to all
/// them as a whole.
#[serde(default)]
pub options: Option<NexmarkInputOptions>,
}
/// Table in Nexmark.
#[derive(Debug, Copy, Clone, Eq, PartialEq, Deserialize, Serialize, ToSchema, Enum)]
#[serde(rename_all = "snake_case")]
pub enum NexmarkTable {
/// 92% of the events.
Bid,
/// 6% of the events.
Auction,
/// 2% of the events.
Person,
}
/// Configuration for generating Nexmark input data.
#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, ToSchema)]
#[serde(default)]
pub struct NexmarkInputOptions {
/// Number of events to generate.
pub events: u64,
/// Number of event generator threads.
///
/// It's reasonable to choose the same number of generator threads as worker
/// threads.
pub threads: usize,
/// Number of events to generate and submit together, per thread.
///
/// Each thread generates this many records, which are then combined with
/// the records generated by the other threads, to form combined input
/// batches of size `threads × batch_size_per_thread`.
pub batch_size_per_thread: u64,
/// Maximum number of events to submit in a single step, per thread.
///
/// This should really be per worker thread, not per generator thread, but
/// the connector does not know how many worker threads there are.
///
/// This stands in for `max_batch_size` from the connector configuration
/// because it must be a constant across all three of the nexmark tables.
pub max_step_size_per_thread: u64,
}
impl Default for NexmarkInputOptions {
fn default() -> Self {
Self {
events: 100_000_000,
threads: 4,
batch_size_per_thread: 1_000,
max_step_size_per_thread: 10_000,
}
}
}