Skip to content

Commit

Permalink
Various toolset fixes and updates (#8951)
Browse files Browse the repository at this point in the history
* Fix the MongoDB Docker image
* Update the toolset Docker images to Ubuntu 24.04
* Update Dool to version 1.3.1
* Fix any warnings that are printed by the toolset scripts
  • Loading branch information
volyrique authored May 6, 2024
1 parent 97acf13 commit bda05af
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 59 deletions.
25 changes: 12 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM ubuntu:24.04

ARG DEBIAN_FRONTEND=noninteractive
# WARNING: DON'T PUT A SPACE AFTER ANY BACKSLASH OR APT WILL BREAK
Expand All @@ -20,22 +20,21 @@ RUN apt-get -yqq update && \
python3 \
python3-dev \
python3-pip \
python3-psutil \
python3-psycopg2 \
python3-requests \
siege \
software-properties-common

RUN pip3 install \
software-properties-common && \
# Ubuntu's equivalent packages are too old and/or broken.
pip3 install \
--break-system-packages \
colorama==0.3.1 \
docker==4.0.2 \
mysqlclient \
psutil \
psycopg2-binary \
pymongo==3.13.0 \
# urllib3 incompatibility:
# https://github.com/docker/docker-py/issues/3113#issuecomment-1525500104
requests==2.28.1
docker==7.0.0 \
mysqlclient==2.2.4 \
pymongo==3.13.0

# Collect resource usage statistics
ARG DOOL_VERSION=v1.2.0
ARG DOOL_VERSION=v1.3.1

WORKDIR /tmp
RUN curl -LSs "https://github.com/scottchiefbaker/dool/archive/${DOOL_VERSION}.tar.gz" | \
Expand Down
8 changes: 2 additions & 6 deletions frameworks/Rust/trillium/benchmark_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
"notes": "",
"versus": "None",
"tags": ["verified"]
}
},
{
},
"async-std": {
"db_url": "/db",
"json_url": "/json",
Expand All @@ -54,9 +52,7 @@
"notes": "",
"versus": "None",
"tags": ["verified"]
}
},
{
},
"tokio": {
"db_url": "/db",
"json_url": "/json",
Expand Down
10 changes: 6 additions & 4 deletions toolset/databases/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import imp
import importlib
import re

from colorama import Fore
Expand All @@ -14,14 +14,16 @@
# regex that grabs the characters between "toolset/database/"
# and the final "/" in the db folder string to get the db name
db_name = re.findall(r'.+\/(.+)\/$', folder, re.M)[0]
# ignore generate __pycache__ folder
# ignore generated __pycache__ folder
if db_name == '__pycache__':
continue
db = imp.load_source("Database", "%s%s.py" % (folder, db_name))
spec = importlib.util.spec_from_file_location("Database", "%s%s.py" % (folder, db_name))
db = importlib.util.module_from_spec(spec)
spec.loader.exec_module(db)

if not hasattr(db.Database, "get_current_world_table")\
or not hasattr(db.Database, "test_connection"):
log("Database %s does not implement the required methods" + db_name,
log("Database %s does not implement the required methods" % (db_name),
color=Fore.RED)

databases[db_name] = db.Database
6 changes: 3 additions & 3 deletions toolset/databases/abstract_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AbstractDatabase:
'''
#margin of tolerance on the results (rows read or updated only)
margin = 1.011

@classmethod
@abc.abstractmethod
def get_connection(cls, config):
Expand Down Expand Up @@ -94,13 +94,13 @@ def verify_queries(cls, config, table_name, url, concurrency=512, count=2, check
process = subprocess.run(shlex.split(
"siege -c %s -r %s %s -R %s/.siegerc" % (concurrency, count, url, path)),
stdout = subprocess.PIPE, stderr = subprocess.STDOUT, timeout=20, text=True
)
)
except subprocess.TimeoutExpired as e:
print("Verification failed: %s" % (e))
else:
output = process.stdout
#Search for failed transactions
match = re.search('Failed transactions:.*?(\d+)\n', output, re.MULTILINE)
match = re.search(r'Failed transactions:.*?(\d+)\n', output, re.MULTILINE)
if match:
trans_failures = int(match.group(1))
print(output)
Expand Down
1 change: 0 additions & 1 deletion toolset/databases/mongodb/create.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
disableTelemetry()
db = db.getSiblingDB('hello_world')
db.world.drop()
for (var i = 1; i <= 10000; i++) {
Expand Down
2 changes: 1 addition & 1 deletion toolset/databases/mongodb/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_connection(cls, config):
connection = cls.get_connection(config)
db = connection.hello_world
db.world.find()
db.close()
connection.close()
return True
except:
return False
Expand Down
6 changes: 4 additions & 2 deletions toolset/test_types/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import imp
import importlib
import re

from glob import glob
Expand All @@ -14,5 +14,7 @@
# ignore generated __pycache__ folder
if test_type_name == '__pycache__':
continue
test_type = imp.load_source("TestType", "%s%s.py" % (folder, test_type_name))
spec = importlib.util.spec_from_file_location("TestType", "%s%s.py" % (folder, test_type_name))
test_type = importlib.util.module_from_spec(spec)
spec.loader.exec_module(test_type)
test_types[test_type_name] = test_type.TestType
56 changes: 28 additions & 28 deletions toolset/utils/scaffolding.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Scaffolding:
def __init__(self, benchmarker):
print("""
-------------------------------------------------------------------------------
This wizard is intended to help build the scaffolding required for a new
This wizard is intended to help build the scaffolding required for a new
test to be benchmarked.
From here, you will be prompted for values related to the test you
Expand Down Expand Up @@ -87,12 +87,12 @@ def __prompt_language(self):

print("""
That language is not currently in our list of known languages.
Here is a list of similar languages present in our benchmark suite that you
may have meant:
%s
Did you mean to add the new language, '%s', to the benchmark suite?
""" % (similar, self.language))
valid = self.__prompt_confirm_new_language()
Expand All @@ -115,8 +115,8 @@ def __gather_approach(self):
print("""
The approach of your test implementation.
1) Realistic: Uses the framework with most out-of-the-box functionality
enabled. We consider this realistic because most applications
1) Realistic: Uses the framework with most out-of-the-box functionality
enabled. We consider this realistic because most applications
built with the framework will leave these features enabled.
2) Stripped: Removes or outright avoids implementing features that are
unnecessary for the particulars of the benchmark exercise. This
Expand All @@ -143,14 +143,14 @@ def __gather_classification(self):
print("""
The classification of your test implementation.
1) Fullstack: Robust framework expected to provide high-level functionality
for serving as a web application; for example, ability to
compose views, provide functions for responding with several
data types (json, html, etc), connecting to a database, form
1) Fullstack: Robust framework expected to provide high-level functionality
for serving as a web application; for example, ability to
compose views, provide functions for responding with several
data types (json, html, etc), connecting to a database, form
processing, etc.
2) Micro: Simple framework expected to provide enough middleware to build
a robust web application such as request routing and some
simple plumbing, but may not include built-in functionality
a robust web application such as request routing and some
simple plumbing, but may not include built-in functionality
such as, for example, server-composed views.
3) Platform: Barebones infrastructure for servicing HTTP requests, but does
not include a framework at all.
Expand Down Expand Up @@ -181,7 +181,7 @@ def __gather_platform(self):
print("""
The platform of your test implementation.
The platform is the low-level software or API used to host web applications
The platform is the low-level software or API used to host web applications
for the framework; the platform provides an implementation of the HTTP
fundamentals.
Expand Down Expand Up @@ -233,11 +233,11 @@ def __gather_orm(self):
print("""
How you would classify the ORM (object relational mapper) of your test?
1) Full: A feature-rich ORM which provides functionality for interacting
with a database without writing a query in all but the most edge
1) Full: A feature-rich ORM which provides functionality for interacting
with a database without writing a query in all but the most edge
cases.
2) Micro: An ORM which provides functionality for interacting with a database
for many trivial operations (querying, updating), but not more
for many trivial operations (querying, updating), but not more
robust cases (for example, gathering relations).
3) Raw: No ORM; raw database access.
""")
Expand Down Expand Up @@ -277,9 +277,9 @@ def __gather_versus(self):
print("""
The name of another test (elsewhere in this project) that is a subset of this
framework.
This allows for the generation of the framework efficiency chart in the
This allows for the generation of the framework efficiency chart in the
results web site.
For example, Compojure is compared to "servlet" since Compojure is built on
For example, Compojure is compared to "servlet" since Compojure is built on
the Servlet platform.
Example: Servlet, Wai, Undertow
Expand Down Expand Up @@ -344,31 +344,31 @@ def __copy_scaffold_files(self):
def __edit_scaffold_files(self):
for file in os.listdir(os.path.join(self.test_dir)):
self.__replace_text(
os.path.join(self.test_dir, file), "\$NAME", self.name)
os.path.join(self.test_dir, file), r'\$NAME', self.name)
self.__replace_text(
os.path.join(self.test_dir, file), "\$DISPLAY_NAME",
os.path.join(self.test_dir, file), r'\$DISPLAY_NAME',
self.display_name)
self.__replace_text(
os.path.join(self.test_dir, file), "\$APPROACH", self.approach)
os.path.join(self.test_dir, file), r'\$APPROACH', self.approach)
self.__replace_text(
os.path.join(self.test_dir, file), "\$CLASSIFICATION",
os.path.join(self.test_dir, file), r'\$CLASSIFICATION',
self.classification)
self.__replace_text(
os.path.join(self.test_dir, file), "\$FRAMEWORK",
os.path.join(self.test_dir, file), r'\$FRAMEWORK',
self.framework)
self.__replace_text(
os.path.join(self.test_dir, file), "\$LANGUAGE", self.language)
os.path.join(self.test_dir, file), r'\$LANGUAGE', self.language)
self.__replace_text(
os.path.join(self.test_dir, file), "\$DATABASE", self.database)
os.path.join(self.test_dir, file), r'\$DATABASE', self.database)
self.__replace_text(
os.path.join(self.test_dir, file), "\$ORM", self.orm)
os.path.join(self.test_dir, file), r'\$ORM', self.orm)
self.__replace_text(
os.path.join(self.test_dir, file), "\$PLATFORM", self.platform)
os.path.join(self.test_dir, file), r'\$PLATFORM', self.platform)
self.__replace_text(
os.path.join(self.test_dir, file), "\$WEBSERVER",
os.path.join(self.test_dir, file), r'\$WEBSERVER',
self.webserver)
self.__replace_text(
os.path.join(self.test_dir, file), "\$VERSUS", self.versus)
os.path.join(self.test_dir, file), r'\$VERSUS', self.versus)

def __print_success(self):
print("""
Expand Down
2 changes: 1 addition & 1 deletion toolset/wrk/wrk.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM ubuntu:24.04

# Required scripts for benchmarking
COPY concurrency.sh pipeline.lua pipeline.sh query.sh ./
Expand Down

0 comments on commit bda05af

Please sign in to comment.