mirror of
https://github.com/django/daphne.git
synced 2025-07-29 00:19:45 +03:00
Mention RabbitMQ layer in the docs. (#608)
This commit is contained in:
parent
5445d317fd
commit
5e96e3c176
|
@ -29,7 +29,8 @@ Support can be obtained either here via issues, or in the ``#django-channels``
|
|||
channel on Freenode.
|
||||
|
||||
You can install channels from PyPI as the ``channels`` package.
|
||||
You'll likely also want to ``asgi_redis`` to provide the Redis channel layer.
|
||||
You'll likely also want to install ``asgi_redis`` or ``asgi_rabbitmq``
|
||||
to provide the Redis/RabbitMQ channel layer correspondingly.
|
||||
See our `installation <https://channels.readthedocs.io/en/latest/installation.html>`_
|
||||
and `getting started <https://channels.readthedocs.io/en/latest/getting-started.html>`_ docs for more.
|
||||
|
||||
|
@ -78,4 +79,5 @@ The Channels project is made up of several packages; the others are:
|
|||
* `Daphne <https://github.com/django/daphne/>`_, the HTTP and Websocket termination server
|
||||
* `asgiref <https://github.com/django/asgiref/>`_, the base ASGI library/memory backend
|
||||
* `asgi_redis <https://github.com/django/asgi_redis/>`_, the Redis channel backend
|
||||
* `asgi_rabbitmq <https://github.com/proofit404/asgi_rabbitmq/>`_, the RabbitMQ channel backend
|
||||
* `asgi_ipc <https://github.com/django/asgi_ipc/>`_, the POSIX IPC channel backend
|
||||
|
|
|
@ -3,6 +3,7 @@ from distutils.version import StrictVersion
|
|||
|
||||
|
||||
required_versions = {
|
||||
"asgi_rabbitmq": "0.4.0",
|
||||
"asgi_redis": "1.2.0",
|
||||
"asgi_ipc": "1.3.0",
|
||||
}
|
||||
|
@ -21,7 +22,7 @@ def check_all():
|
|||
try:
|
||||
module = importlib.import_module(package)
|
||||
except ImportError:
|
||||
return
|
||||
continue
|
||||
else:
|
||||
if StrictVersion(version) > StrictVersion(module.__version__):
|
||||
raise RuntimeError("Your version of %s is too old - it must be at least %s" % (
|
||||
|
|
|
@ -54,6 +54,31 @@ the consistent hashing model relies on all running clients having the same
|
|||
settings. Any misconfigured interface server or worker will drop some or all
|
||||
messages.
|
||||
|
||||
RabbitMQ
|
||||
--------
|
||||
|
||||
RabbitMQ layer is comparable to Redis in terms of latency and
|
||||
throughput. It can work with single RabbitMQ node and with Erlang
|
||||
cluster.
|
||||
|
||||
You need to install layer package from PyPI::
|
||||
|
||||
pip install -U asgi_rabbitmq
|
||||
|
||||
To use it you also need provide link to the virtual host with granted
|
||||
permissions::
|
||||
|
||||
CHANNEL_LAYERS = {
|
||||
"default": {
|
||||
"BACKEND": "asgi_rabbitmq.RabbitmqChannelLayer",
|
||||
"ROUTING": "???",
|
||||
"CONFIG": {
|
||||
"url": "amqp://guest:guest@rabbitmq:5672/%2F",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
This layer has complete `documentation <http://asgi-rabbitmq.readthedocs.io/en/latest/>`_ on its own.
|
||||
|
||||
IPC
|
||||
---
|
||||
|
|
|
@ -22,6 +22,7 @@ of the Channels sub-projects:
|
|||
* `Daphne issues <https://github.com/django/daphne/issues/>`_, for the HTTP and Websocket termination
|
||||
* `asgiref issues <https://github.com/django/asgiref/issues/>`_, for the base ASGI library/memory backend
|
||||
* `asgi_redis issues <https://github.com/django/asgi_redis/issues/>`_, for the Redis channel backend
|
||||
* `asgi_rabbitmq <https://github.com/proofit404/asgi_rabbitmq/>`_, for the RabbitMQ channel backend
|
||||
* `asgi_ipc issues <https://github.com/django/asgi_ipc/issues/>`_, for the POSIX IPC channel backend
|
||||
|
||||
Issues are categorized by difficulty level:
|
||||
|
|
|
@ -79,6 +79,19 @@ Make sure the same settings file is used across all your workers and interface
|
|||
servers; without it, they won't be able to talk to each other and things
|
||||
will just fail to work.
|
||||
|
||||
If you prefer to use RabbitMQ layer, please refer to its
|
||||
`documentation <http://asgi-rabbitmq.readthedocs.io/en/latest/>`_.
|
||||
Usually your config will end up like this::
|
||||
|
||||
CHANNEL_LAYERS = {
|
||||
"default": {
|
||||
"BACKEND": "asgi_rabbitmq.RabbitmqChannelLayer",
|
||||
"ROUTING": "my_project.routing.channel_routing",
|
||||
"CONFIG": {
|
||||
"url": "amqp://guest:guest@rabbitmq:5672/%2F",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Run worker servers
|
||||
------------------
|
||||
|
|
|
@ -29,6 +29,7 @@ Channels is comprised of five packages:
|
|||
* `Daphne <https://github.com/django/daphne/>`_, the HTTP and Websocket termination server
|
||||
* `asgiref <https://github.com/django/asgiref/>`_, the base ASGI library/memory backend
|
||||
* `asgi_redis <https://github.com/django/asgi_redis/>`_, the Redis channel backend
|
||||
* `asgi_rabbitmq <https://github.com/proofit404/asgi_rabbitmq/>`_, the RabbitMQ channel backend
|
||||
* `asgi_ipc <https://github.com/django/asgi_ipc/>`_, the POSIX IPC channel backend
|
||||
|
||||
This documentation covers the system as a whole; individual release notes and
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Django Channels Load Testing Results for (2016-09-06)
|
||||
===============
|
||||
=====================================================
|
||||
|
||||
The goal of these load tests is to see how Channels performs with normal HTTP traffic under heavy load.
|
||||
|
||||
|
@ -11,7 +11,7 @@ comparison to a WSGI HTTP server. Gunincorn was chosen as its configuration was
|
|||
|
||||
|
||||
Summary of Results
|
||||
~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Daphne is not as efficient as its WSGI counterpart. When considering only latency, Daphne can have 10 times the latency
|
||||
when under the same traffic load as gunincorn. When considering only throughput, Daphne can have 40-50% of the total
|
||||
|
@ -29,7 +29,7 @@ Some additional things that should be tested:
|
|||
|
||||
|
||||
Methodology
|
||||
~~~~~~~~~~~~
|
||||
~~~~~~~~~~~
|
||||
|
||||
In order to control for variances, several measures were taken:
|
||||
|
||||
|
@ -42,7 +42,7 @@ In order to control for variances, several measures were taken:
|
|||
|
||||
|
||||
Setups
|
||||
~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
|
||||
3 setups were used for this set of tests:
|
||||
|
||||
|
@ -52,7 +52,7 @@ Setups
|
|||
|
||||
|
||||
Latency
|
||||
~~~~~~~~~~~~
|
||||
~~~~~~~
|
||||
|
||||
All target and sources machines were identical ec2 instances m3.2xlarge running Ubuntu 16.04.
|
||||
|
||||
|
@ -63,7 +63,7 @@ In order to ensure that the same number of requests were sent, the rps flag was
|
|||
|
||||
|
||||
Throughput
|
||||
~~~~~~~~~~~~
|
||||
~~~~~~~~~~
|
||||
|
||||
The same source machine was used for all tests: ec2 instance m3.large running Ubuntu 16.04.
|
||||
All target machines were identical ec2 instances m3.2xlarge running Ubuntu 16.04.
|
||||
|
@ -77,7 +77,7 @@ Gunicorn had a latency of 6 ms; daphne and Redis, 12 ms; daphne and IPC, 35 ms.
|
|||
|
||||
|
||||
Supervisor Configs
|
||||
~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Gunicorn (19.6.0)**
|
||||
|
||||
|
@ -89,7 +89,7 @@ This is the non-channels config. It's a standard Django environment on one machi
|
|||
command = gunicorn testproject.wsgi_no_channels -b 0.0.0.0:80
|
||||
directory = /srv/channels/testproject/
|
||||
user = root
|
||||
|
||||
|
||||
[group:django_http]
|
||||
programs=gunicorn
|
||||
priority=999
|
||||
|
@ -107,13 +107,13 @@ Also, it's a single worker, not multiple, as that's the default config.
|
|||
command = daphne -b 0.0.0.0 -p 80 testproject.asgi:channel_layer
|
||||
directory = /srv/channels/testproject/
|
||||
user = root
|
||||
|
||||
|
||||
[program:worker]
|
||||
command = python manage.py runworker
|
||||
directory = /srv/channels/testproject/
|
||||
user = django-channels
|
||||
|
||||
|
||||
|
||||
|
||||
[group:django_channels]
|
||||
programs=daphne,worker
|
||||
priority=999
|
||||
|
@ -130,13 +130,13 @@ This is the channels config using IPC (Inter Process Communication). It's only p
|
|||
command = daphne -b 0.0.0.0 -p 80 testproject.asgi_for_ipc:channel_layer
|
||||
directory = /srv/channels/testproject/
|
||||
user = root
|
||||
|
||||
|
||||
[program:worker]
|
||||
command = python manage.py runworker --settings=testproject.settings.channels_ipc
|
||||
directory = /srv/channels/testproject/
|
||||
user = root
|
||||
|
||||
|
||||
|
||||
|
||||
[group:django_channels]
|
||||
programs=daphne,worker
|
||||
priority=999
|
||||
|
|
Loading…
Reference in New Issue
Block a user