From 30ab632b759e91139a877be662d148bb1aa4d46a Mon Sep 17 00:00:00 2001 From: Mark Reed <5108907+MarkReedZ@users.noreply.github.com> Date: Thu, 28 Mar 2024 16:24:12 -0400 Subject: [PATCH] Add mrhttp (#8819) * Add mrhttp * Trigger action --------- Co-authored-by: Mark Reed --- frameworks/Python/mrhttp/README.md | 20 ++++++++++++++++ frameworks/Python/mrhttp/app.py | 18 +++++++++++++++ .../Python/mrhttp/benchmark_config.json | 23 +++++++++++++++++++ frameworks/Python/mrhttp/config.toml | 15 ++++++++++++ frameworks/Python/mrhttp/mrhttp.dockerfile | 13 +++++++++++ frameworks/Python/mrhttp/requirements.txt | 6 +++++ 6 files changed, 95 insertions(+) create mode 100644 frameworks/Python/mrhttp/README.md create mode 100644 frameworks/Python/mrhttp/app.py create mode 100644 frameworks/Python/mrhttp/benchmark_config.json create mode 100644 frameworks/Python/mrhttp/config.toml create mode 100644 frameworks/Python/mrhttp/mrhttp.dockerfile create mode 100644 frameworks/Python/mrhttp/requirements.txt diff --git a/frameworks/Python/mrhttp/README.md b/frameworks/Python/mrhttp/README.md new file mode 100644 index 00000000000..ab294b9a94c --- /dev/null +++ b/frameworks/Python/mrhttp/README.md @@ -0,0 +1,20 @@ +# MrHTTP Benchmark Test + +This is the MrHTTP portion of a [benchmarking tests suite](../../) +comparing a variety of web development platforms. + +The information below is specific to MrHTTP. For further guidance, +review the [documentation](https://github.com/TechEmpower/FrameworkBenchmarks/wiki). +Also note that there is additional information provided in +the [Python README](../). + +## Description + +[MrHTTP](https://github.com/MarkReedZ/mrhttp) is an asynchronous web framework for python 3.5+ written in C that has hit 8.5 million requests per second. + +## Test Paths & Sources + +All of the test implementations are located within a single file ([app.py](app.py)). + +* [JSON Serialization](app.py): "/json" +* [Plaintext](app.py): "/plaintext" diff --git a/frameworks/Python/mrhttp/app.py b/frameworks/Python/mrhttp/app.py new file mode 100644 index 00000000000..2e91f309f25 --- /dev/null +++ b/frameworks/Python/mrhttp/app.py @@ -0,0 +1,18 @@ + +import multiprocessing +import mrhttp +import mrjson as json + +app = mrhttp.Application() + +@app.route('/json', _type="json") +def j(r): + return json.dumps({'message': 'Hello, world!'}) + +@app.route('/plaintext', _type="text", options=['cache']) +def p(r): + return "Hello, world!" + + +app.run('0.0.0.0', 8080, cores=multiprocessing.cpu_count()) + diff --git a/frameworks/Python/mrhttp/benchmark_config.json b/frameworks/Python/mrhttp/benchmark_config.json new file mode 100644 index 00000000000..8303a252e1f --- /dev/null +++ b/frameworks/Python/mrhttp/benchmark_config.json @@ -0,0 +1,23 @@ +{ + "framework": "mrhttp", + "tests": [{ + "default": { + "json_url": "/json", + "plaintext_url": "/plaintext", + "port": 8080, + "approach": "Realistic", + "classification": "Micro", + "framework": "mrhttp", + "language": "Python", + "flavor": "Python3", + "platform": "None", + "webserver": "None", + "os": "Linux", + "orm": "Raw", + "database_os": "Linux", + "database": "None", + "display_name": "MrHTTP", + "notes": "" + } + }] +} diff --git a/frameworks/Python/mrhttp/config.toml b/frameworks/Python/mrhttp/config.toml new file mode 100644 index 00000000000..f9c36bcfa78 --- /dev/null +++ b/frameworks/Python/mrhttp/config.toml @@ -0,0 +1,15 @@ +[framework] +name = "mrhttp" + +[main] +urls.plaintext = "/plaintext" +urls.json = "/json" +approach = "Realistic" +classification = "Micro" +database = "None" +database_os = "Linux" +os = "Linux" +orm = "Raw" +platform = "None" +webserver = "None" +versus = "None" diff --git a/frameworks/Python/mrhttp/mrhttp.dockerfile b/frameworks/Python/mrhttp/mrhttp.dockerfile new file mode 100644 index 00000000000..a8cb1e5b201 --- /dev/null +++ b/frameworks/Python/mrhttp/mrhttp.dockerfile @@ -0,0 +1,13 @@ + +FROM python:3.8.12 + +ADD ./ /mrhttp + +WORKDIR /mrhttp + +RUN pip3 install -r /mrhttp/requirements.txt + +EXPOSE 8080 + +CMD python3 app.py + diff --git a/frameworks/Python/mrhttp/requirements.txt b/frameworks/Python/mrhttp/requirements.txt new file mode 100644 index 00000000000..047961f9463 --- /dev/null +++ b/frameworks/Python/mrhttp/requirements.txt @@ -0,0 +1,6 @@ +asyncpg==0.25.0 +mrjson==1.4 +ujson==5.4.0 +mrpacker==1.5 +mrhttp==0.12 +uvloop==0.19.0