Skip to content

Commit

Permalink
Add mrhttp (#8819)
Browse files Browse the repository at this point in the history
* Add mrhttp

* Trigger action

---------

Co-authored-by: Mark Reed <[email protected]>
  • Loading branch information
MarkReedZ and Mark Reed authored Mar 28, 2024
1 parent e603c6c commit 30ab632
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 0 deletions.
20 changes: 20 additions & 0 deletions frameworks/Python/mrhttp/README.md
Original file line number Diff line number Diff line change
@@ -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"
18 changes: 18 additions & 0 deletions frameworks/Python/mrhttp/app.py
Original file line number Diff line number Diff line change
@@ -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())

23 changes: 23 additions & 0 deletions frameworks/Python/mrhttp/benchmark_config.json
Original file line number Diff line number Diff line change
@@ -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": ""
}
}]
}
15 changes: 15 additions & 0 deletions frameworks/Python/mrhttp/config.toml
Original file line number Diff line number Diff line change
@@ -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"
13 changes: 13 additions & 0 deletions frameworks/Python/mrhttp/mrhttp.dockerfile
Original file line number Diff line number Diff line change
@@ -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

6 changes: 6 additions & 0 deletions frameworks/Python/mrhttp/requirements.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 30ab632

Please sign in to comment.