Hello
On Thu, Sep 20, 2012 at 5:25 PM, mrtn <
mrtn...@gmail.com> wrote:
>
> Thank you for your advice.
>
>> Well, it's definitely possible, though I don't know if it's necessary.
>> Maybe someone else could answer about that.
>
>
> Could you please elaborate on this? Why do you think it may not be
> necessary?
Well, there are various options, like having independant worker
threads communicating via Redis. This could offload any of the
heavy-lifting and keep your app non-blocking. However, I'm still
learning about Tornado and don't pretend to be an expert on the pros
and cons to your desired setup. :)
>> As for how you'd do it. Seems like it would make sense to run them
>> both on internal ports (
127.0.0.1:8000 + 8001 for example), and use a
>> proxy daemon like HAProxy to run on port 80 and send traffic to either
>> port depending on the URIs. That's how i'd start at least.
>
>
> From what I've gathered, HAProxy does not server static files as it is only
> a proxy, where Nginx does that well but it does not work with WebSockets. So
> is there any way I can use HAProxy but also have static files served fast?
Correct, HAProxy does not serve static files. Nginx does this great,
and right now I run both on my server. HAProxy is the "front-line" and
can route all websocket traffic directly to tornado, while any static
or other non-socket traffic gets directed to Nginx to handle.
I actually just finished (a few minutes ago) a blog post on some
common setups using HAProxy with WebSockets
http://blog.silverbucket.net/post/31927044856/3-ways-to-configure-haproxy-for-websockets
And a few months ago I wrote about using Nginx in your stack:
http://blog.silverbucket.net/post/25156269990/5-reasons-to-add-nginx-to-your-lamp-stack-now
I'm not intending to just promote my posts >:D, but I think it's
directly applicable to your issue. It's basically based on the setup I
eventually came to with my project, and I think combining the topics
covered from both posts will give you the setup you're looking for.
Hope that helps!
Nick