Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexhill/django_channels_test
https://github.com/alexhill/django_channels_test
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/alexhill/django_channels_test
- Owner: AlexHill
- Created: 2020-11-19T03:21:36.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2020-11-24T03:32:36.000Z (about 4 years ago)
- Last Synced: 2024-11-07T09:51:46.702Z (about 2 months ago)
- Language: Python
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This repository is a sample Django project to help test some issues with channels/uvicorn/gunicorn. It has a single view configured at `/delay//` which will time.sleep for `ms` and return 200.
`load_test.py` takes two arguments, `concurrency` and `requests`. It will hit the `/delay/` endpoint with a sequence of request with random delays between 0 and 1 second. The random generator is seeded with 0 before each run, so subsequent runs test the same thing. It prints some statistics on the request results.
# Install dependencies
Install the required dependencies with:
```
python3 -mvenv env
env/bin/pip install --upgrade pip setuptools
env/bin/pip install "django<3" channels uvicorn gunicorn requests
```# Test scenarios
## 1. Channels returns 500s when workers > 1
Start the server:
```
make asgi
```Hit the server with 10 requests and concurrency 10:
```
env/bin/python load_test.py 10 10
```Observe a bunch of errors in your web server log output.
Now run ten requests with concurrency 1:
```
env/bin/python load.test 1 10
```And see that all is well.