diff --git a/code/bngblaster/src/bbl_config.c b/code/bngblaster/src/bbl_config.c index b0b0a45c..d05e1678 100644 --- a/code/bngblaster/src/bbl_config.c +++ b/code/bngblaster/src/bbl_config.c @@ -3343,7 +3343,8 @@ json_parse_config(json_t *root) const char *schema[] = { "autostart", "stop-verified", "max-burst", - "stream-rate-calculation" + "stream-rate-calculation", + "stream-delay-calculation" }; if(!schema_validate(section, "traffic", schema, sizeof(schema)/sizeof(schema[0]))) { @@ -3366,6 +3367,10 @@ json_parse_config(json_t *root) if(value) { g_ctx->config.stream_rate_calc = json_boolean_value(value); } + JSON_OBJ_GET_BOOL(section, value, "traffic", "stream-delay-calculation"); + if(value) { + g_ctx->config.stream_delay_calc = json_boolean_value(value); + } } /* Session Traffic Configuration */ diff --git a/code/bngblaster/src/bbl_ctx.h b/code/bngblaster/src/bbl_ctx.h index 2cc88e16..0dd7ca4f 100644 --- a/code/bngblaster/src/bbl_ctx.h +++ b/code/bngblaster/src/bbl_ctx.h @@ -338,6 +338,8 @@ typedef struct bbl_ctx_ bool traffic_autostart; bool traffic_stop_verified; bool stream_rate_calc; /* Enable/disable stream rate calculation */ + bool stream_delay_calc; /* Enable/disable stream delay calculation */ + uint8_t stream_max_burst; /* Limit the max packets per TX interval */ /* Session Traffic */ diff --git a/code/bngblaster/src/bbl_stream.c b/code/bngblaster/src/bbl_stream.c index 531b736c..ae1ed004 100644 --- a/code/bngblaster/src/bbl_stream.c +++ b/code/bngblaster/src/bbl_stream.c @@ -2296,7 +2296,9 @@ bbl_stream_rx(bbl_ethernet_header_s *eth, bbl_session_s *session) stream->rx_packets++; stream->rx_last_seq = bbl->flow_seq; stream->rx_last_epoch = eth->timestamp.tv_sec; - bbl_stream_delay(stream, ð->timestamp, &bbl->timestamp); + if(g_ctx->config.stream_delay_calc) { + bbl_stream_delay(stream, ð->timestamp, &bbl->timestamp); + } return stream; } else { return NULL; diff --git a/docsrc/sources/configuration/traffic.rst b/docsrc/sources/configuration/traffic.rst index bbff066c..6fb263e6 100644 --- a/docsrc/sources/configuration/traffic.rst +++ b/docsrc/sources/configuration/traffic.rst @@ -2,21 +2,27 @@ { "traffic": {} } -+-----------------------------+--------------------------------------------------------+ -| Attribute | Description | -+=============================+========================================================+ -| **autostart** | | Automatically start traffic. | -| | | Default: true | -+-----------------------------+--------------------------------------------------------+ -| **stop-verified** | | Automatically stop traffic streams if verified. | -| | | Default: false | -+-----------------------------+--------------------------------------------------------+ -| **max-burst** | | Stream flow burst size in packets. | -| | | Default: 16 | -+-----------------------------+--------------------------------------------------------+ -| **stream-rate-calculation** | | Enable stream rate calculation. | -| | | This option should be set to false if massive | -| | | streams (e.g. more than 1M) are defined but | -| | | per-stream live rate statistics are not required. | -| | | Default: true | -+-----------------------------+--------------------------------------------------------+ \ No newline at end of file ++------------------------------+--------------------------------------------------------+ +| Attribute | Description | ++==============================+========================================================+ +| **autostart** | | Automatically start traffic. | +| | | Default: true | ++------------------------------+--------------------------------------------------------+ +| **stop-verified** | | Automatically stop traffic streams if verified. | +| | | Default: false | ++------------------------------+--------------------------------------------------------+ +| **max-burst** | | Stream flow burst size in packets. | +| | | Default: 16 | ++------------------------------+--------------------------------------------------------+ +| **stream-rate-calculation** | | Enable stream rate calculation. | +| | | This option should be set to false if massive | +| | | streams (e.g. more than 1M) are defined but | +| | | per-stream live rate statistics are not required. | +| | | Default: true | ++------------------------------+--------------------------------------------------------+ +| **stream-delay-calculation** | | Enable stream delay calculation. | +| | | This option should be set to false if massive | +| | | streams (e.g. more than 1M) are defined but | +| | | per-stream delay measurements are not required. | +| | | Default: true | ++------------------------------+--------------------------------------------------------+ \ No newline at end of file diff --git a/docsrc/sources/nat.rst b/docsrc/sources/nat.rst index 51ff3ae5..ce7a2f67 100644 --- a/docsrc/sources/nat.rst +++ b/docsrc/sources/nat.rst @@ -363,6 +363,12 @@ which is typically not needed for millions of streams. All traffic stats are still working but the live rate is not calculated. +It is also possible to disable the stream delay calcualtion if not needed. + +.. code-block:: json + + { "traffic": { "stream-delay-calculation": false } } + Another option is to setup the traffic streams with a rate of 0.1 PPS, meaning one packet every 10 seconds. This is enough to keep NAT translation active but allows 1M streams with only 100K PPS.