mirror of
https://github.com/rtbrick/bngblaster.git
synced 2024-05-06 15:54:57 +00:00
add stream-delay-calculation config
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 |
|
||||
+-----------------------------+--------------------------------------------------------+
|
||||
+------------------------------+--------------------------------------------------------+
|
||||
| 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 |
|
||||
+------------------------------+--------------------------------------------------------+
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user