-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Single Process #19
Comments
It would be nice for development but it feels like a low priority. When I want to run both Django and SD in one terminal I create a
(this solution does not work well with |
Any reason not to take advantage of a framework such as django-websocket-redis for the communication rather than using tornado+socketio? |
Tornado is good for dealing with web sockets and async stuff. SwampDragon is partially a result of me doing lots of different web socket projects over time. It's also good to be able to separate the two so you can serve your Django views from one server and SD on another server. You should (in theory, as I haven't fully tested this yet as there has been no need) be able to load balance SD as well. This lends it self to doing things like having Django serving up a couple of light views and having more powerful servers for SD. In short: I like working with Tornado and SockJS over Gevent and Socket.IO |
If I understand the full architecture, it would look something like:
where you can scale up both the Django or the Tornado servers? |
Well I think the author is using SockJS and not socket.io. I'll defer to Jonah of course, but it seems like the scaling happens on the tornado side. SockJS is designed to be load-balanced; it uses what amounts to "sticky sessions" so that a load balancer can connect a browser's websocket consistently to the same server. So in other words, if you have 4 quad-core servers, you could run 4 tornado instances on each of them and stick a load balancer like ha-proxy or nginx in front of them. As you need more capacity, you just add servers/tornado instances behind the load balancer. Anyway, that's my take, based on an admittedly cursory overview. |
Right, I mean
The question is whether you can also load balance on the Django side, i.e. scale out to multiple instances of Django pushingto Redis and I think the answer is yes, but wanted to check. |
My offhand response is "yes." I imagine you could follow the usual scaling rules for Django. Probably be pretty smooth unless you're Pinterest or someone similar. I know nothing about scaling Redis, but I feel sure that, first, a single instance can handle a hell of a lot, and second, there must be a clustering facility of some kind. |
Since the processes are actually separated you can easily scale either one. You could put a couple of cores off for Django and a few off for SwampDragon (Tornado), If everything was merged into one process then this would be a problem. To run both Tornado and Django using I would say for development purposes it would nice to have it, but the cost feels a bit too high. I'll close this issue for now. |
Is there anyway to use a similar approach to https://github.com/jrief/django-websocket-redis which:
That way the user can just start their server and not worry about also running the Tornado
server.py
.The text was updated successfully, but these errors were encountered: