> Hi Roberto,
> great post!
>
> Just to ensure myself; I'am always uncertain if I do things the "right"
> way, special with new and unknown technology, such as websockets.
>
> If I understood your post correctly, this for my part this means, that
> django-websocket-redis, does it (almost) the "right" way. I run two loops,
> the classical for Django with workers/threads and blocking calls, and the
> websocket loop, with one thread and a gevent monkey patched Redis
> connector. The Django and the Websocket loop can communicate only via
> Redis
> to each other.
>
> The only part of that code I dislike, is the lookup from the current user
> to its groups. This requires a database access, but fortunately it is done
> only once and before entering the main loop. Anyway, it is a blocking
> call,
> and thus could be those remaining 0.00001%, which are still too much
> blocking, as you mentioned in your post. So to be safe, I should keep that
> mapping in the cache, which obviously must be filled by the separate and
> classical Django loop. This could be done using some middleware.
>
> Jacob


I think your project is good in both coverage of the problematics (you
even mention psycogreen) and in suggesting the "split" approach:
http://django-websocket-redis.readthedocs.org/en/latest/running.html#running-django-with-websockets-for-redis-behind-nginx-using-uwsgi


Very probably you can combine it with my example of offloading, so you can
avoid code duplication.

The whole point is that it is not impossible to have django cooperating
with gevent but is neither a breeze for sure

-- 
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to