> Hi list,
>
> So as we know traditional web server is stateless, e.g. each request is
> answered by an individuale process
>
> In more powerful modern sites often some site-wide long running connection
> is needed, e.g. db connection pools, and in my case a XMPP connection.
>
> So when user invokes some URL in a django view, I'd like to issue some
> XMPP
> commands, start an XMPP connection syncrhonously is slow, so I am thinking
> of a async way, serveral XMPP connection should always be present in a
> pool
> and ready to use.
>
> But to maintain a well established XMPP connection is pain for system
> administration and deploy.
>
> So I thought of uWSGI again. Any ideas if uWSGI suitable for this kind of
> task?
>
> Thank you all!
> _______________________________________________
>
If your view does not need to wait for the xmpp response before generating
the output i would open xmpp connections in mules (one connection
per-mule) and simply send messages to them from the django view:
# in the view
uwsgi.mule_msg('xmpp message')
# in mules
while(True):
msg = mule_get_msg()
xmpp.send(msg)
you can spawn multiple mules each one opening a connection. The first
available mules will get the message or it will be enqueued til a mule is
free.
If instead, you need to wait for xmpp response in the view, i see no other
solutions than moving to gevent, but you need to use a gevent-friendly
database adapter for django as well as a gevent-friendly xmpp-library
--
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi