Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[O11y][AWS] Rally benchmark aws.vpcflow #9242

Merged
merged 10 commits into from
Mar 25, 2024

Conversation

ali786XI
Copy link
Contributor

@ali786XI ali786XI commented Feb 26, 2024

Proposed commit message

  • This PR adds benchmarking templates to the vpcflow data stream of AWS

Sample Response

sample_event.json
{
"agent": {
  "name": "aws-scale-123456",
  "id": "de42127b-4db8-4471-824e-a7b14f478663",
  "ephemeral_id": "22ed892c-43bd-408a-9121-65e2f5b6a56e",
  "type": "filebeat",
  "version": "8.8.0"
},
"benchmark_metadata": {
  "info": {
    "run_id": "bdb49b49-8b44-4088-8c8c-ccb37a9f62a6",
    "benchmark": "vpcflow-benchmark"
  }
},
"log": {
  "file": {
    "path": "https://elastic-package-aws-bucket-63461.s3.us-east-1.amazonaws.com/extra-samples.log"
  },
  "offset": 338
},
"elastic_agent": {
  "id": "de42127b-4db8-4471-824e-a7b14f478663",
  "version": "8.8.0",
  "snapshot": false
},
"destination": {
  "address": "176.195.180.251",
  "port": 33232,
  "ip": "176.195.180.251"
},
"source": {
  "address": "79.27.140.59",
  "port": 52081,
  "bytes": 335,
  "ip": "79.27.140.59",
  "packets": 90
},
"tags": [
  "preserve_original_event",
  "forwarded",
  "aws-vpcflow"
],
"network": {
  "community_id": "1:yIcWQWM3N3+OxH8joWOdJgiZusE=",
  "bytes": 335,
  "transport": "tcp",
  "type": "ipv4",
  "iana_number": "6",
  "packets": 90,
  "direction": "ingress"
},
"cloud": {
  "availability_zone": "us-east-1e",
  "instance": {
    "id": "i-101502913101502913"
  },
  "provider": "aws",
  "region": "ap-northeast-1",
  "account": {
    "id": "295670701461"
  }
},
"input": {
  "type": "aws-s3"
},
"@timestamp": "2024-02-26T13:09:57.000Z",
"ecs": {
  "version": "8.0.0"
},
"related": {
  "ip": [
    "79.27.140.59",
    "176.195.180.251"
  ]
},
"data_stream": {
  "namespace": "ep",
  "type": "logs",
  "dataset": "aws.vpcflow"
},
"aws": {
  "s3": {
    "bucket": {
      "name": "goat-bone-kicker-zirconviper-10150",
      "arn": "arn:aws:s3:::goat-bone-kicker-zirconviper-10150"
    },
    "object": {
      "key": "extra-samples.log"
    }
  },
  "vpcflow": {
    "vpc_id": "vpc-flameservant101502913",
    "pkt_srcaddr": "249.157.214.239",
    "pkt_src_service": "AMAZON_APPFLOW",
    "type": "IPv4",
    "traffic_path": "1",
    "tcp_flags": "1",
    "action": "ACCEPT",
    "pkt_dstaddr": "33.66.229.152",
    "tcp_flags_array": [
      "fin"
    ],
    "version": "2",
    "instance_id": "i-101502913101502913",
    "account_id": "295670701461",
    "log_status": "SKIPDATA",
    "pkt_dst_service": "DYNAMODB",
    "interface_id": "bear-thunderpython",
    "subnet_id": "subnet-copperspirit101502913",
    "sublocation": {
      "id": "gingerleopard",
      "type": "wavelength"
    }
  }
},
"event": {
  "agent_id_status": "auth_metadata_missing",
  "ingested": "2024-02-26T13:20:00Z",
  "original": "2 295670701461 bear-thunderpython 79.27.140.59 176.195.180.251 52081 33232 6 90 335 1708949997 1708952997 ACCEPT SKIPDATA vpc-flameservant101502913 subnet-copperspirit101502913 i-101502913101502913 1 IPv4 249.157.214.239 33.66.229.152 ap-northeast-1 us-east-1e wavelength gingerleopard AMAZON_APPFLOW DYNAMODB ingress 1",
  "kind": "event",
  "start": "2024-02-26T12:19:57.000Z",
  "end": "2024-02-26T13:09:57.000Z",
  "type": [
    "connection"
  ],
  "category": [
    "network"
  ],
  "dataset": "aws.vpcflow",
  "outcome": "success"
}
}
}

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.

How to test this PR locally

Run this command from package root

  • elastic-package benchmark rally --benchmark vpcflow-benchmark -v
  • elastic-package benchmark stream --benchmark vpcflow-benchmark -v

Related issues

Screenshots

--- Benchmark results for package: aws - START ---
╭────────────────────────────────────────────────────────────────────────────────────╮
│ info                                                                               │
├────────────────────────┬───────────────────────────────────────────────────────────┤
│ benchmark              │                                         vpcflow-benchmark │
│ description            │               Benchmark 20000 aws.vpcflow events ingested │
│ run ID                 │                      d71f0220-00aa-4974-b0ae-c2a9f00491c7 │
│ package                │                                                       aws │
│ start ts (s)           │                                                1709532240 │
│ end ts (s)             │                                                1709532279 │
│ duration               │                                                       39s │
│ generated corpora file │ /root/.elastic-package/tmp/rally_corpus/corpus-3851383405 │
╰────────────────────────┴───────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────╮
│ parameters                                                            │
├─────────────────────────────────┬─────────────────────────────────────┤
│ package version                 │                              2.12.0 │
│ data_stream.name                │                             vpcflow │
│ corpora.generator.total_events  │                               20000 │
│ corpora.generator.template.path │ ./vpcflow-benchmark/template.ndjson │
│ corpora.generator.template.raw  │                                     │
│ corpora.generator.template.type │                              gotext │
│ corpora.generator.config.path   │      ./vpcflow-benchmark/config.yml │
│ corpora.generator.config.raw    │                               map[] │
│ corpora.generator.fields.path   │      ./vpcflow-benchmark/fields.yml │
│ corpora.generator.fields.raw    │                               map[] │
╰─────────────────────────────────┴─────────────────────────────────────╯
╭───────────╮
│ cluster i │
│ nfo       │
├───────┬───┤
│ name  │   │
│ nodes │ 0 │
╰───────┴───╯
╭───────────────────────────────────────╮
│ disk usage for index .ds-logs-aws.vpc │
│ flow-ep-2024.03.04-000001 (for all fi │
│ elds)                                 │
├──────────────────────────────┬────────┤
│ total                        │ 236 kB │
│ inverted_index.total         │ 112 kB │
│ inverted_index.stored_fields │  62 kB │
│ inverted_index.doc_values    │  40 kB │
│ inverted_index.points        │  21 kB │
│ inverted_index.norms         │    0 B │
│ inverted_index.term_vectors  │    0 B │
│ inverted_index.knn_vectors   │    0 B │
╰──────────────────────────────┴────────╯
╭───────────────────────────────────────╮
│ disk usage for index .ds-logs-aws.vpc │
│ flow-ep-2024.03.04-000002 (for all fi │
│ elds)                                 │
├──────────────────────────────┬────────┤
│ total                        │  11 MB │
│ inverted_index.total         │ 2.8 MB │
│ inverted_index.stored_fields │ 4.2 MB │
│ inverted_index.doc_values    │ 3.4 MB │
│ inverted_index.points        │ 618 kB │
│ inverted_index.norms         │    0 B │
│ inverted_index.term_vectors  │    0 B │
│ inverted_index.knn_vectors   │    0 B │
╰──────────────────────────────┴────────╯
╭──────────────────────────────────────────────────────────────────────────────╮
│ pipeline logs-aws.vpcflow-2.12.0 stats in node N5QTPNvAQ32YHxSsMJYzIA        │
├────────────────────────────────────┬─────────────────────────────────────────┤
│ Totals                             │ Count: 20000 | Failed: 0 | Time: 1.443s │
│ set ()                             │   Count: 20000 | Failed: 0 | Time: 12ms │
│ dot_expander ()                    │   Count: 20000 | Failed: 0 | Time: 47ms │
│ rename ()                          │         Count: 0 | Failed: 0 | Time: 0s │
│ remove ()                          │    Count: 20000 | Failed: 0 | Time: 4ms │
│ set ()                             │   Count: 20000 | Failed: 0 | Time: 10ms │
│ set ()                             │    Count: 20000 | Failed: 0 | Time: 8ms │
│ drop ()                            │         Count: 0 | Failed: 0 | Time: 0s │
│ dissect ()                         │   Count: 20000 | Failed: 0 | Time: 34ms │
│ script ()                          │   Count: 20000 | Failed: 0 | Time: 35ms │
│ dissect ()                         │  Count: 13314 | Failed: 0 | Time: 118ms │
│ dissect ()                         │         Count: 0 | Failed: 0 | Time: 0s │
│ dissect ()                         │         Count: 0 | Failed: 0 | Time: 0s │
│ dissect ()                         │         Count: 0 | Failed: 0 | Time: 0s │
│ dissect ()                         │   Count: 6686 | Failed: 0 | Time: 157ms │
│ date ()                            │   Count: 20000 | Failed: 0 | Time: 33ms │
│ date ()                            │   Count: 20000 | Failed: 0 | Time: 27ms │
│ date ()                            │   Count: 20000 | Failed: 0 | Time: 25ms │
│ remove ()                          │   Count: 20000 | Failed: 0 | Time: 78ms │
│ script ()                          │   Count: 20000 | Failed: 0 | Time: 54ms │
│ set ()                             │     Count: 3360 | Failed: 0 | Time: 2ms │
│ set ()                             │     Count: 3326 | Failed: 0 | Time: 1ms │
│ rename ()                          │   Count: 20000 | Failed: 0 | Time: 17ms │
│ set ()                             │     Count: 6686 | Failed: 0 | Time: 6ms │
│ convert ()                         │   Count: 20000 | Failed: 0 | Time: 16ms │
│ rename ()                          │   Count: 20000 | Failed: 0 | Time: 15ms │
│ set ()                             │     Count: 6686 | Failed: 0 | Time: 6ms │
│ convert ()                         │   Count: 20000 | Failed: 0 | Time: 15ms │
│ rename ()                          │   Count: 20000 | Failed: 0 | Time: 17ms │
│ convert ()                         │   Count: 20000 | Failed: 0 | Time: 14ms │
│ convert ()                         │   Count: 20000 | Failed: 0 | Time: 14ms │
│ set ()                             │     Count: 6686 | Failed: 0 | Time: 5ms │
│ set ()                             │     Count: 6686 | Failed: 0 | Time: 5ms │
│ set ()                             │     Count: 6686 | Failed: 0 | Time: 3ms │
│ set ()                             │         Count: 0 | Failed: 0 | Time: 0s │
│ script ()                          │     Count: 6686 | Failed: 0 | Time: 5ms │
│ community_id ()                    │   Count: 20000 | Failed: 0 | Time: 69ms │
│ geoip ()                           │   Count: 20000 | Failed: 0 | Time: 25ms │
│ geoip ()                           │   Count: 20000 | Failed: 0 | Time: 17ms │
│ geoip ()                           │   Count: 20000 | Failed: 0 | Time: 22ms │
│ geoip ()                           │   Count: 20000 | Failed: 0 | Time: 20ms │
│ rename ()                          │    Count: 20000 | Failed: 0 | Time: 9ms │
│ rename ()                          │    Count: 20000 | Failed: 0 | Time: 7ms │
│ rename ()                          │    Count: 20000 | Failed: 0 | Time: 7ms │
│ rename ()                          │    Count: 20000 | Failed: 0 | Time: 7ms │
│ append ()                          │    Count: 6686 | Failed: 0 | Time: 38ms │
│ set ()                             │   Count: 20000 | Failed: 0 | Time: 10ms │
│ set ()                             │   Count: 20000 | Failed: 0 | Time: 57ms │
│ set ()                             │    Count: 6686 | Failed: 0 | Time: 19ms │
│ set ()                             │    Count: 20000 | Failed: 0 | Time: 8ms │
│ script ()                          │     Count: 6686 | Failed: 0 | Time: 7ms │
│ remove ()                          │   Count: 20000 | Failed: 0 | Time: 59ms │
│ remove ()                          │         Count: 0 | Failed: 0 | Time: 0s │
│ pipeline (global@custom)           │    Count: 20000 | Failed: 0 | Time: 1ms │
│ pipeline (logs@custom)             │    Count: 20000 | Failed: 0 | Time: 1ms │
│ pipeline (logs-aws@custom)         │    Count: 20000 | Failed: 0 | Time: 1ms │
│ pipeline (logs-aws.vpcflow@custom) │    Count: 20000 | Failed: 0 | Time: 2ms │
╰────────────────────────────────────┴─────────────────────────────────────────╯
╭─────────────────────────────────────────────────────────────────────────────────────────────╮
│ rally stats                                                                                 │
├────────────────────────────────────────────────────────────────┬────────────────────────────┤
│ Cumulative indexing time of primary shards                     │     1.7990333333333333 min │
│ Min cumulative indexing time across primary shards             │                      0 min │
│ Median cumulative indexing time across primary shards          │ 0.00014166666666666668 min │
│ Max cumulative indexing time across primary shards             │    0.47568333333333335 min │
│ Cumulative indexing throttle time of primary shards            │                      0 min │
│ Min cumulative indexing throttle time across primary shards    │                      0 min │
│ Median cumulative indexing throttle time across primary shards │                    0.0 min │
│ Max cumulative indexing throttle time across primary shards    │                      0 min │
│ Cumulative merge time of primary shards                        │     1.7083833333333334 min │
│ Cumulative merge count of primary shards                       │                       1583 │
│ Min cumulative merge time across primary shards                │                      0 min │
│ Median cumulative merge time across primary shards             │                    0.0 min │
│ Max cumulative merge time across primary shards                │     0.8139500000000001 min │
│ Cumulative merge throttle time of primary shards               │                      0 min │
│ Min cumulative merge throttle time across primary shards       │                      0 min │
│ Median cumulative merge throttle time across primary shards    │                    0.0 min │
│ Max cumulative merge throttle time across primary shards       │                      0 min │
│ Cumulative refresh time of primary shards                      │      4.292633333333333 min │
│ Cumulative refresh count of primary shards                     │                      67812 │
│ Min cumulative refresh time across primary shards              │                      0 min │
│ Median cumulative refresh time across primary shards           │               0.000625 min │
│ Max cumulative refresh time across primary shards              │     1.8293833333333334 min │
│ Cumulative flush time of primary shards                        │      50.79828333333333 min │
│ Cumulative flush count of primary shards                       │                      48728 │
│ Min cumulative flush time across primary shards                │                      0 min │
│ Median cumulative flush time across primary shards             │                2.5e-05 min │
│ Max cumulative flush time across primary shards                │                14.2907 min │
│ Total Young Gen GC time                                        │                    0.057 s │
│ Total Young Gen GC count                                       │                          4 │
│ Total Old Gen GC time                                          │                        0 s │
│ Total Old Gen GC count                                         │                          0 │
│ Store size                                                     │     0.09890961647033691 GB │
│ Translog size                                                  │     0.03353921044617891 GB │
│ Heap used for segments                                         │                       0 MB │
│ Heap used for doc values                                       │                       0 MB │
│ Heap used for terms                                            │                       0 MB │
│ Heap used for norms                                            │                       0 MB │
│ Heap used for points                                           │                       0 MB │
│ Heap used for stored fields                                    │                       0 MB │
│ Segment count                                                  │                        139 │
│ Total Ingest Pipeline count                                    │                      20003 │
│ Total Ingest Pipeline time                                     │                    2.299 s │
│ Total Ingest Pipeline failed                                   │                          0 │
│ Min Throughput                                                 │             3220.37 docs/s │
│ Mean Throughput                                                │             3609.90 docs/s │
│ Median Throughput                                              │             3696.73 docs/s │
│ Max Throughput                                                 │             3781.77 docs/s │
│ 50th percentile latency                                        │      120.43126742355525 ms │
│ 90th percentile latency                                        │      134.57710440270606 ms │
│ 100th percentile latency                                       │      190.20798336714506 ms │
│ 50th percentile service time                                   │      120.43126742355525 ms │
│ 90th percentile service time                                   │      134.57710440270606 ms │
│ 100th percentile service time                                  │      190.20798336714506 ms │
│ error rate                                                     │                     0.00 % │
╰────────────────────────────────────────────────────────────────┴────────────────────────────╯

--- Benchmark results for package: aws - END   ---
Done

@elasticmachine
Copy link

elasticmachine commented Feb 26, 2024

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@ali786XI ali786XI marked this pull request as ready for review February 26, 2024 14:36
@ali786XI ali786XI requested review from a team as code owners February 26, 2024 14:36
},
"log": {
"file": {
"path": "https://elastic-package-aws-bucket-63461.s3.us-east-1.amazonaws.com/extra-samples.log"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

"name": "{{ $aws_s3_bucket_arn }}-{{ div $long_num 10000 }}"
},
"object": {
"key": "extra-samples.log"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's more likely that the s3 object changes, rather than the bucket

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. I have kept some ranges which will limit the generation of bucket names. Also generated the object values.

Copy link
Contributor

@aspacca aspacca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please. see my comments

@ali786XI ali786XI requested a review from aspacca February 27, 2024 10:25
{{- $network_direction := generate "network_direction" }}
{{- $duration_start := generate "duration_start" }}
{{- $duration_end := generate "duration_end" }}
{{- $aws_vpcflow_start := generate "timestamp" | date_modify (print $duration_start) }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beware calling generate multiple times on the same field.
for example here you have timestamp that's period: -24h. you could expect to have 20000 timestamp evenly distributed across 24 hours, but since you are calling generate for it 3 times in the template you end up with 60000 (20000 x 3). they will evenly distributed across 24 hours, each 3 of them sequentially will belong to the same document.

in general, every generate call will apply the generation logic of a new value.

btw, I remember having worked on a vpcflow template before: it was for schema-A (data coming from logs source, ie: the effective vpcflow logs files), rather than for schema-B (data sent from Agent as generated by the integration, ie: what you have here).

https://github.com/elastic/elastic-integration-corpus-generator-tool/tree/main/assets/templates/aws.vpcflow/schema-a

You can still reuse most of the thing and merge what you have added here that's not covered

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look at elastic/elastic-package#984 (comment) for Data Schemas (schema-A, schema-B, etc)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for example here you have timestamp that's period: -24h. you could expect to have 20000 timestamp evenly distributed across 24 hours, but since you are calling generate for it 3 times in the template you end up with 60000 (20000 x 3). they will evenly distributed across 24 hours, each 3 of them sequentially will belong to the same document.

Updated to reuse the timestamp

@jsoriano
Copy link
Member

/test benchmark fullreport

@ali786XI
Copy link
Contributor Author

ali786XI commented Mar 4, 2024

/test

@elasticmachine
Copy link

💚 Build Succeeded

History

cc @aliabbas-elastic

Copy link

Quality Gate passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No Coverage information No data about Coverage
No Duplication information No data about Duplication

See analysis details on SonarQube

@ali786XI ali786XI merged commit d3e707b into elastic:main Mar 25, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Integration:aws AWS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants