-
Notifications
You must be signed in to change notification settings - Fork 196
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
Large Scale Performance Tests #983
Draft
RaynorChavez
wants to merge
7
commits into
mainline
Choose a base branch
from
raynor/rb-scale-locust-test
base: mainline
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
82635ef
initial
RaynorChavez 76fde3c
change all_world
RaynorChavez 170e37e
change burst stages
RaynorChavez 3eb5f26
add retries
RaynorChavez b6954ca
mod test shape
RaynorChavez 00bfc22
better memory management
RaynorChavez 0385e53
fix cyclical loads
RaynorChavez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
name: Large Scale Performance Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
test_suite: | ||
type: choice | ||
required: true | ||
options: | ||
- large_scale_performance_locustfile.py | ||
description: > | ||
Location of the Locust file that contains the test suite. | ||
|
||
number_of_users: | ||
type: string | ||
required: true | ||
default: "100" | ||
description: > | ||
Total number of simulated users. | ||
|
||
user_spawn_rate: | ||
type: string | ||
required: true | ||
default: "10" | ||
description: > | ||
Users spawned per second. | ||
|
||
duration: | ||
type: string | ||
required: true | ||
default: "1h" | ||
description: > | ||
Duration of the test (e.g., 1h, 24h, 72h). | ||
|
||
marqo_host: | ||
type: string | ||
required: true | ||
default: "https://your-marqo-instance.com" | ||
description: > | ||
Marqo host to run performance test on. | ||
|
||
index_name: | ||
type: string | ||
required: true | ||
default: "locust-test" | ||
description: > | ||
Index name to test. | ||
|
||
marqo_cloud_api_key: | ||
type: string | ||
required: true | ||
description: > | ||
Marqo Cloud API key to use for the test. | ||
|
||
jobs: | ||
Extract-Data: | ||
name: Extract Required Data | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
|
||
- name: Install Dependencies | ||
run: | | ||
pip install pandas | ||
|
||
- name: Extract Required Data | ||
run: | | ||
python perf_tests/extract_required_data.py | ||
|
||
- name: Upload Extracted Data as Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: extracted-data | ||
path: perf_tests/data/extracted_*.csv | ||
|
||
Run-Performance-Test: | ||
name: Run Large Scale Performance Tests | ||
needs: Extract-Data | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Download Extracted Data | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: extracted-data | ||
path: perf_tests/data/ | ||
|
||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
|
||
- name: Install Dependencies | ||
run: | | ||
pip install marqo locust numpy pandas | ||
|
||
- name: Prepare Test Environment | ||
run: | | ||
mkdir -p perf_tests/data | ||
cp perf_tests/large_scale_performance_locustfile.py perf_tests/ | ||
cp perf_tests/bquxjob_5a025798_19241877e37.csv perf_tests/ | ||
# Extracted data is already downloaded to perf_tests/data/ | ||
|
||
- name: Run Locust Test | ||
working-directory: perf_tests | ||
run: | | ||
locust -f ${{ github.event.inputs.test_suite }} \ | ||
-u ${{ github.event.inputs.number_of_users }} \ | ||
-r ${{ github.event.inputs.user_spawn_rate }} \ | ||
--run-time ${{ github.event.inputs.duration }} \ | ||
--headless \ | ||
--host ${{ github.event.inputs.marqo_host }} | ||
env: | ||
MARQO_INDEX_NAME: ${{ github.event.inputs.index_name }} | ||
MARQO_CLOUD_API_KEY: ${{ github.event.inputs.marqo_cloud_api_key }} | ||
|
||
- name: Upload Telemetry Data | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: telemetry-data | ||
path: perf_tests/telemetry_data_*.json | ||
|
||
- name: Upload Telemetry Summaries | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: telemetry-summaries | ||
path: perf_tests/telemetry_summary_*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import json | ||
import glob | ||
import numpy as np | ||
import pandas as pd | ||
import os | ||
from datetime import datetime | ||
|
||
def load_telemetry_data(pattern='telemetry_data_*.json'): | ||
telemetry_files = glob.glob(pattern) | ||
all_data = [] | ||
|
||
for file in telemetry_files: | ||
with open(file, 'r') as f: | ||
data = json.load(f) | ||
all_data.extend(data) | ||
|
||
return all_data | ||
|
||
def analyze_telemetry(all_data): | ||
if not all_data: | ||
print("No telemetry data to analyze.") | ||
return | ||
|
||
# Convert to DataFrame | ||
df = pd.DataFrame(all_data) | ||
|
||
# Ensure 'total_time_ms' is numeric | ||
df['total_time_ms'] = pd.to_numeric(df['total_time_ms'], errors='coerce') | ||
|
||
# Calculate metrics | ||
avg_time = df['total_time_ms'].mean() | ||
median_time = df['total_time_ms'].median() | ||
p95_time = df['total_time_ms'].quantile(0.95) | ||
total_requests = len(df) | ||
successful_requests = df['total_time_ms'].notna().sum() | ||
error_rate = ((total_requests - successful_requests) / total_requests) * 100 if total_requests > 0 else 0.0 | ||
|
||
summary = { | ||
'Average Response Time (ms)': avg_time, | ||
'Median Response Time (ms)': median_time, | ||
'95th Percentile Response Time (ms)': p95_time, | ||
'Total Requests': total_requests, | ||
'Successful Requests': successful_requests, | ||
'Error Rate (%)': error_rate, | ||
} | ||
|
||
# Save summary to JSON | ||
timestamp = datetime.now().strftime('%Y%m%d%H%M%S') | ||
summary_filename = f"telemetry_summary_{timestamp}.json" | ||
with open(summary_filename, 'w') as f: | ||
json.dump(summary, f, indent=4) | ||
|
||
# Print summary | ||
print("Telemetry Summary:") | ||
for key, value in summary.items(): | ||
print(f"{key}: {value}") | ||
|
||
if __name__ == "__main__": | ||
all_data = load_telemetry_data() | ||
analyze_telemetry(all_data) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a different workflow to run this? Can we reuse the
locust_performance_test
workflow?The extra step can be done using lifecycle hook in the locust file, if it does not take too long to run