Skip to content

Commit

Permalink
Fixed some spelling, added DefaultEncoding to README.md - Updated Per…
Browse files Browse the repository at this point in the history
…fomance Section
  • Loading branch information
math280h committed Sep 26, 2020
1 parent 6b1a379 commit 1e0c473
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,36 +35,37 @@ quick-serve has two different config files, on for defining log configuration kn
* Path - Default: /index.html - This specifies the file quick-serve should refer to if the requested resource is e.g. `/`
* SupportedMethods[]
* Array of HTTP Methods - Default: GET, PUT, HEAD, POST, DELETE, OPTIONS - This specifies what HTTP Methods is supported by quick-serve

* DefaultEncoding
* Encoding - Default UTF-8 - This specifies the encoding to use if none is specified in request headers
#### log_config.ini
This log contains configuration used by the `logger` package from python3, documentation on this config can be found here [here](https://docs.python.org/3/howto/logging.html#configuring-logging)

## Perfomance
quick-serve uses `asyncio` to handle many requests, once a connection is accepted it's moved into it's own task.

````
Requests per second: 9192.41 [#/sec] (mean)
Time per request: 54.393 [ms] (mean)
Time per request: 0.109 [ms] (mean, across all concurrent requests)
Transfer rate: 445.31 [Kbytes/sec] received
Requests per second: 9270.46 [#/sec] (mean)
Time per request: 32.361 [ms] (mean)
Time per request: 0.108 [ms] (mean, across all concurrent requests)
Transfer rate: 371.97 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 23 3.2 23 60
Processing: 4 31 11.6 24 91
Waiting: 0 12 14.6 0 72
Total: 19 54 12.0 49 120
Connect: 0 10 2.1 10 27
Processing: 2 21 16.0 10 54
Waiting: 0 12 17.1 0 45
Total: 4 32 16.3 21 72
Percentage of the requests served within a certain time (ms)
50% 49
66% 62
75% 65
80% 67
90% 70
95% 73
98% 76
99% 79
100% 120 (longest request)
50% 21
66% 48
75% 52
80% 53
90% 55
95% 57
98% 58
99% 59
100% 72 (longest request)
````

## Testing
Expand All @@ -75,9 +76,9 @@ pip3 install -r dev-requirements.txt

First make sure that the server is running locally on `127.0.0.1:80` then you can follow the below guide to run the tests.

All tests are located `src/tests` and can be run by using the following command inside the directory:
All tests are located `tests` and can be run by using the following command inside the directory:
```commandline
python -m unittest discover
python -m unittest discover tests
```

### Current tests
Expand Down
2 changes: 1 addition & 1 deletion quick_serve/modules/messenger.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async def get_headers(self, code: str, content_length=0, content_type="text/html
:param allow: Send Allow Header (Used for 'OPTIONS' Request)
:return: Headers as string
"""
headers = "HTTP/{} {}\r\nServer: quick_serve\r\n".format(self.config.options.get("Server", "HttpVersion"), code)
headers = "HTTP/{} {}\r\nServer: quick-serve\r\n".format(self.config.options.get("Server", "HttpVersion"), code)
if content_length != 0: # If Content-Length is present, append header
headers += "Content-Length: {}\r\nContent-Type: {}\r\n".format(content_length, content_type)
if allow is not None: # If Allow is present, append header
Expand Down
2 changes: 1 addition & 1 deletion tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_headers(self):
"""
req = requests.options("http://{}:{}".format(self.config.options.get("Server", "ListenAddress"), self.config.options.get("Server", "Port")))

self.assertEqual(req.headers, {'Server': 'quick_serve', 'Allow': 'GET, PUT, HEAD, POST, DELETE, OPTIONS'})
self.assertEqual(req.headers, {'Server': 'quick-serve', 'Allow': 'GET, PUT, HEAD, POST, DELETE, OPTIONS'})

def test_connection(self):
"""
Expand Down

0 comments on commit 1e0c473

Please sign in to comment.