Django channels being used instead of celery.

155 views
Skip to first unread message

Prafull Gaikwad

unread,
Mar 14, 2017, 10:24:53 PM3/14/17
to Django users
Hello everyone, 

I have a question of using Django channels. Please go through the following -

Requirement - I have a query regarding a use case of where I have a Django server communicating with multiple raspberry pis to connected to hardware probes. The Django server collects data from the pis and stores it in a database. I also have a requirement that I do not have a global IP for the raspberry pis but have one for the Django server(hosted on AWS) and would like the pis to connect to the server for communication.

Current situation - 
Currently, I am using celery where I have the Django server communicating with different celery workers hosted on different Raspberry Pis. The web application served by Django takes request from the user and updates the database collecting information from the raspberry pi. Using Celery becomes a bit complicated here as I have to have task queues in Celery broker corresponding to each raspberry pi which might be a problem while scaling it up. 

Question - 
Therefore, I wish to experiment with Django channels in this case but I cannot see a provision how can I send tasks to remote locations and get the results back.I am essentially talking about integrating Django Channels in a distributed environment where I could have consumers working remotely on different pis and Django interacts with these consumers through channels having different channels for each raspberry pi connected.

One advantage of using Celery is that it is robust as compared to channels but is noticeably slow. Moreover, the broker of the Celery framework is hosted where Django server is running and hence all the pis connect to this broker using the Django servers IP thus obviating the need to have global IPs for the pis. In my understanding, this is not possible with Django channels.

I would appreciate any suggestion of using channels in my use case keeping in account the requirement.

Thanks in advance.

Andrew Godwin

unread,
Mar 14, 2017, 10:47:40 PM3/14/17
to django...@googlegroups.com
Hi,

You could do this with channels - it also gets configured with a single central address (the Redis server, in this case) so it would be possible to run workers on each of the Pis and configure them to talk to the central Redis server.

However, depending on how reliable you want your results to be, what's retrieving them and how they are stored, I suspect what you want looks more like a slow, reliable task queue than a fast, unreliable one, and if so I would stick with Celery.

Andrew

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/71e57ca7-61db-4e92-93bd-02340ffaa819%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Melvyn Sopacua

unread,
Mar 14, 2017, 11:28:36 PM3/14/17
to django...@googlegroups.com

On Tuesday 14 March 2017 13:14:37 Prafull Gaikwad wrote:

 

> Current situation -

> Currently, I am using celery where I have the Django server

> communicating with different celery workers hosted on different

> Raspberry Pis. The web application served by Django takes request

> from the user and updates the database collecting information from

> the raspberry pi. Using Celery becomes a bit complicated here as I

> have to have task queues in Celery broker corresponding to each

> raspberry pi which might be a problem while scaling it up.

 

I don't really understand why you've turned a simple push protocol into a complicated message exchange. The pis are more then capable of keeping state of last sent data, so why not just throw it over the wire and be done with it. Let the server figure out what to do with the package.

--

Melvyn Sopacua

Reply all
Reply to author
Forward
0 new messages