Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #34598 > unrolled thread

Is it necessary to have both an application server AND a web server?

Started byQu0ll <qu0ll64@gmail.com>
First post2016-06-11 08:48 +1000
Last post2016-07-08 08:31 -0700
Articles 10 — 4 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Is it necessary to have both an application server AND a web server? Qu0ll <qu0ll64@gmail.com> - 2016-06-11 08:48 +1000
    Re: Is it necessary to have both an application server AND a web server? Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2016-06-11 00:43 -0700
    Re: Is it necessary to have both an application server AND a web server? Daniel Pitts <usenet@coloraura.com> - 2016-06-11 12:41 -0700
      Re: Is it necessary to have both an application server AND a web server? Daniel Pitts <usenet@coloraura.com> - 2016-06-11 12:45 -0700
        Re: Is it necessary to have both an application server AND a web server? Arne Vajhøj <arne@vajhoej.dk> - 2016-06-11 17:45 -0400
          Re: Is it necessary to have both an application server AND a web server? Daniel Pitts <usenet@coloraura.com> - 2016-06-12 21:05 -0700
    Re: Is it necessary to have both an application server AND a web server? Arne Vajhøj <arne@vajhoej.dk> - 2016-06-11 17:44 -0400
    Re: Is it necessary to have both an application server AND a web server? Qu0ll <qu0ll64@gmail.com> - 2016-06-16 06:58 +1000
      Re: Is it necessary to have both an application server AND a web server? Arne Vajhøj <arne@vajhoej.dk> - 2016-07-07 22:31 -0400
        Re: Is it necessary to have both an application server AND a web server? Daniel Pitts <usenet@coloraura.com> - 2016-07-08 08:31 -0700

#34598 — Is it necessary to have both an application server AND a web server?

FromQu0ll <qu0ll64@gmail.com>
Date2016-06-11 08:48 +1000
SubjectIs it necessary to have both an application server AND a web server?
Message-ID<njfg37$1hj0$1@gioia.aioe.org>
DISCLAIMER: Server-side Java is not my forte.

I have often noticed that in many places where I have worked, the 
companies have both a full application server such as JBoss/Wildfly AND 
a web server (typically Apache) installed and both seem to work together.

1) Is this necessary and if so, why?
2) What does a web server "provide" that an application server doesn't?
3) What is the nature of the relationship or interaction between both 
applications?

-- 

And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
Qu0llSixFour@gmail.com
[Replace the "SixFour" with numbers to email me]

[toc] | [next] | [standalone]


#34599

FromKevin McMurtrie <mcmurtrie@pixelmemory.us>
Date2016-06-11 00:43 -0700
Message-ID<mcmurtrie-64C384.00434311062016@news.sonic.net>
In reply to#34598
In article <njfg37$1hj0$1@gioia.aioe.org>, Qu0ll <qu0ll64@gmail.com> 
wrote:

> DISCLAIMER: Server-side Java is not my forte.
> 
> I have often noticed that in many places where I have worked, the 
> companies have both a full application server such as JBoss/Wildfly AND 
> a web server (typically Apache) installed and both seem to work together.
> 
> 1) Is this necessary and if so, why?
> 2) What does a web server "provide" that an application server doesn't?
> 3) What is the nature of the relationship or interaction between both 
> applications?

It depends.

Modern web services are split into at least static content and dynamic 
content.  This divides up work, keeps cookies separate, and makes it 
easy to later push the static content to edge caches.

In the early 2000s it was common to put Apache in front of Tomcat via 
specialized software endpoints.  Sometimes it was to use Apache as a 
cheap load balancer and SSL endpoint.  Most of the time it was for 
entirely superstitious reasons.  The combination has poor performance 
and it's combining the bugs of two applications that struggle to support 
advancing technologies.

Jetty + Nginx is a more modern configuration of the two layer design 
that's popular with startups.  It's not optimal but it can be deployed 
on cloud services to avoid big up-front hardware costs.

-- 
I will not see posts from astraweb, theremailer, dizum, or google
because they host Usenet flooders.

[toc] | [prev] | [next] | [standalone]


#34604

FromDaniel Pitts <usenet@coloraura.com>
Date2016-06-11 12:41 -0700
Message-ID<njhphi$2sr$1@dont-email.me>
In reply to#34598
On 6/10/16 3:48 PM, Qu0ll wrote:
> DISCLAIMER: Server-side Java is not my forte.
>
> I have often noticed that in many places where I have worked, the
> companies have both a full application server such as JBoss/Wildfly AND
> a web server (typically Apache) installed and both seem to work together.
>
> 1) Is this necessary and if so, why?
> 2) What does a web server "provide" that an application server doesn't?
> 3) What is the nature of the relationship or interaction between both
> applications?
>
It isn't always necessary, but they provide different specializations.

The Apache (or nginx) provides some basic file serving, redirects, URL 
masking, etc...  They also make it easier to serve multiple applications 
behind a single host.

Where I work, we used to have many more layers than even that:


1. Akamai
2. Load Balancer
3. Apache
4. Load Balancer
5. Custom Proxy #1 (For non-cachable/real-time decisions)
6. Load Balancer
7. Caching Proxy
8. Load Balancer
9. Custom Proxy #2 (For cachable global logic)
10. Load Balancer
11. Web Application(s)


Because we used an HTTP API, it went even deeper.  The "Web Application" 
would call into our API stack:

1. Load Balancer
2. Apache
3. Caching Proxy
4. HTTP API Application(s)

The API would then connect to MySQL or SOLR (Solr being another 
web-app), and other data-sources.

Could we do all of this in a single application? Yes! But it wouldn't be 
quite as robust, would be harder to manage, and would require us to 
right a lot more custom code to do the functions that Apache did for us.

We've since simplified our architecture a lot (no more custom proxies), 
and use nginx instead of apache.

[toc] | [prev] | [next] | [standalone]


#34605

FromDaniel Pitts <usenet@coloraura.com>
Date2016-06-11 12:45 -0700
Message-ID<njhpnt$3hn$1@dont-email.me>
In reply to#34604
On 6/11/16 12:41 PM, Daniel Pitts wrote:
> On 6/10/16 3:48 PM, Qu0ll wrote:
>> DISCLAIMER: Server-side Java is not my forte.
>>
>> I have often noticed that in many places where I have worked, the
>> companies have both a full application server such as JBoss/Wildfly AND
>> a web server (typically Apache) installed and both seem to work together.
>>
>> 1) Is this necessary and if so, why?
>> 2) What does a web server "provide" that an application server doesn't?
>> 3) What is the nature of the relationship or interaction between both
>> applications?
>>
> It isn't always necessary, but they provide different specializations.
>
> The Apache (or nginx) provides some basic file serving, redirects, URL
> masking, etc...  They also make it easier to serve multiple applications
> behind a single host.
>
> Where I work, we used to have many more layers than even that:
>
>
> 1. Akamai
> 2. Load Balancer
> 3. Apache
> 4. Load Balancer
> 5. Custom Proxy #1 (For non-cachable/real-time decisions)
> 6. Load Balancer
> 7. Caching Proxy
> 8. Load Balancer
> 9. Custom Proxy #2 (For cachable global logic)
> 10. Load Balancer
> 11. Web Application(s)
>
>
> Because we used an HTTP API, it went even deeper.  The "Web Application"
> would call into our API stack:
>
> 1. Load Balancer
> 2. Apache
> 3. Caching Proxy
> 4. HTTP API Application(s)
>
> The API would then connect to MySQL or SOLR (Solr being another
> web-app), and other data-sources.
>
> Could we do all of this in a single application? Yes! But it wouldn't be
> quite as robust, would be harder to manage, and would require us to
> right a lot more custom code to do the functions that Apache did for us.
>
> We've since simplified our architecture a lot (no more custom proxies),
> and use nginx instead of apache.

Oops, I missed two load-balancers in the API stack ;-)  Basically, we 
always had a load balancer between each layer.  We even had a 
load-balancer for MySQL and SOLR query tiers.

So, each request was serviced by a total of at least 17 hops. 19 if you 
count the data source connections.

Now, flat-files (images, javascript, etc...) weren't served by the web 
applications, but instead put on a shared filer that was served directly 
by Apache.  Again, we *could* have done it through the web-app, but that 
would have been a much more complicated web-app.

[toc] | [prev] | [next] | [standalone]


#34607

FromArne Vajhøj <arne@vajhoej.dk>
Date2016-06-11 17:45 -0400
Message-ID<nji0qj$17vj$2@gioia.aioe.org>
In reply to#34605
On 6/11/2016 3:45 PM, Daniel Pitts wrote:
> Oops, I missed two load-balancers in the API stack ;-)  Basically, we
> always had a load balancer between each layer.

Apache httpd can act as load balancer for the Java app
server.

Arne

[toc] | [prev] | [next] | [standalone]


#34613

FromDaniel Pitts <usenet@coloraura.com>
Date2016-06-12 21:05 -0700
Message-ID<njlbds$av6$2@dont-email.me>
In reply to#34607
On 6/11/16 2:45 PM, Arne Vajhøj wrote:
> On 6/11/2016 3:45 PM, Daniel Pitts wrote:
>> Oops, I missed two load-balancers in the API stack ;-)  Basically, we
>> always had a load balancer between each layer.
>
> Apache httpd can act as load balancer for the Java app
> server.
I don't doubt it. We had specialized hardware to do it though, already 
in place.  Citrix NetScaler I believe, though I wasn't really involved 
at that level.

[toc] | [prev] | [next] | [standalone]


#34606

FromArne Vajhøj <arne@vajhoej.dk>
Date2016-06-11 17:44 -0400
Message-ID<nji0na$17vj$1@gioia.aioe.org>
In reply to#34598
On 6/10/2016 6:48 PM, Qu0ll wrote:
> I have often noticed that in many places where I have worked, the
> companies have both a full application server such as JBoss/Wildfly AND
> a web server (typically Apache) installed and both seem to work together.
>
> 1) Is this necessary and if so, why?
> 2) What does a web server "provide" that an application server doesn't?
> 3) What is the nature of the relationship or interaction between both
> applications?

The setup:

--Apache httpd--Tomcat/JBoss/whatever

is very common.

It is not strictly necessary, but it does provide some benefits.

Probably the most important is the security aspect. Because the
flow above is an oversimplification. Usually it is:

internet|                  DMZ                  |   secure network zone
--Firewall--Apache httpd with mod_security--Firewall--Tomcat/JBoss/whatever

where the Apache httpd in DMZ is used to protect the application.

In many security minded environments you would not be allowed to
expose an application without a proxy in DMZ in front of it.

In the old days there were a performance benefit by terminating SSL
in Apache httpd instead of in Tomcat/JBoss/whatever, because Apache
httpd had native highly optimized SSL code while Java SSL was not quite
as efficient.

That is not important today as SSL would typical be offloaded
in a network box not in a real server (network boxes today are really
servers inside, but you know what I mean).

Then there is the static content. Often it has advantages to
serve that by Apache httpd instead of Tomcat/JBoss/whatever.

Tomcat/JBoss/whatever can serve static content but there are
some reasons why a dedicated server may be better in many
cases:
* a web server written to serve static content may be more
   efficient than a Java app server, where support for static
   content may have been a very low priority in development.
* Apache httpd comes with advanced options for cache control
   that Tomcat/JBoss/whatever does not have.
* the static content may be produced by a different team than
   the one producing the Java web app, so requiring the static
   content to be bundled into the war file can be an organizational
   hassle.

Arne

[toc] | [prev] | [next] | [standalone]


#34656

FromQu0ll <qu0ll64@gmail.com>
Date2016-06-16 06:58 +1000
Message-ID<njsfhf$2hu$1@gioia.aioe.org>
In reply to#34598
On 11/06/2016 08:48, Qu0ll wrote:
> DISCLAIMER: Server-side Java is not my forte.
>
> I have often noticed that in many places where I have worked, the
> companies have both a full application server such as JBoss/Wildfly AND
> a web server (typically Apache) installed and both seem to work together.
>
> 1) Is this necessary and if so, why?
> 2) What does a web server "provide" that an application server doesn't?
> 3) What is the nature of the relationship or interaction between both
> applications?
>

Thanks to everyone who replied to my question in such a helpful manner.

It seems clear that there are distinct reasons to have both a dedicated 
web server and application server as part of your infrastructure.

It seems though that nginx may be a more modern alternative to httpd but 
I will need to do more research to decide which is better for my precise 
needs.

-- 

And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
Qu0llSixFour@gmail.com
[Replace the "SixFour" with numbers to email me]

[toc] | [prev] | [next] | [standalone]


#34781

FromArne Vajhøj <arne@vajhoej.dk>
Date2016-07-07 22:31 -0400
Message-ID<nln3ad$1mrg$1@gioia.aioe.org>
In reply to#34656
On 6/15/2016 4:58 PM, Qu0ll wrote:
> On 11/06/2016 08:48, Qu0ll wrote:
>> DISCLAIMER: Server-side Java is not my forte.
>>
>> I have often noticed that in many places where I have worked, the
>> companies have both a full application server such as JBoss/Wildfly AND
>> a web server (typically Apache) installed and both seem to work together.
>>
>> 1) Is this necessary and if so, why?
>> 2) What does a web server "provide" that an application server doesn't?
>> 3) What is the nature of the relationship or interaction between both
>> applications?
>>
>
> Thanks to everyone who replied to my question in such a helpful manner.
>
> It seems clear that there are distinct reasons to have both a dedicated
> web server and application server as part of your infrastructure.
>
> It seems though that nginx may be a more modern alternative to httpd but
> I will need to do more research to decide which is better for my precise
> needs.

nginx vs Apache is a complex topic.

But an oversimplified (!) answer is:
- nginx is best to serve static content
- Apache is best to do all sorts of things via modules

Arne

[toc] | [prev] | [next] | [standalone]


#34790

FromDaniel Pitts <usenet@coloraura.com>
Date2016-07-08 08:31 -0700
Message-ID<nloh13$aq9$1@dont-email.me>
In reply to#34781
On 7/7/16 7:31 PM, Arne Vajhøj wrote:
> On 6/15/2016 4:58 PM, Qu0ll wrote:
>> On 11/06/2016 08:48, Qu0ll wrote:
>>> DISCLAIMER: Server-side Java is not my forte.
>>>
>>> I have often noticed that in many places where I have worked, the
>>> companies have both a full application server such as JBoss/Wildfly AND
>>> a web server (typically Apache) installed and both seem to work
>>> together.
>>>
>>> 1) Is this necessary and if so, why?
>>> 2) What does a web server "provide" that an application server doesn't?
>>> 3) What is the nature of the relationship or interaction between both
>>> applications?
>>>
>>
>> Thanks to everyone who replied to my question in such a helpful manner.
>>
>> It seems clear that there are distinct reasons to have both a dedicated
>> web server and application server as part of your infrastructure.
>>
>> It seems though that nginx may be a more modern alternative to httpd but
>> I will need to do more research to decide which is better for my precise
>> needs.
>
> nginx vs Apache is a complex topic.
>
> But an oversimplified (!) answer is:
> - nginx is best to serve static content
> - Apache is best to do all sorts of things via modules
>
> Arne
I don't know if its changed, but nginx was also supposedly better at 
managing more concurrent, long-lived connections (such as websockets).

My understanding is that is because nginx used a limited number of 
threads to manage all the sockets, where Apache used a 
thread-per-connection model, using more resources per connection.

Things may have changed since the last time I looked at the difference.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web