Comments (8)
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 run.sh
file and add the following:
#!/bin/bash
python server.py &
python manage.py runserver &
trap "kill -TERM -$$" SIGINT
wait
(this solution does not work well with pdb
/ ipdb
).
from swampdragon.
Any reason not to take advantage of a framework such as django-websocket-redis for the communication rather than using tornado+socketio?
from swampdragon.
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.
I used to go with gevent and Socket.io but over time I've come to like SockJS more.
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
from swampdragon.
If I understand the full architecture, it would look something like:
(N x Django) <---> Redis <---> (M x Tornado+Socket.io) <---ws---> browsers
where you can scale up both the Django or the Tornado servers?
from swampdragon.
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.
from swampdragon.
Right, I mean SockJS
:
(N x Django) <---> Redis <---> (M x Tornado+SockJS) <---ws---> load balancer <---ws--> browsers
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.
from swampdragon.
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.
from swampdragon.
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 python manage.py runserver
you would have to do some hacky bits to start both at the same time.
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.
from swampdragon.
Related Issues (20)
- how to implement swampdragon properly
- ERROR:tornado.general:WebSocket ... DoesNotExist: TodoList matching query does not exist.
- Settings.js HOT 3
- Synchronize Swampdragon in django cluster
- [frontend] How to handle arriving messages published to concrete channel HOT 6
- 0.4.2.2 issues w/ tutorial psutil HOT 7
- Todo tutorial - route not found HOT 2
- Idea: add template tag to make template parts update in realtime HOT 7
- has_related_value HOT 1
- Release version does not work with Django1.9 HOT 3
- settings.js not found HOT 2
- unit test does not support for auth
- How to avoid 'false' SwampDragon messages
- takeover
- Site can't be reached!? HOT 6
- Connection Swampdragon to a Redis Socket HOT 1
- About swampdragon.net HOT 1
- swampdragon.net site is down HOT 1
- I will to take this site maintanance and also to update it
- Private chat implementation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swampdragon.