Skip to content

Commit

Permalink
trying to fix merging
Browse files Browse the repository at this point in the history
  • Loading branch information
abdelaziz-mahdy committed May 28, 2024
1 parent 2a8633b commit 954d3c7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 29 deletions.
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,69 +55,69 @@ Visual comparisons for database endpoints and static endpoints are provided to s
# Database Endpoints

## Comparison Graph with db endpoints
![Comparison Graph](comparison_graph_db_test.png?v=1716887643)
![Comparison Graph](comparison_graph_db_test.png?v=1716888105)

## Detailed Graphs for each backend
- **go mux db_test**
![go mux db_test Benchmark Graph](backends/go/mux/tests/results/db_test/graph.png?v=1716887643)
![go mux db_test Benchmark Graph](backends/go/mux/tests/results/db_test/graph.png?v=1716888105)

- **c_sharp dot net db_test**
![c_sharp dot net db_test Benchmark Graph](backends/c_sharp/dot-net/tests/results/db_test/graph.png?v=1716887643)
![c_sharp dot net db_test Benchmark Graph](backends/c_sharp/dot-net/tests/results/db_test/graph.png?v=1716888105)

- **python django sync db_test**
![python django sync db_test Benchmark Graph](backends/python/django-sync/tests/results/db_test/graph.png?v=1716887643)
![python django sync db_test Benchmark Graph](backends/python/django-sync/tests/results/db_test/graph.png?v=1716888105)

- **python fast api db_test**
![python fast api db_test Benchmark Graph](backends/python/fast-api/tests/results/db_test/graph.png?v=1716887643)
![python fast api db_test Benchmark Graph](backends/python/fast-api/tests/results/db_test/graph.png?v=1716888105)

- **python django async db_test**
![python django async db_test Benchmark Graph](backends/python/django-async/tests/results/db_test/graph.png?v=1716887643)
![python django async db_test Benchmark Graph](backends/python/django-async/tests/results/db_test/graph.png?v=1716888105)

- **dart server pod db_test**
![dart server pod db_test Benchmark Graph](backends/dart/server-pod/tests/results/db_test/graph.png?v=1716887643)
![dart server pod db_test Benchmark Graph](backends/dart/server-pod/tests/results/db_test/graph.png?v=1716888105)

- **rust actix web db_test**
![rust actix web db_test Benchmark Graph](backends/rust/actix-web/tests/results/db_test/graph.png?v=1716887643)
![rust actix web db_test Benchmark Graph](backends/rust/actix-web/tests/results/db_test/graph.png?v=1716888105)

- **javascript express bun db_test**
![javascript express bun db_test Benchmark Graph](backends/javascript/express-bun/tests/results/db_test/graph.png?v=1716887643)
![javascript express bun db_test Benchmark Graph](backends/javascript/express-bun/tests/results/db_test/graph.png?v=1716888105)

- **javascript express node db_test**
![javascript express node db_test Benchmark Graph](backends/javascript/express-node/tests/results/db_test/graph.png?v=1716887643)
![javascript express node db_test Benchmark Graph](backends/javascript/express-node/tests/results/db_test/graph.png?v=1716888105)



# Static Endpoints

## Comparison Graph with static endpoints
![Comparison Graph](comparison_graph_no_db_test.png?v=1716887643)
![Comparison Graph](comparison_graph_no_db_test.png?v=1716888105)

## Detailed Graphs for each backend
- **go mux no_db_test**
![go mux no_db_test Benchmark Graph](backends/go/mux/tests/results/no_db_test/graph.png?v=1716887643)
![go mux no_db_test Benchmark Graph](backends/go/mux/tests/results/no_db_test/graph.png?v=1716888105)

- **c_sharp dot net no_db_test**
![c_sharp dot net no_db_test Benchmark Graph](backends/c_sharp/dot-net/tests/results/no_db_test/graph.png?v=1716887643)
![c_sharp dot net no_db_test Benchmark Graph](backends/c_sharp/dot-net/tests/results/no_db_test/graph.png?v=1716888105)

- **python django sync no_db_test**
![python django sync no_db_test Benchmark Graph](backends/python/django-sync/tests/results/no_db_test/graph.png?v=1716887643)
![python django sync no_db_test Benchmark Graph](backends/python/django-sync/tests/results/no_db_test/graph.png?v=1716888105)

- **python fast api no_db_test**
![python fast api no_db_test Benchmark Graph](backends/python/fast-api/tests/results/no_db_test/graph.png?v=1716887643)
![python fast api no_db_test Benchmark Graph](backends/python/fast-api/tests/results/no_db_test/graph.png?v=1716888105)

- **python django async no_db_test**
![python django async no_db_test Benchmark Graph](backends/python/django-async/tests/results/no_db_test/graph.png?v=1716887643)
![python django async no_db_test Benchmark Graph](backends/python/django-async/tests/results/no_db_test/graph.png?v=1716888105)

- **dart server pod no_db_test**
![dart server pod no_db_test Benchmark Graph](backends/dart/server-pod/tests/results/no_db_test/graph.png?v=1716887643)
![dart server pod no_db_test Benchmark Graph](backends/dart/server-pod/tests/results/no_db_test/graph.png?v=1716888105)

- **rust actix web no_db_test**
![rust actix web no_db_test Benchmark Graph](backends/rust/actix-web/tests/results/no_db_test/graph.png?v=1716887643)
![rust actix web no_db_test Benchmark Graph](backends/rust/actix-web/tests/results/no_db_test/graph.png?v=1716888105)

- **javascript express bun no_db_test**
![javascript express bun no_db_test Benchmark Graph](backends/javascript/express-bun/tests/results/no_db_test/graph.png?v=1716887643)
![javascript express bun no_db_test Benchmark Graph](backends/javascript/express-bun/tests/results/no_db_test/graph.png?v=1716888105)

- **javascript express node no_db_test**
![javascript express node no_db_test Benchmark Graph](backends/javascript/express-node/tests/results/no_db_test/graph.png?v=1716887643)
![javascript express node no_db_test Benchmark Graph](backends/javascript/express-node/tests/results/no_db_test/graph.png?v=1716888105)


2 changes: 1 addition & 1 deletion results_data.json

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions scripts/graphs/graph_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
def process_file(file_path):
# Load the data from the provided file
data = pd.read_csv(file_path, on_bad_lines='skip')

data['timestamp'] = pd.to_numeric(data['Timestamp'], errors='coerce')
# Convert Timestamp to datetime and then to seconds relative to the start
data['Timestamp'] = pd.to_datetime(data['Timestamp'], unit='s')
data['Timestamp'] = (data['Timestamp'] - data['Timestamp'].min()).dt.total_seconds()
Expand Down Expand Up @@ -286,34 +288,34 @@ def get_adjusted_file_name(file_path):
compare_and_plot(all_data[parent_dir], all_summaries[parent_dir], all_cpu[parent_dir],custom_result_file_name="comparison_graph_"+parent_dir)
def merge_data_and_cpu(data, cpu):
# Ensure data and cpu are sorted by 'Timestamp'
data = data.sort_values('Timestamp').reset_index(drop=True)
cpu = cpu.sort_values('Timestamp').reset_index(drop=True)
data = data.sort_values('timestamp').reset_index(drop=True)
cpu = cpu.sort_values('timestamp').reset_index(drop=True)

# Initialize the columns in data for CPU usage and memory usage
data['benchmark_cpu_usage'] = np.nan
data['benchmark_mem_usage'] = np.nan
data['db_cpu_usage'] = np.nan
data['db_mem_usage'] = np.nan

# Iterate over each row in the data to merge the CPU information
cpu_index = 0
cpu_length = len(cpu)

for index, row in data.iterrows():
# Find the next CPU timestamp that is greater than or equal to the current data timestamp
while cpu_index < cpu_length and cpu.loc[cpu_index, 'Timestamp'] < row['Timestamp']:
# Move the CPU index forward if the CPU timestamp is less than the current data timestamp
while cpu_index < cpu_length and cpu.loc[cpu_index, 'timestamp'] <= row['timestamp']:
cpu_index += 1

# If the CPU index is within the bounds, merge the CPU data
# If the CPU index is within the bounds and greater than the data timestamp, merge the CPU data
if cpu_index < cpu_length:
data.at[index, 'benchmark_cpu_usage'] = cpu.loc[cpu_index, 'benchmark_cpu_usage']
data.at[index, 'benchmark_mem_usage'] = cpu.loc[cpu_index, 'benchmark_mem_usage']
data.at[index, 'benchmark_mem_usage'] = str(cpu.loc[cpu_index, 'benchmark_mem_usage'])
data.at[index, 'db_cpu_usage'] = cpu.loc[cpu_index, 'db_cpu_usage']
data.at[index, 'db_mem_usage'] = cpu.loc[cpu_index, 'db_mem_usage']
data.at[index, 'db_mem_usage'] = str(cpu.loc[cpu_index, 'db_mem_usage'])

return data



def data_json(all_summaries, all_data, all_cpu):
def custom_serializer(obj):
if isinstance(obj, pd.DataFrame):
Expand Down

0 comments on commit 954d3c7

Please sign in to comment.