danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 1 | /* |
| 2 | * ============LICENSE_START======================================================= |
| 3 | * Copyright (C) 2024 Nordix Foundation |
| 4 | * ================================================================================ |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | * |
| 17 | * SPDX-License-Identifier: Apache-2.0 |
| 18 | * ============LICENSE_END========================================================= |
| 19 | */ |
| 20 | |
| 21 | import { check } from 'k6'; |
danielhanrahan | 78894db | 2024-08-16 13:56:14 +0100 | [diff] [blame] | 22 | import { Trend } from 'k6/metrics'; |
danielhanrahan | a1cdf73 | 2024-08-16 11:09:25 +0100 | [diff] [blame] | 23 | import { Reader } from 'k6/x/kafka'; |
halil.cakal | 65b870b | 2024-07-25 11:12:29 +0100 | [diff] [blame] | 24 | import { |
| 25 | TOTAL_CM_HANDLES, READ_DATA_FOR_CM_HANDLE_DELAY_MS, WRITE_DATA_FOR_CM_HANDLE_DELAY_MS, |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 26 | makeCustomSummaryReport, makeBatchOfCmHandleIds, LEGACY_BATCH_THROUGHPUT_TEST_BATCH_SIZE, |
| 27 | LEGACY_BATCH_TOPIC_NAME, KAFKA_BOOTSTRAP_SERVERS, REGISTRATION_BATCH_SIZE, |
| 28 | LEGACY_BATCH_THROUGHPUT_TEST_NUMBER_OF_REQUESTS |
halil.cakal | 65b870b | 2024-07-25 11:12:29 +0100 | [diff] [blame] | 29 | } from './common/utils.js'; |
danielhanrahan | f2e1e25 | 2024-08-25 21:35:19 +0100 | [diff] [blame] | 30 | import { createCmHandles, deleteCmHandles, waitForAllCmHandlesToBeReady } from './common/cmhandle-crud.js'; |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 31 | import { executeCmHandleSearch, executeCmHandleIdSearch } from './common/search-base.js'; |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 32 | import { passthroughRead, passthroughWrite, legacyBatchRead } from './common/passthrough-crud.js'; |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 33 | |
danielhanrahan | 78894db | 2024-08-16 13:56:14 +0100 | [diff] [blame] | 34 | let cmHandlesCreatedPerSecondTrend = new Trend('cmhandles_created_per_second', false); |
| 35 | let cmHandlesDeletedPerSecondTrend = new Trend('cmhandles_deleted_per_second', false); |
danielhanrahan | a1cdf73 | 2024-08-16 11:09:25 +0100 | [diff] [blame] | 36 | let passthroughReadNcmpOverheadTrend = new Trend('ncmp_overhead_passthrough_read', true); |
| 37 | let passthroughReadNcmpOverheadTrendWithAlternateId = new Trend('ncmp_overhead_passthrough_read_alt_id', true); |
| 38 | let passthroughWriteNcmpOverheadTrend = new Trend('ncmp_overhead_passthrough_write', true); |
danielhanrahan | f2e1e25 | 2024-08-25 21:35:19 +0100 | [diff] [blame] | 39 | let passthroughWriteNcmpOverheadTrendWithAlternateId = new Trend('ncmp_overhead_passthrough_write_alt_id', true); |
danielhanrahan | a9de166 | 2024-09-21 16:47:43 +0100 | [diff] [blame] | 40 | let idSearchNoFilterDurationTrend = new Trend('id_search_nofilter_duration', true); |
| 41 | let idSearchModuleDurationTrend = new Trend('id_search_module_duration', true); |
| 42 | let idSearchPropertyDurationTrend = new Trend('id_search_property_duration', true); |
| 43 | let idSearchCpsPathDurationTrend = new Trend('id_search_cpspath_duration', true); |
| 44 | let idSearchTrustLevelDurationTrend = new Trend('id_search_trustlevel_duration', true); |
| 45 | let cmSearchNoFilterDurationTrend = new Trend('cm_search_nofilter_duration', true); |
| 46 | let cmSearchModuleDurationTrend = new Trend('cm_search_module_duration', true); |
| 47 | let cmSearchPropertyDurationTrend = new Trend('cm_search_property_duration', true); |
| 48 | let cmSearchCpsPathDurationTrend = new Trend('cm_search_cpspath_duration', true); |
| 49 | let cmSearchTrustLevelDurationTrend = new Trend('cm_search_trustlevel_duration', true); |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 50 | let legacyBatchReadCmHandlesPerSecondTrend = new Trend('legacy_batch_read_cmhandles_per_second', false); |
halil.cakal | 65b870b | 2024-07-25 11:12:29 +0100 | [diff] [blame] | 51 | |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 52 | const legacyBatchEventReader = new Reader({ |
halil.cakal | 65b870b | 2024-07-25 11:12:29 +0100 | [diff] [blame] | 53 | brokers: KAFKA_BOOTSTRAP_SERVERS, |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 54 | topic: LEGACY_BATCH_TOPIC_NAME, |
halil.cakal | 65b870b | 2024-07-25 11:12:29 +0100 | [diff] [blame] | 55 | }); |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 56 | |
| 57 | const DURATION = '15m'; |
halil.cakal | 8ea90c9 | 2024-09-18 12:48:27 +0100 | [diff] [blame] | 58 | const LEGACY_BATCH_THROUGHPUT_TEST_START_TIME = '15m30s'; |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 59 | |
| 60 | export const options = { |
danielhanrahan | 4dac130 | 2024-08-30 15:03:06 +0100 | [diff] [blame] | 61 | setupTimeout: '8m', |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 62 | teardownTimeout: '6m', |
| 63 | scenarios: { |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 64 | passthrough_read_scenario: { |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 65 | executor: 'constant-vus', |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 66 | exec: 'passthroughReadScenario', |
danielhanrahan | a9de166 | 2024-09-21 16:47:43 +0100 | [diff] [blame] | 67 | vus: 2, |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 68 | duration: DURATION, |
| 69 | }, |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 70 | passthrough_read_alt_id_scenario: { |
seanbeirne | 2855952 | 2024-07-19 16:55:06 +0100 | [diff] [blame] | 71 | executor: 'constant-vus', |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 72 | exec: 'passthroughReadAltIdScenario', |
danielhanrahan | a9de166 | 2024-09-21 16:47:43 +0100 | [diff] [blame] | 73 | vus: 2, |
seanbeirne | 2855952 | 2024-07-19 16:55:06 +0100 | [diff] [blame] | 74 | duration: DURATION, |
| 75 | }, |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 76 | passthrough_write_scenario: { |
halil.cakal | fcc81ee | 2024-07-11 14:54:57 +0100 | [diff] [blame] | 77 | executor: 'constant-vus', |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 78 | exec: 'passthroughWriteScenario', |
danielhanrahan | a9de166 | 2024-09-21 16:47:43 +0100 | [diff] [blame] | 79 | vus: 2, |
halil.cakal | fcc81ee | 2024-07-11 14:54:57 +0100 | [diff] [blame] | 80 | duration: DURATION, |
| 81 | }, |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 82 | passthrough_write_alt_id_scenario: { |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 83 | executor: 'constant-vus', |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 84 | exec: 'passthroughWriteAltIdScenario', |
danielhanrahan | a9de166 | 2024-09-21 16:47:43 +0100 | [diff] [blame] | 85 | vus: 2, |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 86 | duration: DURATION, |
| 87 | }, |
danielhanrahan | a9de166 | 2024-09-21 16:47:43 +0100 | [diff] [blame] | 88 | cm_handle_id_search_nofilter_scenario: { |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 89 | executor: 'constant-vus', |
danielhanrahan | a9de166 | 2024-09-21 16:47:43 +0100 | [diff] [blame] | 90 | exec: 'cmHandleIdSearchNoFilterScenario', |
| 91 | vus: 1, |
danielhanrahan | f2e1e25 | 2024-08-25 21:35:19 +0100 | [diff] [blame] | 92 | duration: DURATION, |
| 93 | }, |
danielhanrahan | a9de166 | 2024-09-21 16:47:43 +0100 | [diff] [blame] | 94 | cm_handle_search_nofilter_scenario: { |
danielhanrahan | f2e1e25 | 2024-08-25 21:35:19 +0100 | [diff] [blame] | 95 | executor: 'constant-vus', |
danielhanrahan | a9de166 | 2024-09-21 16:47:43 +0100 | [diff] [blame] | 96 | exec: 'cmHandleSearchNoFilterScenario', |
| 97 | vus: 1, |
| 98 | duration: DURATION, |
| 99 | }, |
| 100 | cm_handle_id_search_module_scenario: { |
| 101 | executor: 'constant-vus', |
| 102 | exec: 'cmHandleIdSearchModuleScenario', |
| 103 | vus: 1, |
| 104 | duration: DURATION, |
| 105 | }, |
| 106 | cm_handle_search_module_scenario: { |
| 107 | executor: 'constant-vus', |
| 108 | exec: 'cmHandleSearchModuleScenario', |
| 109 | vus: 1, |
| 110 | duration: DURATION, |
| 111 | }, |
| 112 | cm_handle_id_search_property_scenario: { |
| 113 | executor: 'constant-vus', |
| 114 | exec: 'cmHandleIdSearchPropertyScenario', |
| 115 | vus: 1, |
| 116 | duration: DURATION, |
| 117 | }, |
| 118 | cm_handle_search_property_scenario: { |
| 119 | executor: 'constant-vus', |
| 120 | exec: 'cmHandleSearchPropertyScenario', |
| 121 | vus: 1, |
| 122 | duration: DURATION, |
| 123 | }, |
| 124 | cm_handle_id_search_cpspath_scenario: { |
| 125 | executor: 'constant-vus', |
| 126 | exec: 'cmHandleIdSearchCpsPathScenario', |
| 127 | vus: 1, |
| 128 | duration: DURATION, |
| 129 | }, |
| 130 | cm_handle_search_cpspath_scenario: { |
| 131 | executor: 'constant-vus', |
| 132 | exec: 'cmHandleSearchCpsPathScenario', |
| 133 | vus: 1, |
| 134 | duration: DURATION, |
| 135 | }, |
| 136 | cm_handle_id_search_trustlevel_scenario: { |
| 137 | executor: 'constant-vus', |
| 138 | exec: 'cmHandleIdSearchTrustLevelScenario', |
| 139 | vus: 1, |
| 140 | duration: DURATION, |
| 141 | }, |
| 142 | cm_handle_search_trustlevel_scenario: { |
| 143 | executor: 'constant-vus', |
| 144 | exec: 'cmHandleSearchTrustLevelScenario', |
| 145 | vus: 1, |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 146 | duration: DURATION, |
| 147 | }, |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 148 | legacy_batch_produce_scenario: { |
| 149 | executor: 'shared-iterations', |
| 150 | exec: 'legacyBatchProduceScenario', |
| 151 | vus: 2, |
| 152 | iterations: LEGACY_BATCH_THROUGHPUT_TEST_NUMBER_OF_REQUESTS, |
halil.cakal | 8ea90c9 | 2024-09-18 12:48:27 +0100 | [diff] [blame] | 153 | startTime: LEGACY_BATCH_THROUGHPUT_TEST_START_TIME, |
halil.cakal | 65b870b | 2024-07-25 11:12:29 +0100 | [diff] [blame] | 154 | }, |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 155 | legacy_batch_consume_scenario: { |
| 156 | executor: 'per-vu-iterations', |
| 157 | exec: 'legacyBatchConsumeScenario', |
| 158 | vus: 1, |
| 159 | iterations: 1, |
halil.cakal | 8ea90c9 | 2024-09-18 12:48:27 +0100 | [diff] [blame] | 160 | startTime: LEGACY_BATCH_THROUGHPUT_TEST_START_TIME, |
halil.cakal | 65b870b | 2024-07-25 11:12:29 +0100 | [diff] [blame] | 161 | } |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 162 | }, |
| 163 | thresholds: { |
danielhanrahan | 4cb6239 | 2024-08-27 17:57:26 +0100 | [diff] [blame] | 164 | 'http_req_failed': ['rate == 0'], |
danielhanrahan | 78894db | 2024-08-16 13:56:14 +0100 | [diff] [blame] | 165 | 'cmhandles_created_per_second': ['avg >= 22'], |
| 166 | 'cmhandles_deleted_per_second': ['avg >= 22'], |
danielhanrahan | f2e1e25 | 2024-08-25 21:35:19 +0100 | [diff] [blame] | 167 | 'ncmp_overhead_passthrough_read': ['avg <= 40'], |
| 168 | 'ncmp_overhead_passthrough_write': ['avg <= 40'], |
| 169 | 'ncmp_overhead_passthrough_read_alt_id': ['avg <= 40'], |
| 170 | 'ncmp_overhead_passthrough_write_alt_id': ['avg <= 40'], |
danielhanrahan | a9de166 | 2024-09-21 16:47:43 +0100 | [diff] [blame] | 171 | 'id_search_nofilter_duration': ['avg <= 2000'], |
| 172 | 'id_search_module_duration': ['avg <= 2000'], |
| 173 | 'id_search_property_duration': ['avg <= 2000'], |
| 174 | 'id_search_cpspath_duration': ['avg <= 2000'], |
| 175 | 'id_search_trustlevel_duration': ['avg <= 2000'], |
| 176 | 'cm_search_nofilter_duration': ['avg <= 15000'], |
| 177 | 'cm_search_module_duration': ['avg <= 15000'], |
| 178 | 'cm_search_property_duration': ['avg <= 15000'], |
| 179 | 'cm_search_cpspath_duration': ['avg <= 15000'], |
| 180 | 'cm_search_trustlevel_duration': ['avg <= 15000'], |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 181 | 'legacy_batch_read_cmhandles_per_second': ['avg >= 150'], |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 182 | }, |
| 183 | }; |
| 184 | |
| 185 | export function setup() { |
halil.cakal | 1745d20 | 2024-08-06 14:02:49 +0100 | [diff] [blame] | 186 | const startTimeInMillis = Date.now(); |
| 187 | |
| 188 | const TOTAL_BATCHES = Math.ceil(TOTAL_CM_HANDLES / REGISTRATION_BATCH_SIZE); |
| 189 | for (let batchNumber = 0; batchNumber < TOTAL_BATCHES; batchNumber++) { |
| 190 | const nextBatchOfCmHandleIds = makeBatchOfCmHandleIds(REGISTRATION_BATCH_SIZE, batchNumber); |
| 191 | const response = createCmHandles(nextBatchOfCmHandleIds); |
| 192 | check(response, { 'create CM-handles status equals 200': (r) => r.status === 200 }); |
| 193 | } |
| 194 | |
| 195 | waitForAllCmHandlesToBeReady(); |
| 196 | |
| 197 | const endTimeInMillis = Date.now(); |
| 198 | const totalRegistrationTimeInSeconds = (endTimeInMillis - startTimeInMillis) / 1000.0; |
| 199 | |
danielhanrahan | 78894db | 2024-08-16 13:56:14 +0100 | [diff] [blame] | 200 | cmHandlesCreatedPerSecondTrend.add(TOTAL_CM_HANDLES / totalRegistrationTimeInSeconds); |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 201 | } |
| 202 | |
| 203 | export function teardown() { |
halil.cakal | 1745d20 | 2024-08-06 14:02:49 +0100 | [diff] [blame] | 204 | const startTimeInMillis = Date.now(); |
| 205 | |
egernug | 2bdef26 | 2024-09-06 12:09:31 +0100 | [diff] [blame] | 206 | let DEREGISTERED_CM_HANDLES = 0 |
halil.cakal | 1745d20 | 2024-08-06 14:02:49 +0100 | [diff] [blame] | 207 | const TOTAL_BATCHES = Math.ceil(TOTAL_CM_HANDLES / REGISTRATION_BATCH_SIZE); |
| 208 | for (let batchNumber = 0; batchNumber < TOTAL_BATCHES; batchNumber++) { |
| 209 | const nextBatchOfCmHandleIds = makeBatchOfCmHandleIds(REGISTRATION_BATCH_SIZE, batchNumber); |
| 210 | const response = deleteCmHandles(nextBatchOfCmHandleIds); |
egernug | 2bdef26 | 2024-09-06 12:09:31 +0100 | [diff] [blame] | 211 | if (response.error_code === 0) { |
| 212 | DEREGISTERED_CM_HANDLES += REGISTRATION_BATCH_SIZE |
| 213 | } |
halil.cakal | 1745d20 | 2024-08-06 14:02:49 +0100 | [diff] [blame] | 214 | check(response, { 'delete CM-handles status equals 200': (r) => r.status === 200 }); |
| 215 | } |
| 216 | |
| 217 | const endTimeInMillis = Date.now(); |
| 218 | const totalDeregistrationTimeInSeconds = (endTimeInMillis - startTimeInMillis) / 1000.0; |
| 219 | |
egernug | 2bdef26 | 2024-09-06 12:09:31 +0100 | [diff] [blame] | 220 | cmHandlesDeletedPerSecondTrend.add(DEREGISTERED_CM_HANDLES / totalDeregistrationTimeInSeconds); |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 221 | } |
| 222 | |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 223 | export function passthroughReadScenario() { |
danielhanrahan | f2e1e25 | 2024-08-25 21:35:19 +0100 | [diff] [blame] | 224 | const response = passthroughRead(false); |
danielhanrahan | 78894db | 2024-08-16 13:56:14 +0100 | [diff] [blame] | 225 | if (check(response, { 'passthrough read status equals 200': (r) => r.status === 200 })) { |
| 226 | const overhead = response.timings.duration - READ_DATA_FOR_CM_HANDLE_DELAY_MS; |
| 227 | passthroughReadNcmpOverheadTrend.add(overhead); |
| 228 | } |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 229 | } |
| 230 | |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 231 | export function passthroughReadAltIdScenario() { |
danielhanrahan | f2e1e25 | 2024-08-25 21:35:19 +0100 | [diff] [blame] | 232 | const response = passthroughRead(true); |
danielhanrahan | 78894db | 2024-08-16 13:56:14 +0100 | [diff] [blame] | 233 | if (check(response, { 'passthrough read with alternate Id status equals 200': (r) => r.status === 200 })) { |
| 234 | const overhead = response.timings.duration - READ_DATA_FOR_CM_HANDLE_DELAY_MS; |
| 235 | passthroughReadNcmpOverheadTrendWithAlternateId.add(overhead); |
| 236 | } |
seanbeirne | 2855952 | 2024-07-19 16:55:06 +0100 | [diff] [blame] | 237 | } |
| 238 | |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 239 | export function passthroughWriteScenario() { |
danielhanrahan | f2e1e25 | 2024-08-25 21:35:19 +0100 | [diff] [blame] | 240 | const response = passthroughWrite(false); |
danielhanrahan | 78894db | 2024-08-16 13:56:14 +0100 | [diff] [blame] | 241 | if (check(response, { 'passthrough write status equals 201': (r) => r.status === 201 })) { |
| 242 | const overhead = response.timings.duration - WRITE_DATA_FOR_CM_HANDLE_DELAY_MS; |
| 243 | passthroughWriteNcmpOverheadTrend.add(overhead); |
| 244 | } |
halil.cakal | fcc81ee | 2024-07-11 14:54:57 +0100 | [diff] [blame] | 245 | } |
| 246 | |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 247 | export function passthroughWriteAltIdScenario() { |
danielhanrahan | f2e1e25 | 2024-08-25 21:35:19 +0100 | [diff] [blame] | 248 | const response = passthroughWrite(true); |
| 249 | if (check(response, { 'passthrough write with alternate Id status equals 201': (r) => r.status === 201 })) { |
| 250 | const overhead = response.timings.duration - WRITE_DATA_FOR_CM_HANDLE_DELAY_MS; |
| 251 | passthroughWriteNcmpOverheadTrendWithAlternateId.add(overhead); |
| 252 | } |
| 253 | } |
| 254 | |
danielhanrahan | a9de166 | 2024-09-21 16:47:43 +0100 | [diff] [blame] | 255 | export function cmHandleIdSearchNoFilterScenario() { |
| 256 | const response = executeCmHandleIdSearch('no-filter'); |
| 257 | if (check(response, { 'CM handle ID no-filter search status equals 200': (r) => r.status === 200 }) |
| 258 | && check(response, { 'CM handle ID no-filter search returned expected CM-handles': (r) => r.json('#') === TOTAL_CM_HANDLES })) { |
| 259 | idSearchNoFilterDurationTrend.add(response.timings.duration); |
danielhanrahan | 78894db | 2024-08-16 13:56:14 +0100 | [diff] [blame] | 260 | } |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 261 | } |
| 262 | |
danielhanrahan | a9de166 | 2024-09-21 16:47:43 +0100 | [diff] [blame] | 263 | export function cmHandleSearchNoFilterScenario() { |
| 264 | const response = executeCmHandleSearch('no-filter'); |
| 265 | if (check(response, { 'CM handle no-filter search status equals 200': (r) => r.status === 200 }) |
| 266 | && check(response, { 'CM handle no-filter search returned expected CM-handles': (r) => r.json('#') === TOTAL_CM_HANDLES })) { |
| 267 | cmSearchNoFilterDurationTrend.add(response.timings.duration); |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | export function cmHandleIdSearchModuleScenario() { |
| 272 | const response = executeCmHandleIdSearch('module'); |
| 273 | if (check(response, { 'CM handle ID module search status equals 200': (r) => r.status === 200 }) |
| 274 | && check(response, { 'CM handle ID module search returned expected CM-handles': (r) => r.json('#') === TOTAL_CM_HANDLES })) { |
| 275 | idSearchModuleDurationTrend.add(response.timings.duration); |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | export function cmHandleSearchModuleScenario() { |
| 280 | const response = executeCmHandleSearch('module'); |
| 281 | if (check(response, { 'CM handle module search status equals 200': (r) => r.status === 200 }) |
| 282 | && check(response, { 'CM handle module search returned expected CM-handles': (r) => r.json('#') === TOTAL_CM_HANDLES })) { |
| 283 | cmSearchModuleDurationTrend.add(response.timings.duration); |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | export function cmHandleIdSearchPropertyScenario() { |
| 288 | const response = executeCmHandleIdSearch('property'); |
| 289 | if (check(response, { 'CM handle ID property search status equals 200': (r) => r.status === 200 }) |
| 290 | && check(response, { 'CM handle ID property search returned expected CM-handles': (r) => r.json('#') === TOTAL_CM_HANDLES })) { |
| 291 | idSearchPropertyDurationTrend.add(response.timings.duration); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | export function cmHandleSearchPropertyScenario() { |
| 296 | const response = executeCmHandleSearch('property'); |
| 297 | if (check(response, { 'CM handle property search status equals 200': (r) => r.status === 200 }) |
| 298 | && check(response, { 'CM handle property search returned expected CM-handles': (r) => r.json('#') === TOTAL_CM_HANDLES })) { |
| 299 | cmSearchPropertyDurationTrend.add(response.timings.duration); |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | export function cmHandleIdSearchCpsPathScenario() { |
| 304 | const response = executeCmHandleIdSearch('cps-path-for-ready-cm-handles'); |
| 305 | if (check(response, { 'CM handle ID cps path search status equals 200': (r) => r.status === 200 }) |
| 306 | && check(response, { 'CM handle ID cps path search returned expected CM-handles': (r) => r.json('#') === TOTAL_CM_HANDLES })) { |
| 307 | idSearchCpsPathDurationTrend.add(response.timings.duration); |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | export function cmHandleSearchCpsPathScenario() { |
| 312 | const response = executeCmHandleSearch('cps-path-for-ready-cm-handles'); |
| 313 | if (check(response, { 'CM handle cps path search status equals 200': (r) => r.status === 200 }) |
| 314 | && check(response, { 'CM handle cps path search returned expected CM-handles': (r) => r.json('#') === TOTAL_CM_HANDLES })) { |
| 315 | cmSearchCpsPathDurationTrend.add(response.timings.duration); |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | export function cmHandleIdSearchTrustLevelScenario() { |
| 320 | const response = executeCmHandleIdSearch('trust-level'); |
| 321 | if (check(response, { 'CM handle ID trust level search status equals 200': (r) => r.status === 200 }) |
| 322 | && check(response, { 'CM handle ID trust level search returned expected CM-handles': (r) => r.json('#') === TOTAL_CM_HANDLES })) { |
| 323 | idSearchTrustLevelDurationTrend.add(response.timings.duration); |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | export function cmHandleSearchTrustLevelScenario() { |
| 328 | const response = executeCmHandleSearch('trust-level'); |
| 329 | if (check(response, { 'CM handle trust level search status equals 200': (r) => r.status === 200 }) |
| 330 | && check(response, { 'CM handle trust level search returned expected CM-handles': (r) => r.json('#') === TOTAL_CM_HANDLES })) { |
| 331 | cmSearchTrustLevelDurationTrend.add(response.timings.duration); |
danielhanrahan | 78894db | 2024-08-16 13:56:14 +0100 | [diff] [blame] | 332 | } |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 333 | } |
| 334 | |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 335 | export function legacyBatchProduceScenario() { |
| 336 | const nextBatchOfCmHandleIds = makeBatchOfCmHandleIds(LEGACY_BATCH_THROUGHPUT_TEST_BATCH_SIZE, 0); |
| 337 | const response = legacyBatchRead(nextBatchOfCmHandleIds); |
halil.cakal | 65b870b | 2024-07-25 11:12:29 +0100 | [diff] [blame] | 338 | check(response, { 'data operation batch read status equals 200': (r) => r.status === 200 }); |
| 339 | } |
| 340 | |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 341 | export function legacyBatchConsumeScenario() { |
| 342 | const TOTAL_MESSAGES_TO_CONSUME = LEGACY_BATCH_THROUGHPUT_TEST_NUMBER_OF_REQUESTS * LEGACY_BATCH_THROUGHPUT_TEST_BATCH_SIZE; |
halil.cakal | 65b870b | 2024-07-25 11:12:29 +0100 | [diff] [blame] | 343 | try { |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 344 | let messagesConsumed = 0; |
| 345 | let startTime = Date.now(); |
| 346 | |
| 347 | while (messagesConsumed < TOTAL_MESSAGES_TO_CONSUME) { |
| 348 | let messages = legacyBatchEventReader.consume({ limit: 1000 }); |
| 349 | |
| 350 | if (messages.length > 0) { |
| 351 | messagesConsumed += messages.length; |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | let endTime = Date.now(); |
| 356 | const timeToConsumeMessagesInSeconds = (endTime - startTime) / 1000.0; |
| 357 | legacyBatchReadCmHandlesPerSecondTrend.add(TOTAL_MESSAGES_TO_CONSUME / timeToConsumeMessagesInSeconds); |
halil.cakal | 65b870b | 2024-07-25 11:12:29 +0100 | [diff] [blame] | 358 | } catch (error) { |
halil.cakal | fc49910 | 2024-08-28 10:19:26 +0100 | [diff] [blame] | 359 | legacyBatchReadCmHandlesPerSecondTrend.add(0); |
halil.cakal | 65b870b | 2024-07-25 11:12:29 +0100 | [diff] [blame] | 360 | console.error(error); |
| 361 | } |
| 362 | } |
| 363 | |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 364 | export function handleSummary(data) { |
| 365 | return { |
| 366 | stdout: makeCustomSummaryReport(data, options), |
| 367 | }; |
| 368 | } |