Skip to content

Commit

Permalink
feat(eval/latencies): inspect prose-filter without presidio
Browse files Browse the repository at this point in the history
We want to inspect the behaviour of prose-filter that sleeps 20ms
instead of calling real presidio server. The change was introduced in
8ec667a.

We also do not want to attack presidio during this test. So this commit
also reverts e0f8c28 and
7619edb.
  • Loading branch information
qlonik committed Jan 1, 2025
1 parent fa28a79 commit 7cd9534
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ apiVersion: v1
kind: Service
metadata:
name: presidio
annotations:
metallb.universe.tf/loadBalancerIPs: "${METALLB_PRESIDIO}"
spec:
selector:
app: presidio
type: LoadBalancer
externalTrafficPolicy: Local
type: ClusterIP
ports:
- port: 3000
targetPort: http
Expand Down
1 change: 0 additions & 1 deletion evaluation/kubernetes/flux/vars/cluster-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ data:
METALLB_INGRESS_ADDR: "192.168.49.21"
METALLB_JAEGER_QUERY: "192.168.49.22"
METALLB_OTEL_COLLECTOR: "192.168.49.23"
METALLB_PRESIDIO: "192.168.49.24"

# TODO: replace to real secret domain
SECRET_DOMAIN: "my-example.com"
109 changes: 19 additions & 90 deletions evaluation/scripts/collect-latencies.mts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,23 @@ const warmup_duration = "10s" satisfies DURATION
const warmup_rate = "100" satisfies RATE

const duration = "10s" satisfies DURATION
const rates = new Set(["60"]) satisfies Iterable<RATE>
const rates = new Set([
"1000",
"800",
"600",
"400",
"200",
"180",
"160",
"140",
"120",
warmup_rate,
"80",
"60",
"40",
"20",
"10",
]) satisfies Iterable<RATE>

const bookinfo_variants = new Set([
"plain",
Expand All @@ -37,9 +53,9 @@ const bookinfo_variants = new Set([
* than one rate value. That is because with one variant, there is some weird
* behavior where each second attack fails for most of the requests.
*/
const test_only = new Set<VARIANT>(["prose-filter"])
const test_only = new Set<VARIANT>(["istio", "prose-filter"])

const TEST_RUNS = 1
const TEST_RUNS = 10

const INGRESS_IP = "192.168.49.21"

Expand Down Expand Up @@ -203,54 +219,13 @@ function generate_metadata({
warmupsFileSuffix: ".warmups.json.zst",
resultsFileSuffix: ".results.json.zst",
summaryFileSuffix: ".summary.json",
presidioWarmupsFileSuffix: ".presidio.warmups.json.zst",
presidioResultsFileSuffix: ".presidio.results.json.zst",
presidioSummaryFileSuffix: ".presidio.summary.json",
req: {
method: "GET",
url: "https://" + INGRESS_IP + "/productpage?u=test",
header: {
Host: [workload_name + ".my-example.com"],
},
},
presidioReqTemplate: {
method: "POST",
url: "http://192.168.49.24:3000/batchanalyze",
header: {
"Content-Type": ["application/json"],
},
},
presidioReqBodies: [
{
"ISBN-10": "1234567890",
"ISBN-13": "123-1234567890",
author: "William Shakespeare",
id: 0,
language: "English",
pages: 200,
publisher: "PublisherA",
type: "paperback",
year: 1595,
},
{
clustername: "null",
id: "0",
podname: "reviews-v3-77d94bd94b-jffmj",
reviews: [
{
rating: { color: "red", stars: 5 },
reviewer: "Reviewer1",
text: "An extremely entertaining play by Shakespeare. The slapstick humour is refreshing!",
},
{
rating: { color: "red", stars: 4 },
reviewer: "Reviewer2",
text: "Absolutely fun and entertaining. The play lacks thematic depth when compared to other plays by Shakespeare.",
},
],
},
{ id: 0, ratings: { Reviewer1: 5, Reviewer2: 4 } },
],
warmupOptions: {
duration: warmup_duration,
rate: warmup_rate,
Expand Down Expand Up @@ -325,29 +300,6 @@ async function run_test(
`${test_run_index}${metadata.summaryFileSuffix}`,
)
const presidio_data = metadata.presidioReqBodies.map((data, i) => ({
warmups_file: path.join(
test_results_dir,
`${test_run_index}.req_${i}${metadata.presidioWarmupsFileSuffix}`,
),
results_file: path.join(
test_results_dir,
`${test_run_index}.req_${i}${metadata.presidioResultsFileSuffix}`,
),
summary_file: path.join(
test_results_dir,
`${test_run_index}.req_${i}${metadata.presidioSummaryFileSuffix}`,
),
req: {
...metadata.presidioReqTemplate,
body: Buffer.from(
JSON.stringify({
json_to_analyze: data,
}),
).toString("base64"),
},
}))
if (metadata.testMode === "vegeta") {
echo` - Warm-up '${metadata.workloadInfo.variant}' variant`
await Promise.all([
Expand All @@ -357,14 +309,6 @@ async function run_test(
| vegeta encode --to json \
| zstd -c -T0 --ultra -20 - >${warmups_file}
`,
...presidio_data.map(
({ warmups_file, req }) => $`
echo ${JSON.stringify(req)} \
| vegeta attack ${vegeta_attack_params(metadata.warmupOptions)} \
| vegeta encode --to json \
| zstd -c -T0 --ultra -20 - >${warmups_file}
`,
),
])
echo` - Testing '${metadata.workloadInfo.variant}' variant`
Expand All @@ -375,14 +319,6 @@ async function run_test(
| vegeta encode --to json \
| zstd -c -T0 --ultra -20 - >${results_file}
`,
...presidio_data.map(
({ results_file, req }) => $`
echo ${JSON.stringify(req)} \
| vegeta attack ${vegeta_attack_params(metadata.testOptions)} \
| vegeta encode --to json \
| zstd -c -T0 --ultra -20 - >${results_file}
`,
),
])
} else if (metadata.testMode === "serial") {
const fetch_params = [
Expand Down Expand Up @@ -458,13 +394,6 @@ async function run_test(
| vegeta report -type json \
| jq -M >${summary_file}
`,
...presidio_data.map(
({ results_file, summary_file }) => $`
zstd -c -d ${results_file} \
| vegeta report -type json \
| jq -M >${summary_file}
`,
),
])
echo` - Scaling down deployments for '${metadata.workloadInfo.variant}' variant`
Expand Down

0 comments on commit 7cd9534

Please sign in to comment.