Skip to content
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

Donald ug #1

Open
wants to merge 116 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
a406c25
fixes bug with missing parameter
Feb 6, 2024
91e155f
added variable iterations to load balancer test
DonaldJennings Feb 6, 2024
0257180
fixes string
DonaldJennings Feb 6, 2024
e610298
updated test-load-balancer to print iterations
DonaldJennings Feb 6, 2024
0b84a3a
added latencies to the dispatch_function
DonaldJennings Feb 6, 2024
a7b2f80
fixes syntax
DonaldJennings Feb 6, 2024
70cd012
toggles async
DonaldJennings Feb 6, 2024
1b70205
toggles async
DonaldJennings Feb 6, 2024
532b890
async printing
DonaldJennings Feb 6, 2024
f39bb72
updates conversion function to bool
DonaldJennings Feb 6, 2024
3a9aa0a
Added forbid_ndp as a paramter to the test_load_balancer
DonaldJennings Feb 6, 2024
d88f888
fixes missing parameter issue on WorkerHashLB
DonaldJennings Feb 6, 2024
77633c6
initial commit for experiment setup
DonaldJennings Feb 11, 2024
60f0008
removed imports
DonaldJennings Feb 11, 2024
20666ba
removes matplotlib
DonaldJennings Feb 11, 2024
10b3a3f
attempts to add txt file to storage
DonaldJennings Feb 11, 2024
55d7ae1
Added wordcount functionality to experiments
DonaldJennings Feb 11, 2024
97f1833
debugging the run_benchmark
DonaldJennings Feb 11, 2024
83844ee
escapes single quotations in strings
DonaldJennings Feb 11, 2024
2dd0828
fix
DonaldJennings Feb 11, 2024
8c6821d
test
DonaldJennings Feb 11, 2024
549f92d
changes os to subprocess
DonaldJennings Feb 11, 2024
eca8417
temp fix only use first 1000 characters
DonaldJennings Feb 11, 2024
82c57be
longer arg list
DonaldJennings Feb 11, 2024
e2c606b
attempts to use stdin to get files streamed to command
DonaldJennings Feb 11, 2024
25dfbbe
removed count
DonaldJennings Feb 11, 2024
722da16
removes shell flag
DonaldJennings Feb 11, 2024
1786268
removes shell flag
DonaldJennings Feb 11, 2024
b232bc1
changes experiment
DonaldJennings Feb 11, 2024
4d64b57
attempt to put directly to rados pool
DonaldJennings Feb 11, 2024
f97f6bc
continued attempt
DonaldJennings Feb 11, 2024
db57dc8
updated put function to handle txt files
DonaldJennings Feb 11, 2024
e9f64d9
added debugging
DonaldJennings Feb 11, 2024
72cc27c
debug
DonaldJennings Feb 11, 2024
3820c94
reverted put implementation
DonaldJennings Feb 11, 2024
f65f8fd
temp
DonaldJennings Feb 11, 2024
78f5d41
rejigged the formatting of output messaging in the invoke
DonaldJennings Feb 11, 2024
26db157
fixed typo
DonaldJennings Feb 11, 2024
b86492f
test
DonaldJennings Feb 11, 2024
7be4145
fixed string cleansing
DonaldJennings Feb 11, 2024
ad491f1
Added optional tag to params in load balance strategy
DonaldJennings Feb 11, 2024
97afd0f
fixed bug
DonaldJennings Feb 11, 2024
1c19d4a
removed response.text printing on invocation success
DonaldJennings Feb 11, 2024
8447569
fix
DonaldJennings Feb 11, 2024
8249b92
added shakespeares works to text sources
DonaldJennings Feb 11, 2024
f49b3c4
results writing to csv
DonaldJennings Feb 11, 2024
b85664a
results
DonaldJennings Feb 11, 2024
e3becbe
test
DonaldJennings Feb 11, 2024
2195d52
more metadata
DonaldJennings Feb 11, 2024
586e617
added more metadata
DonaldJennings Feb 11, 2024
5175847
email results lol
DonaldJennings Feb 11, 2024
7f2f989
removed email
DonaldJennings Feb 11, 2024
f70aab8
added script to upload all text files to ceph pool
DonaldJennings Feb 11, 2024
3196564
Added asynchronous benchmarking with argparsing
DonaldJennings Feb 12, 2024
a37b86c
fixes division by zero
DonaldJennings Feb 12, 2024
a968d39
fixes typo
DonaldJennings Feb 12, 2024
8f3b07e
fixes async issue
DonaldJennings Feb 12, 2024
925b98e
default values for argparser
DonaldJennings Feb 12, 2024
a805cec
Refactor async_toggle and forbid_ndp to use boolean values
DonaldJennings Feb 12, 2024
08a6277
refactors stuff to benchmarking file
DonaldJennings Feb 13, 2024
f9d2736
adds mammoth txt file for testing
DonaldJennings Feb 13, 2024
e0f2782
Implemented skeleton for metrics based load balacner
DonaldJennings Feb 13, 2024
aab41a4
begins implementing the Metrics Collection load balancer
DonaldJennings Feb 13, 2024
cc56d6c
adds benchmark.py to collection
DonaldJennings Feb 13, 2024
ccee48c
fixes imports
DonaldJennings Feb 13, 2024
675d3f6
fixes naming conflict in the rados_func
DonaldJennings Feb 13, 2024
2af4c87
resolves all name conflicts
DonaldJennings Feb 13, 2024
1d6075c
Fixes bug in dispatch function of accessing bools before setting
DonaldJennings Feb 13, 2024
5a9d6aa
Fixes bug in dispatch function of accessing bools before setting
DonaldJennings Feb 13, 2024
64c3f0e
fixed error in throughput test
DonaldJennings Feb 13, 2024
915991c
added roundrobin
DonaldJennings Feb 13, 2024
8b9aa48
added latency to experiment
DonaldJennings Feb 13, 2024
af9e75e
prevented zero division
DonaldJennings Feb 13, 2024
99cbe6c
fixed link
DonaldJennings Feb 13, 2024
b84522e
fix
DonaldJennings Feb 13, 2024
2a58177
changed dispatch func async to return latency
DonaldJennings Feb 13, 2024
327044a
fix
DonaldJennings Feb 13, 2024
dfa7753
attempted fix of perf monitoring
DonaldJennings Feb 13, 2024
4ea417a
logging workeR
DonaldJennings Feb 13, 2024
406c24a
corrected load balancer
DonaldJennings Feb 13, 2024
ef24d83
fixed select balancer issue
DonaldJennings Feb 13, 2024
055f0c1
fix
DonaldJennings Feb 13, 2024
d164491
removed sleep
DonaldJennings Feb 13, 2024
1a0b4c0
fixed median latencies
DonaldJennings Feb 13, 2024
6f61525
fixed csv exporting
DonaldJennings Feb 13, 2024
c95d2ef
removed worker log spam
DonaldJennings Feb 13, 2024
df324d1
removed print spam responses
DonaldJennings Feb 13, 2024
0d5447a
updating benching to prevent stuff
DonaldJennings Feb 13, 2024
120bf1f
update
DonaldJennings Feb 13, 2024
8cf41b3
added lock to rr
DonaldJennings Feb 13, 2024
1a80c00
moved lock guarding to the next worker calculation
DonaldJennings Feb 13, 2024
b2da311
Fix sleep duration in batch_send function
DonaldJennings Feb 14, 2024
8ef6a66
Refactor load balancing logic and remove unnecessary code
DonaldJennings Feb 15, 2024
929060e
Merge branch 'donald-ug' of https://github.com/auto-ndp/faasm-cpp int…
DonaldJennings Feb 15, 2024
d4d11bd
Refactor code for improved performance and readability
DonaldJennings Feb 15, 2024
8221f93
fixed wordcoutn
DonaldJennings Feb 16, 2024
58e2c48
Fix dependencies in requirements.txt
DonaldJennings Feb 17, 2024
274ab22
Add dynamic worker addresses retrieval
DonaldJennings Feb 19, 2024
df59a04
Add faasm_config_exists_or_create function to endpoints.py
DonaldJennings Feb 19, 2024
207f7ed
Refactor function invocation to use dynamic host and port
DonaldJennings Feb 19, 2024
e60bfe8
Update faasm_config_exists_or_create to append to the file instead of…
DonaldJennings Feb 19, 2024
7f899d4
Update FAASM_INI_FILE path and add check for existing config file
DonaldJennings Feb 19, 2024
6ab8371
Add function to retrieve all worker addresses from configuration file
DonaldJennings Feb 19, 2024
999aa76
Update faasm_cpp_config.ini with new default values
DonaldJennings Feb 19, 2024
90d9f74
Update faasm_cpp_config.ini with worker and upload hosts
DonaldJennings Feb 19, 2024
05a99c9
Fix worker selection in WorkerHashLoadBalancerStrategy
DonaldJennings Feb 19, 2024
2a2acbb
Update all_workers in faasm_cpp_config.ini
DonaldJennings Feb 19, 2024
34bfa1c
Update all_workers in faasm_cpp_config.ini
DonaldJennings Feb 19, 2024
d25e6a7
Update faasm_cpp_config.ini and WorkerHashLoadBalancer.py
DonaldJennings Feb 20, 2024
ae6d8b3
Fix load balancing issue in WorkerHashLoadBalancer.py and benchmark.py
DonaldJennings Feb 20, 2024
2264634
Refactor load balancer initialization and use dynamic worker addresses
DonaldJennings Feb 20, 2024
666f7a9
Add print statement to RoundRobinLoadBalancerStrategy constructor and…
DonaldJennings Feb 20, 2024
9ebe74e
Update all_workers in faasm_cpp_config.ini
DonaldJennings Feb 21, 2024
20241c5
Update all_workers in faasm_cpp_config.ini
DonaldJennings Feb 21, 2024
6fe9f30
Add response printing and latency calculation
DonaldJennings Feb 21, 2024
774934b
Add 'forbid_ndp' parameter to invoke function
DonaldJennings Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"editor.tokenColorCustomizations": {
"[*Light*]": {
"textMateRules": [
{
"scope": "ref.matchtext",
"settings": {
"foreground": "#000"
}
}
]
},
"[*Dark*]": {
"textMateRules": [
{
"scope": "ref.matchtext",
"settings": {
"foreground": "#fff"
}
}
]
},
"textMateRules": [
{
"scope": "googletest.failed",
"settings": {
"foreground": "#f00"
}
},
{
"scope": "googletest.passed",
"settings": {
"foreground": "#0f0"
}
},
{
"scope": "googletest.run",
"settings": {
"foreground": "#0f0"
}
}
]
},
"cmake.configureOnOpen": false
}
Empty file added experiments/__init__.py
Empty file.
87 changes: 87 additions & 0 deletions experiments/bench_load_balancer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@

import asyncio
import argparse
import time

LOAD_BALANCE_STRATEGY = "round_robin"
FORBID_NDP = "False"
ASYNC_TOGGLED = "False"
DEFAULT_RUNS = 10

async def dispatch_func_async(user, func, input_data):
cmd = ["inv", "func.dispatch-function", user, func, input_data, LOAD_BALANCE_STRATEGY, ASYNC_TOGGLED, FORBID_NDP]
start_time = time.perf_counter()
process = await asyncio.create_subprocess_exec(*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
await process.communicate()
end_time = time.perf_counter()
return float(end_time - start_time)

async def benchmark_async(user, func, input_data, num_runs=DEFAULT_RUNS):

latencies = []

INCREMENTS = 10
for batch_size in range(1, num_runs+1, INCREMENTS):

batch_tasks = []

batch_start_time = time.perf_counter()

# Create batch of tasks
for i in range(batch_size):
task = asyncio.ensure_future(dispatch_func_async(user, func, input_data))
batch_tasks.append(task)

sleep_time = max(0, 1/i - (time.perf_counter() - batch_start_time))
await asyncio.sleep(sleep_time)

# Await batch
responses = await asyncio.gather(*batch_tasks)

for response in responses:
latencies.append((batch_size, response))

# Save results to timestamped file
timestamp = time.strftime("%Y%m%d-%H%M%S")
with open(f"./results/{timestamp}_{func}_{LOAD_BALANCE_STRATEGY}_{FORBID_NDP}", "a") as f:

# Write header containing all metadata
f.write("User,{user},\n")
f.write("Function,{func},\n")
f.write("Input Data,{input_data},\n")
f.write("Num Runs,{num_runs},\n")
f.write("Load Balance Strategy,{LOAD_BALANCE_STRATEGY},\n")
f.write("Async Toggled,{ASYNC_TOGGLED},\n")
f.write("Forbid NDP,{FORBID_NDP},\n")


f.write("Batch Size,Latency\n")
for batch_size, latency in latencies:
f.write(f"{batch_size},{latency},\n")



if __name__ == "__main__":

# Parse args (user function input_data num_runs load_balance_strategy async_toggle forbid_ndp)
arg_parser = argparse.ArgumentParser(description="Benchmark load balancer")

arg_parser.add_argument("user", help="User to invoke function as")
arg_parser.add_argument("func", help="Function to invoke")
arg_parser.add_argument("input_data", help="Input data for function")
arg_parser.add_argument("num_runs", help="Number of runs to perform", type=int, default=10)
arg_parser.add_argument("load_balance_strategy", help="Load balance strategy to use")
#arg_parser.add_argument("async_toggle", help="Toggle async behaviour", type=bool, default=False)
#arg_parser.add_argument("forbid_ndp", help="Toggle NDP", type=bool, default=False)

args = arg_parser.parse_args()

LOAD_BALANCE_STRATEGY = args.load_balance_strategy

# if args.async_toggle:
# ASYNC_TOGGLED = True
#
# if args.forbid_ndp:
# FORBID_NDP = True

asyncio.run(benchmark_async(args.user, args.func, args.input_data, args.num_runs))
Empty file added experiments/results/test.csv
Empty file.
35 changes: 35 additions & 0 deletions experiments/run_wordcount.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import time
import os
import subprocess
import asyncio

text_sources_dir = "/users/DonaldJ/faasm/cpp/experiments/text_sources/"
def run_benchmark(gutenberg_title, user, func, num_runs=10):

for i in range(num_runs):
cmd = "inv func.invoke " + user + " " + func + " \'" + gutenberg_title + "\'"
print("Command: ", cmd)
start = time.time()
subprocess.run(cmd, shell=True)
print("Time taken to run wordcount: ", time.time() - start)

async def invoke_func_async(user, func, gutenberg_title):
cmd = ["inv", "func.invoke", user, func, gutenberg_title]
process = await asyncio.create_subprocess_exec(*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
stdout, stderr = await process.communicate()
print(f'[{cmd!r} exited with {process.returncode}]')
return stdout, stderr

async def run_benchmark_async(gutenberg_title, user, func, num_runs=10):
tasks = []
for i in range(num_runs):
task = asyncio.ensure_future(invoke_func_async(user, func, gutenberg_title))
tasks.append(task)
await asyncio.sleep(1/i)

responses = await asyncio.gather(*tasks)
for response in responses:
print(response)
if __name__ == "__main__":
# Run the benchmark
run_benchmark("pride_and_prejudice", "ndp", "wordcount")
Loading