(Migrated) Zato as HTTP load-balancer and app server

(This message has been automatically imported from the retired mailing list)

Hi

I am new to Zato, and looking at using it to serve as an HTTP 'entrypoint’
to a server that serves different Django apps at different host names. Ex.
app1.myhostname.com, app2.myhostname.com

app1 and app2 have seperate codebases, ie not multiple instances of the
same app.

We dont really have a need for load-balancing (multiple instances of app1
and app2) but may want to do so in future.

Currently we use Apache to inspect the hostname and direct HTTP traffic to
the correct app.

Is Apache still the best way to do this? If we would like to use Zato as
described above, is it possible to generate Apache style access logs, at
the load balancer or at the app level?

I will by trying this out, but any pointers to help me along would be
appreciated.

Riaan

In my opinion you should deploy your django apps with nginx + uwsgi or
nginx + gunicorn. Zato is not intended to do so since it’s an ESB, you
could use it to develop apps but not for django, just for Zato as services

On Mon, Jan 27, 2014 at 3:18 AM, Riaan van den Dool
riaanvddool@gmail.comwrote:

Oh, I just found my answer on the blog: :slight_smile:

https://zato.io/blog/posts/http-access-log.html

On Mon, Jan 27, 2014 at 10:15 AM, Riaan van den Dool <
riaanvddool@gmail.com> wrote:

Hi

I am new to Zato, and looking at using it to serve as an HTTP
’entrypoint’ to a server that serves different Django apps at different
host names. Ex. app1.myhostname.com, app2.myhostname.com

app1 and app2 have seperate codebases, ie not multiple instances of the
same app.

We dont really have a need for load-balancing (multiple instances of app1
and app2) but may want to do so in future.

Currently we use Apache to inspect the hostname and direct HTTP traffic
to the correct app.

Is Apache still the best way to do this? If we would like to use Zato as
described above, is it possible to generate Apache style access logs, at
the load balancer or at the app level?

I will by trying this out, but any pointers to help me along would be
appreciated.

Riaan

Oh, I just found my answer on the blog: :slight_smile:

https://zato.io/blog/posts/http-access-log.html

On Mon, Jan 27, 2014 at 10:15 AM, Riaan van den Dool
riaanvddool@gmail.comwrote:

Hi

I am new to Zato, and looking at using it to serve as an HTTP 'entrypoint’
to a server that serves different Django apps at different host names. Ex.
app1.myhostname.com, app2.myhostname.com

app1 and app2 have seperate codebases, ie not multiple instances of the
same app.

We dont really have a need for load-balancing (multiple instances of app1
and app2) but may want to do so in future.

Currently we use Apache to inspect the hostname and direct HTTP traffic to
the correct app.

Is Apache still the best way to do this? If we would like to use Zato as
described above, is it possible to generate Apache style access logs, at
the load balancer or at the app level?

I will by trying this out, but any pointers to help me along would be
appreciated.

Riaan

With nginx you could get simple load balancing capabilities plus
performance increased in conjunction with uwsgi, just configuring an
upstream with all of your servers an then using it on the proxy_pass(for
whatever server you want, ie gunicorn, apache,tomcat) or uwsgi_pass(if you
use uwsgi as a wsgi server for your django apps).

In fact I think that Zato itself should consider to move in this direction
taking performance into account, this reduce the need of software
components running, since:
1- nginx can serve static files for django zato-webadmin,
2- nginx can talk to unix sockets so local servers can be deployed without
having to open ports
3- nginx have native support for uwsgi using a binary protocol
4- uwsgi seems to have better performance than gunicorn in the last versions
5- uwsgi can serve many differents wsgi apps with only one running instance
running as Emperor, this can be used to serve servers app and also django
zato-webadmin
6- nginx loadbalancer can be substitute haproxy in this terms

this is just a few ideas, to improve the performance of Zato

Cheers

On Mon, Jan 27, 2014 at 11:12 AM, Dariusz Suchojad dsuch@zato.io wrote:

On 01/27/2014 03:35 PM, Axel Mendoza Pupo wrote:

In my opinion you should deploy your django apps with nginx + uwsgi or
nginx + gunicorn. Zato is not intended to do so since it’s an ESB, you
could use it to develop apps but not for django, just for Zato as
services

Well, you know, the load-balancer is an embedded HAProxy instance so
there’s nothing really preventing anyone from using it for other
purposes as well.

There wouldn’t be much support from Zato as such but still, HAProxy is
precisely meant to distribute the traffic across servers so as long as
one doesn’t interfere with Zato’s own configuration they should be ready
to use the LB as is. In HAProxy terms, you just need to use different
frontends and backends.

Here’s a link to a discussion regarding log formats in HAProxy.

http://comments.gmane.org/gmane.comp.web.haproxy/5169

But just to make sure, one would simply be using HAProxy at that point
merely taking advantage of the fact that its configuration can be
updated remotely using the source code view.

https://zato.io/docs/web-admin/load-balancer/source-code.html

So I wouldn’t reject the idea as long as we understood this is just
making use of a convenient fact that HAProxy is already there.

I am not too clued up on http servers other than Apache. Can you give a
reason why nginx + uwsgi / gunicorn rather than Apache +
mod_wsgi?

you could read it on:


http://justcramer.com/2013/06/27/serving-python-web-applications/
http://nichol.as/benchmark-of-python-web-servers

On Mon, Jan 27, 2014 at 1:36 PM, Riaan van den Dool
riaanvddool@gmail.comwrote:

In my opinion you should deploy your django apps with nginx + uwsgi or nginx

  • gunicorn.

I am not too clued up on http servers other than Apache. Can you give a
reason why nginx + uwsgi / gunicorn rather than Apache + mod_wsgi?

Zato is not intended to do so since it’s an ESB, you could use it to
develop apps but not for django, just for Zato as services

If each app has its own http server then they are just services listening
to requests coming in on the ESB and responding to those requests, right?

I realize an ESB might sound like an overkill in this case, but there are
other components in the system that would also benefit from the ESB. So my
question is really: if I have the ESB available, can I use it to route
traffic to the two apps based on host name? Do not assume the load balancer
and web apps are on the same machine in this configuration.

Sorry if my questions sound naive, I do not have a lot of SOA / ESB
experience.

R

On Mon, Jan 27, 2014 at 7:20 PM, Axel Mendoza Pupo aekroft@gmail.comwrote:

With nginx you could get simple load balancing capabilities plus
performance increased in conjunction with uwsgi, just configuring an
upstream with all of your servers an then using it on the proxy_pass(for
whatever server you want, ie gunicorn, apache,tomcat) or uwsgi_pass(if you
use uwsgi as a wsgi server for your django apps).

In fact I think that Zato itself should consider to move in this
direction taking performance into account, this reduce the need of software
components running, since:
1- nginx can serve static files for django zato-webadmin,
2- nginx can talk to unix sockets so local servers can be deployed
without having to open ports
3- nginx have native support for uwsgi using a binary protocol
4- uwsgi seems to have better performance than gunicorn in the last
versions
5- uwsgi can serve many differents wsgi apps with only one running
instance running as Emperor, this can be used to serve servers app and also
django zato-webadmin
6- nginx loadbalancer can be substitute haproxy in this terms

this is just a few ideas, to improve the performance of Zato

Cheers

On Mon, Jan 27, 2014 at 11:12 AM, Dariusz Suchojad dsuch@zato.io wrote:

On 01/27/2014 03:35 PM, Axel Mendoza Pupo wrote:

In my opinion you should deploy your django apps with nginx + uwsgi or
nginx + gunicorn. Zato is not intended to do so since it’s an ESB, you
could use it to develop apps but not for django, just for Zato as
services

Well, you know, the load-balancer is an embedded HAProxy instance so
there’s nothing really preventing anyone from using it for other
purposes as well.

There wouldn’t be much support from Zato as such but still, HAProxy is
precisely meant to distribute the traffic across servers so as long as
one doesn’t interfere with Zato’s own configuration they should be ready
to use the LB as is. In HAProxy terms, you just need to use different
frontends and backends.

Here’s a link to a discussion regarding log formats in HAProxy.

http://comments.gmane.org/gmane.comp.web.haproxy/5169

But just to make sure, one would simply be using HAProxy at that point
merely taking advantage of the fact that its configuration can be
updated remotely using the source code view.

https://zato.io/docs/web-admin/load-balancer/source-code.html

So I wouldn’t reject the idea as long as we understood this is just
making use of a convenient fact that HAProxy is already there.

actually, this week I finish a setup using this config
nginx + gunicorn [worker_class = ‘gevent’] + django app

so yes it can be serve gevent-based apps

On Mon, Jan 27, 2014 at 1:56 PM, Dariusz Suchojad dsuch@zato.io wrote:

On 01/27/2014 07:52 PM, Axel Mendoza Pupo wrote:

you could read it on:

https://www.digitalocean.com/community/articles/django-server-comparison-the-development-server-mod_wsgi-uwsgi-and-gunicorn

http://justcramer.com/2013/06/27/serving-python-web-applications/
http://nichol.as/benchmark-of-python-web-servers

Axel, can nginx serve gevent-based apps?


Dariusz Suchojad

https://zato.io
ESB, SOA and cloud integrations in Python

nginx is a webserver and reverse proxy, loadbalancer and other stuffs, it’s
a matter of the wsgi server the use of gevent or eventlet or wherever
worker class, using gunicorn terminology, they need.
also uwsgi can serve gevent based apps
http://uwsgi-docs.readthedocs.org/en/latest/Gevent.html

using gevent as wsgi server
http://zoomq.qiniudn.com/ZQScrapBook/ZqFLOSS/data/20101020181053/

On Mon, Jan 27, 2014 at 1:56 PM, Dariusz Suchojad dsuch@zato.io wrote:

On 01/27/2014 07:52 PM, Axel Mendoza Pupo wrote:

you could read it on:

https://www.digitalocean.com/community/articles/django-server-comparison-the-development-server-mod_wsgi-uwsgi-and-gunicorn

http://justcramer.com/2013/06/27/serving-python-web-applications/
http://nichol.as/benchmark-of-python-web-servers

Axel, can nginx serve gevent-based apps?


Dariusz Suchojad

https://zato.io
ESB, SOA and cloud integrations in Python

In my opinion you should deploy your django apps with nginx + uwsgi or nginx

  • gunicorn.

I am not too clued up on http servers other than Apache. Can you give a
reason why nginx + uwsgi / gunicorn rather than Apache + mod_wsgi?

Zato is not intended to do so since it’s an ESB, you could use it to
develop apps but not for django, just for Zato as services

If each app has its own http server then they are just services listening
to requests coming in on the ESB and responding to those requests, right?

I realize an ESB might sound like an overkill in this case, but there are
other components in the system that would also benefit from the ESB. So my
question is really: if I have the ESB available, can I use it to route
traffic to the two apps based on host name? Do not assume the load balancer
and web apps are on the same machine in this configuration.

Sorry if my questions sound naive, I do not have a lot of SOA / ESB
experience.

R

On Mon, Jan 27, 2014 at 7:20 PM, Axel Mendoza Pupo aekroft@gmail.comwrote:

With nginx you could get simple load balancing capabilities plus
performance increased in conjunction with uwsgi, just configuring an
upstream with all of your servers an then using it on the proxy_pass(for
whatever server you want, ie gunicorn, apache,tomcat) or uwsgi_pass(if you
use uwsgi as a wsgi server for your django apps).

In fact I think that Zato itself should consider to move in this direction
taking performance into account, this reduce the need of software
components running, since:
1- nginx can serve static files for django zato-webadmin,
2- nginx can talk to unix sockets so local servers can be deployed without
having to open ports
3- nginx have native support for uwsgi using a binary protocol
4- uwsgi seems to have better performance than gunicorn in the last
versions
5- uwsgi can serve many differents wsgi apps with only one running
instance running as Emperor, this can be used to serve servers app and also
django zato-webadmin
6- nginx loadbalancer can be substitute haproxy in this terms

this is just a few ideas, to improve the performance of Zato

Cheers

On Mon, Jan 27, 2014 at 11:12 AM, Dariusz Suchojad dsuch@zato.io wrote:

On 01/27/2014 03:35 PM, Axel Mendoza Pupo wrote:

In my opinion you should deploy your django apps with nginx + uwsgi or
nginx + gunicorn. Zato is not intended to do so since it’s an ESB, you
could use it to develop apps but not for django, just for Zato as
services

Well, you know, the load-balancer is an embedded HAProxy instance so
there’s nothing really preventing anyone from using it for other
purposes as well.

There wouldn’t be much support from Zato as such but still, HAProxy is
precisely meant to distribute the traffic across servers so as long as
one doesn’t interfere with Zato’s own configuration they should be ready
to use the LB as is. In HAProxy terms, you just need to use different
frontends and backends.

Here’s a link to a discussion regarding log formats in HAProxy.

http://comments.gmane.org/gmane.comp.web.haproxy/5169

But just to make sure, one would simply be using HAProxy at that point
merely taking advantage of the fact that its configuration can be
updated remotely using the source code view.

https://zato.io/docs/web-admin/load-balancer/source-code.html

So I wouldn’t reject the idea as long as we understood this is just
making use of a convenient fact that HAProxy is already there.

If each app has its own http server then they are just services listening
to requests coming in on the ESB and responding to those requests, right?

Sounds right I think, but what do you mean by the app here? Django apps?

Django projects/apps served via WSGI by an HTTP server.

In my opinion you should deploy your django apps with nginx + uwsgi or
nginx + gunicorn.

Interesting benchmark (2010) of a few HTTP servers. Read the comments to
find additional info on why Gunicorn scored very low:
http://nichol.as/benchmark-of-python-web-servers

On Mon, Jan 27, 2014 at 9:22 PM, Dariusz Suchojad dsuch@zato.io wrote:

On 01/27/2014 07:36 PM, Riaan van den Dool wrote:

If each app has its own http server then they are just services listening
to requests coming in on the ESB and responding to those requests, right?

Sounds right I think, but what do you mean by the app here? Django apps?

I realize an ESB might sound like an overkill in this case, but there are
other components in the system that would also benefit from the ESB. So
my
question is really: if I have the ESB available, can I use it to route
traffic to the two apps based on host name? Do not assume the load
balancer
and web apps are on the same machine in this configuration.

I’d say this is not that much a question of using an ESB or not, rather
of regular load-balancing, and it so happens that in Zato there is a
load-balancer embedded - can you provide a detailed description of the
environment? What exact HTTP headers would you like to route the traffic
basing on? What addresses would the target servers be running on?


Dariusz Suchojad

https://zato.io
ESB, SOA and cloud integrations in Python