Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Metrics collection - Bytes throughput, Request count throughput #61

Closed
4 tasks done
litalmason opened this issue Dec 24, 2023 · 0 comments
Closed
4 tasks done

Metrics collection - Bytes throughput, Request count throughput #61

litalmason opened this issue Dec 24, 2023 · 0 comments
Labels
feature New feature
Milestone

Comments

@litalmason
Copy link
Collaborator

litalmason commented Dec 24, 2023

Overview

Implement bytes throughput and request count throughput metrics in a single test run of an algorithm and its selected amount of iterations.

After calculating the new metrics, you will add them as two new fields to our results JSON, requestThroughput and bytesThroughput, to the existing JSON data structure. These fields will represent the per-second throughput of algorithm executions and data processed respectively.
These new metrics shall also be visualized in the UI.

Current JSON Structure

The current JSON data structure appears as follows:

{
   "algorithm": "hqc256",
   "id": 189,
   "iterations": 10000,
   "results": {
      "averageCPU": 3.1,
      "averageMemory": 476
   }
}

Expected JSON Structure

The proposed JSON structure with the new fields is as follows:

{
   "algorithm": "hqc256",
   "id": 189,
   "iterations": 10000,
   "results": {
      "averageCPU": 3.1,
      "averageMemory": 476,
      "requestThroughput": 100,
      "bytesThroughput": 520
   }
}

Implementation Steps

  1. Data Collection: Per run, we need the number of iterations, the total message size (=iterations * message size), and the total time taken for the test run.

  2. Message Size Calculation: Calculate the size of an HTTP request by adding the size of the request line, headers, and the payload (for POST requests). The size of the request line includes the HTTP method, URL, and HTTP version. Headers include fields like Host, User-Agent, Accept, and others. The payload is the data being sent to the server (for POST requests).

Python snippet:

# Calculate the size of the request line (method + URL + HTTP version)
# We add 4 to account for the 3 spaces and 1 end-of-line character that are part of the request line
request_line_size = sys.getsizeof(method) + sys.getsizeof(url) + sys.getsizeof('HTTP/1.1') + 4

# Calculate the size of the headers
headers_size = sum(sys.getsizeof(header) for header in headers.values())

# Calculate the size of the payload
data_size = sys.getsizeof(data)

# Add up the sizes to get the total size
total_size = request_line_size + headers_size + data_size
  1. Throughput Calculation: Calculate the throughput per second for iterations and bytes:

    For requests count: Throughput in count/second = (Total Count of Requests) / (Total Time in Seconds)

    For bytes: Throughput in bytes/second = (Total Data in Bytes) / (Total Time in Seconds)

    If the total time is less than a second, the throughput has to be scaled up proportionally to represent an estimate for a full second.
    For example, if the total time is 30 seconds (0.5 seconds) and there are 500 requests, the formula becomes 500 / 0.5 resulting in 1000 requests per second.

  2. Field Addition: After calculating the throughput values, add them to the respective JSON objects under the results field as requestThroughput and bytesThroughput.

  3. Metrics in DB: When saving the throughput values, make sure to name the metrics as follows: requestThroughputPerSecond and bytesThroughputSecond.

  4. Visualization: After adding the new fields to the JSON, add the metrics to the UI visualization, both the table and the graphs.

Acceptance Criteria

  1. The size of an HTTP request is correctly calculated by adding the size of the request line, headers, and the payload (for POST requests).

  2. The values for requestThroughput correctly represent the number of iterations that would be completed per second, given the total count of iterations and the total time for the test run. This should be calculated even if the total time is less than a second, in which case the throughput should be scaled up proportionally.

  3. The values for bytesThroughput correctly represent the volume of data that would be processed per second, given the total volume of data and the total time for the test run. This should be calculated even if the total time is less than a second, in which case the throughput should be scaled up proportionally.

  4. The new fields requestThroughput and bytesThroughput are correctly added to the respective JSON objects under the results field.

  5. These new metrics show up in the UI results table, and the graphs.

Tasks

@litalmason litalmason added the feature New feature label Dec 24, 2023
@litalmason litalmason added this to the 1.2.0 milestone Dec 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature
Projects
Status: Done
Development

No branches or pull requests

2 participants