Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/topic/awelzel/few-more-microbenc…
Browse files Browse the repository at this point in the history
…hmarks'

* origin/topic/awelzel/few-more-microbenchmarks:
  microbenchmarks: Add record-ops/connection-create
  Update README.md / Makefile
  microbenchmarks: Add table-ops/create.zeek
  • Loading branch information
awelzel committed Dec 16, 2023
2 parents 987b98b + ff583eb commit 5904f53
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ci-based/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@ down:
.PHONY:
tail-logs:
docker-compose logs --follow --tail=100

.PHONY:
prepare-local-testing: zeek-benchmarker-zeek-runner
mkdir -p ./persistent
mkdir -p ./testing/builds
for v in test_data broker_test_data zeek_install_data app_spool_data ; do \
mkdir -p $$(pwd)/testing/volumes/$${v} ; \
docker volume create --driver local --opt type=none --opt device=$$(pwd)/testing/volumes/$${v} --opt o=bind $${v} ; \
done
3 changes: 3 additions & 0 deletions ci-based/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ It uses Docker for privilege separation when running the benchmark scripts.
- zeek_install_data (volume): A volume holding the Zeek installation
- app_spool_data (volume): Volume holding data while working on jobs.

As a shortcut, run ``make prepare-local-testing``. This will setup the
volumes pointing into ``./testing/volumes/<volume name>``.

2. Create the necessary container images by running the following.

sudo docker-compose build
Expand Down
13 changes: 13 additions & 0 deletions ci-based/config-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ ZEEK_TESTS:
bench_command: /benchmarker/scripts/tiny-benchmark.sh
bench_args: -D test-all-policy microbenchmarks/misc/zeek-version.zeek

- id: micro-record-ops-connection-create
bench_command: /benchmarker/scripts/tiny-benchmark.sh
bench_args: -D -b microbenchmarks/record-ops/connection-create.zeek

# Same as above, but not bare and load test-all-policy, too.
- id: micro-record-ops-connection-create-all-policy
bench_command: /benchmarker/scripts/tiny-benchmark.sh
bench_args: -D test-all-policy microbenchmarks/record-ops/connection-create.zeek

- id: micro-vector-ops-simple-value
bench_command: /benchmarker/scripts/tiny-benchmark.sh
bench_args: -D -b microbenchmarks/vector-ops/simple-value.zeek
Expand All @@ -58,6 +67,10 @@ ZEEK_TESTS:
bench_command: /benchmarker/scripts/tiny-benchmark.sh
bench_args: -D -b microbenchmarks/vector-ops/complex-value.zeek

- id: micro-table-ops-create
bench_command: /benchmarker/scripts/tiny-benchmark.sh
bench_args: -D -b microbenchmarks/table-ops/create.zeek

- id: micro-table-ops-simple-key-value
bench_command: /benchmarker/scripts/tiny-benchmark.sh
bench_args: -D -b microbenchmarks/table-ops/simple-key-value.zeek
Expand Down
32 changes: 32 additions & 0 deletions ci-based/scripts/microbenchmarks/record-ops/connection-create.zeek
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
global n = 5000000;

global ts = double_to_time(42.0);
global history = "ShADafF";
global uid = "C23890741";

event zeek_init()
{
local i = 0;
local s = 0;
while ( i < n )
{
local c: connection = connection(
$start_time=ts,
$duration=1sec,
$history=history,
$uid=uid,
);
c$orig = endpoint($size=i, $state=TCP_CLOSED, $flow_label=0);
c$resp = endpoint($size=i*2, $state=TCP_CLOSED, $flow_label=0);
c$tunnel = vector();

s += c$orig$size;
s += c$resp$size;
s += |c$service|;
s += |c$tunnel|;

++i;
}

print i, s;
}
19 changes: 19 additions & 0 deletions ci-based/scripts/microbenchmarks/table-ops/create.zeek
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
global tbl: table[count] of count;
global tbl_nested: table[count, count] of table[count] of count;
global n = 5000000;

event zeek_init()
{
local i = 0;
local s = 0;
while ( i < n )
{
tbl = table([i] = i);
tbl_nested = table([i, i] = table([i] = i));
tbl_nested[s, s] = table([s] = s);
s += (|tbl| + |tbl_nested|);
++i;
}

print i, s;
}

0 comments on commit 5904f53

Please sign in to comment.