Quantcast

Static Content using Apache!

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Static Content using Apache!

Lomesh Contractor

Hi,

 

I have build a grails application with project name “subscriber”. Now, in development phase whenever I need to access the images, I used to do <img src=”/subscriber/images/….” />. It is working fine.

 

Then I deploy the site on apache. I build war file (subscriber.war) out of the grails project and put that into Tomcat’s webapps directory. I successfully accessed the site, with all the content including static and dynamic.

 

Now, I want  to integrate Tomcat with Apache. I am done with the configuration in httpd.conf as shown below.

 

<VirtualHost *:80>

    ServerName www.myserver.com

    DocumentRoot /usr/local/tomcat/webapps/subscriber

    JkMount /subscriber worker1

    JkMount /subscriber/* worker1

</VirtualHost>

 

This works fine.

 

But in this case “Tomcat” serves all the content including static. I want this to be changed. I want Apache should handle static content to reduce load on Tomcat, including images, css, htmls etc.

 

Any idea, how do I do this?

 

Thanks & Regards,

Lomesh Contractor | NGN Solutions & Services | Tech Mahindra

Sharda Center, Pune, India

( Office: +91–20–6601 8100| Extn: 2809| Cell: +91–99229 54210

Email: [hidden email]

www.techmahindra.com

 

============================================================================================================================


Disclaimer:

This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at http://www.techmahindra.com/Disclaimer.html externally and http://tim.techmahindra.com/Disclaimer.html internally within Tech Mahindra.

============================================================================================================================
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Static Content using Apache!

Jason Morris-5
This might help: http://www.grails.org/Static+Resources+Plugin

On Mon, Sep 22, 2008 at 4:29 PM, Lomesh Contractor <[hidden email]> wrote:

Hi,

 

I have build a grails application with project name "subscriber". Now, in development phase whenever I need to access the images, I used to do <img src="/subscriber/images/…." />. It is working fine.

 

Then I deploy the site on apache. I build war file (subscriber.war) out of the grails project and put that into Tomcat's webapps directory. I successfully accessed the site, with all the content including static and dynamic.

 

Now, I want  to integrate Tomcat with Apache. I am done with the configuration in httpd.conf as shown below.

 

<VirtualHost *:80>

    ServerName www.myserver.com

    DocumentRoot /usr/local/tomcat/webapps/subscriber

    JkMount /subscriber worker1

    JkMount /subscriber/* worker1

</VirtualHost>

 

This works fine.

 

But in this case "Tomcat" serves all the content including static. I want this to be changed. I want Apache should handle static content to reduce load on Tomcat, including images, css, htmls etc.

 

Any idea, how do I do this?

 

Thanks & Regards,

Lomesh Contractor | NGN Solutions & Services | Tech Mahindra

Sharda Center, Pune, India

( Office: +91–20–6601 8100| Extn: 2809| Cell: +91–99229 54210

Email: [hidden email]

www.techmahindra.com

 

============================================================================================================================


Disclaimer:

This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at http://www.techmahindra.com/Disclaimer.html externally and http://tim.techmahindra.com/Disclaimer.html internally within Tech Mahindra.

============================================================================================================================

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Static Content using Apache!

Lomesh Contractor

Thanks Jason.

 

I read about it. But,

 

i.                     I couldn’t find any proper download link the same, from the site specified at the bottom of the page.

ii.                   I can see its only upgraded up to Grails 1.0.2 and I am using Grails 1.0.3, does it make any difference or incompatibility?

 

Thanks & Regards,

Lomesh Contractor | NGN Solutions & Services | Tech Mahindra

Sharda Center, Pune, India

( Office: +91–20–6601 8100| Extn: 2809| Cell: +91–99229 54210

Email: [hidden email]

www.techmahindra.com

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Jason Morris
Sent: Monday, September 22, 2008 9:02 PM
To: [hidden email]
Subject: Re: [grails-user] Static Content using Apache!

 

This might help: http://www.grails.org/Static+Resources+Plugin

On Mon, Sep 22, 2008 at 4:29 PM, Lomesh Contractor <[hidden email]> wrote:

Hi,

 

I have build a grails application with project name "subscriber". Now, in development phase whenever I need to access the images, I used to do <img src="/subscriber/images/…." />. It is working fine.

 

Then I deploy the site on apache. I build war file (subscriber.war) out of the grails project and put that into Tomcat's webapps directory. I successfully accessed the site, with all the content including static and dynamic.

 

Now, I want  to integrate Tomcat with Apache. I am done with the configuration in httpd.conf as shown below.

 

<VirtualHost *:80>

    ServerName www.myserver.com

    DocumentRoot /usr/local/tomcat/webapps/subscriber

    JkMount /subscriber worker1

    JkMount /subscriber/* worker1

</VirtualHost>

 

This works fine.

 

But in this case "Tomcat" serves all the content including static. I want this to be changed. I want Apache should handle static content to reduce load on Tomcat, including images, css, htmls etc.

 

Any idea, how do I do this?

 

Thanks & Regards,

Lomesh Contractor | NGN Solutions & Services | Tech Mahindra

Sharda Center, Pune, India

( Office: +91–20–6601 8100| Extn: 2809| Cell: +91–99229 54210

Email: [hidden email]

www.techmahindra.com

 

============================================================================================================================


Disclaimer:

This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at http://www.techmahindra.com/Disclaimer.html externally and http://tim.techmahindra.com/Disclaimer.html internally within Tech Mahindra.

============================================================================================================================

 

============================================================================================================================


Disclaimer:

This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at http://www.techmahindra.com/Disclaimer.html externally and http://tim.techmahindra.com/Disclaimer.html internally within Tech Mahindra.

============================================================================================================================
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Static Content using Apache!

Jason Morris-5
Ah, you've caught me out :) I knew the plugin exists but I don't actually use it so I can't help you with the specifics...

Try Marc Palmer (marc AT anyware.co.uk) who I believe wrote it, he would know.

Jason

On Mon, Sep 22, 2008 at 4:40 PM, Lomesh Contractor <[hidden email]> wrote:

Thanks Jason.

 

I read about it. But,

 

i.                     I couldn't find any proper download link the same, from the site specified at the bottom of the page.

ii.                   I can see its only upgraded up to Grails 1.0.2 and I am using Grails 1.0.3, does it make any difference or incompatibility?

 

Thanks & Regards,

Lomesh Contractor | NGN Solutions & Services | Tech Mahindra

Sharda Center, Pune, India

( Office: +91–20–6601 8100| Extn: 2809| Cell: +91–99229 54210

Email: [hidden email]

www.techmahindra.com

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Jason Morris
Sent: Monday, September 22, 2008 9:02 PM
To: [hidden email]
Subject: Re: [grails-user] Static Content using Apache!

 

This might help: http://www.grails.org/Static+Resources+Plugin

On Mon, Sep 22, 2008 at 4:29 PM, Lomesh Contractor <[hidden email]> wrote:

Hi,

 

I have build a grails application with project name "subscriber". Now, in development phase whenever I need to access the images, I used to do <img src="/subscriber/images/…." />. It is working fine.

 

Then I deploy the site on apache. I build war file (subscriber.war) out of the grails project and put that into Tomcat's webapps directory. I successfully accessed the site, with all the content including static and dynamic.

 

Now, I want  to integrate Tomcat with Apache. I am done with the configuration in httpd.conf as shown below.

 

<VirtualHost *:80>

    ServerName www.myserver.com

    DocumentRoot /usr/local/tomcat/webapps/subscriber

    JkMount /subscriber worker1

    JkMount /subscriber/* worker1

</VirtualHost>

 

This works fine.

 

But in this case "Tomcat" serves all the content including static. I want this to be changed. I want Apache should handle static content to reduce load on Tomcat, including images, css, htmls etc.

 

Any idea, how do I do this?

 

Thanks & Regards,

Lomesh Contractor | NGN Solutions & Services | Tech Mahindra

Sharda Center, Pune, India

( Office: +91–20–6601 8100| Extn: 2809| Cell: +91–99229 54210

Email: [hidden email]

www.techmahindra.com

 

============================================================================================================================


Disclaimer:

This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at http://www.techmahindra.com/Disclaimer.html externally and http://tim.techmahindra.com/Disclaimer.html internally within Tech Mahindra.

============================================================================================================================

 

============================================================================================================================


Disclaimer:

This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at http://www.techmahindra.com/Disclaimer.html externally and http://tim.techmahindra.com/Disclaimer.html internally within Tech Mahindra.

============================================================================================================================

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Static Content using Apache!

Marc Palmer Local

On 22 Sep 2008, at 18:09, Jason Morris wrote:

> Ah, you've caught me out :) I knew the plugin exists but I don't  
> actually use it so I can't help you with the specifics...
>

Just install it from the plugin repo, it should work fine.

Marc



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Static Content using Apache!

Brad Whitaker
I'm a happy user of the Static Resources plugin on 1.0.3, and it is very nice to keep static content out of the WAR, but if your primary motivation is performance you might want to consider this claim from Chapter 5 of "Tomcat: The Definitive Guide, 2nd Edition" (by Jason Brittain; Ian F. Darwin Publisher: O'Reilly):

"Tomcat's web server is somewhat faster than Apache httpd. In our benchmarks, we observed that Tomcat is at least 23 percent faster than Apache httpd (standalone) at serving static content, at least on Linux."


Marc Palmer Local wrote
On 22 Sep 2008, at 18:09, Jason Morris wrote:

> Ah, you've caught me out :) I knew the plugin exists but I don't  
> actually use it so I can't help you with the specifics...
>

Just install it from the plugin repo, it should work fine.

Marc
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Static Content using Apache!

Marc Palmer Local

On 23 Sep 2008, at 08:10, Brad Whitaker wrote:

>
> I'm a happy user of the Static Resources plugin on 1.0.3, and it is  
> very nice
> to keep static content out of the WAR, but if your primary  
> motivation is
> performance you might want to consider this claim from Chapter 5 of  
> "Tomcat:
> The Definitive Guide, 2nd Edition" (by Jason Brittain; Ian F. Darwin
> Publisher: O'Reilly):
>
> "Tomcat's web server is somewhat faster than Apache httpd. In our
> benchmarks, we observed that Tomcat is at least 23 percent faster than
> Apache httpd (standalone) at serving static content, at least on  
> Linux."

Er... let them show us the stats and the apache config.

I find that really, really hard to believe - don't you? Were they  
serving 20MB swf video files as well? ;-)

Marc


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Static Content using Apache!

jc63
In reply to this post by Lomesh Contractor
Hi,

I have tried an other option to serve static resources. I don't know if it's really efficient but it seems to work fine. As I have a little server I don't want to install two server httpd, tomcat. so I'm using the static resources plugin. On my production server, I just create a <context> in tomcat to serve resources. so it's not using all the grails proccess for a request. I had two filters to set the expire date header and compress the file and that's it.

But you have to had a option to the resources plugin :
- Set the version of the resource and generate link with this version number (to cache properly / and for a long time the resources)
.../resources/v6/css/...


Julien.

Lomesh Contractor a écrit :

Thanks Jason.

 

I read about it. But,

 

i.                     I couldn’t find any proper download link the same, from the site specified at the bottom of the page.

ii.                   I can see its only upgraded up to Grails 1.0.2 and I am using Grails 1.0.3, does it make any difference or incompatibility?

 

Thanks & Regards,

Lomesh Contractor | NGN Solutions & Services | Tech Mahindra

Sharda Center, Pune, India

( Office: +91–20–6601 8100| Extn: 2809| Cell: +91–99229 54210

Email: [hidden email]

www.techmahindra.com

 

From: [hidden email] [[hidden email]] On Behalf Of Jason Morris
Sent: Monday, September 22, 2008 9:02 PM
To: [hidden email]
Subject: Re: [grails-user] Static Content using Apache!

 

This might help: http://www.grails.org/Static+Resources+Plugin

On Mon, Sep 22, 2008 at 4:29 PM, Lomesh Contractor <[hidden email]> wrote:

Hi,

 

I have build a grails application with project name "subscriber". Now, in development phase whenever I need to access the images, I used to do <img src="/subscriber/images/…." />. It is working fine.

 

Then I deploy the site on apache. I build war file (subscriber.war) out of the grails project and put that into Tomcat's webapps directory. I successfully accessed the site, with all the content including static and dynamic.

 

Now, I want  to integrate Tomcat with Apache. I am done with the configuration in httpd.conf as shown below.

 

<VirtualHost *:80>

    ServerName www.myserver.com

    DocumentRoot /usr/local/tomcat/webapps/subscriber

    JkMount /subscriber worker1

    JkMount /subscriber/* worker1

</VirtualHost>

 

This works fine.

 

But in this case "Tomcat" serves all the content including static. I want this to be changed. I want Apache should handle static content to reduce load on Tomcat, including images, css, htmls etc.

 

Any idea, how do I do this?

 

Thanks & Regards,

Lomesh Contractor | NGN Solutions & Services | Tech Mahindra

Sharda Center, Pune, India

( Office: +91–20–6601 8100| Extn: 2809| Cell: +91–99229 54210

Email: [hidden email]

www.techmahindra.com

 

============================================================================================================================


Disclaimer:

This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at http://www.techmahindra.com/Disclaimer.html externally and http://tim.techmahindra.com/Disclaimer.html internally within Tech Mahindra.

============================================================================================================================

 

============================================================================================================================


Disclaimer:

This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at http://www.techmahindra.com/Disclaimer.html externally and http://tim.techmahindra.com/Disclaimer.html internally within Tech Mahindra.

============================================================================================================================

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Static Content using Apache!

Philip Shore
In reply to this post by Lomesh Contractor
Are you sure you need the features of Apache ?

I'm just checking because the Tomcat folks say it is much more efficient these days.

Tomcat authors wrote
http://tomcat.apache.org/tomcat-6.0-doc/connectors.html 

When using a single server, the performance when using a native webserver in front of the Tomcat instance is most of the time significantly worse than a standalone Tomcat with its default HTTP connector, even if a large part of the web application is made of static files.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Static Content using Apache!

Brad Whitaker
In reply to this post by Marc Palmer Local
I'm only passing on what I read -- I certainly haven't tried any of this myself. Chapter 4 is titled "Tomcat Performance Tuning" and it fully describes the test environments and test results. (There is a good discussion of testing strategy, techniques, and tools). There "static content" test involved 9k image files (not 20MB swf files). The tests measured the "number of requests that were successfully handled per second". (There is a section discussing "what else we could have benchmarked"). They published results for 23 permutations of Tomcat connectors and Apache httpd connector module configurations.  Tomcat HTTP JIO came out on top in all of their tests. Certain configurations of Tomcat with httpd were able to handle only 25% as many requests per second as Tomcat alone.

Chapter 5 is "Integration with the Apache Web Server" and it contains a section on the "Pros and Cons of Integration". The authors seem neutral on the subject -- they present numerous advantages and disadvantages of integration vs. stand alone.

Marc Palmer Local wrote
On 23 Sep 2008, at 08:10, Brad Whitaker wrote:

>
> I'm a happy user of the Static Resources plugin on 1.0.3, and it is  
> very nice
> to keep static content out of the WAR, but if your primary  
> motivation is
> performance you might want to consider this claim from Chapter 5 of  
> "Tomcat:
> The Definitive Guide, 2nd Edition" (by Jason Brittain; Ian F. Darwin
> Publisher: O'Reilly):
>
> "Tomcat's web server is somewhat faster than Apache httpd. In our
> benchmarks, we observed that Tomcat is at least 23 percent faster than
> Apache httpd (standalone) at serving static content, at least on  
> Linux."

Er... let them show us the stats and the apache config.

I find that really, really hard to believe - don't you? Were they  
serving 20MB swf video files as well? ;-)

Marc
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Static Content using Apache!

Cromer, Rick
In reply to this post by Philip Shore
Philip, the reason we are integrating Tomcat with Apache is not for
performance reasons, it is that we have several web applications that
use Apache on port 80.  We also have several applications running on
Tomcat using port 8080.  Our cert for https is configured on Apache and
we will need to do credit card processing and want to leverage both port
80 and https and want this new consumer web site to be accessed without
having to specify a port.


Regards,
Rick Cromer
-----Original Message-----
From: Philip Shore [mailto:[hidden email]]
Sent: Tuesday, September 23, 2008 10:37 AM
To: [hidden email]
Subject: Re: [grails-user] Static Content using Apache!


Are you sure you need the features of Apache ?

I'm just checking because the Tomcat folks say it is much more efficient
these days.


Tomcat authors wrote:
>
>
> http://tomcat.apache.org/tomcat-6.0-doc/connectors.html 
>
> When using a single server, the performance when using a native
webserver
> in front of the Tomcat instance is most of the time significantly
worse
> than a standalone Tomcat with its default HTTP connector, even if a
large
> part of the web application is made of static files.
>
--
View this message in context:
http://www.nabble.com/Static-Content-using-Apache%21-tp19610464p19630463
.html
Sent from the grails - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Static Content using Apache!

jasenj1
I'd like to revive this thread and get a current answer for Grails 2.0. We are doing something similar to the original poster. Apache httpd is the front server of a mostly static content web site. We have a virtual host defined to get at the dynamic web app content using a ProxyPass.

For example, we have a static footer that goes on every page. The gsp layout needs to render all its dynamic goodness and then import/include /includes/footer.html at the bottom of the page layout.

The "static resources" plugin has been deprecated. The "include" plugin is very old and doesn't seem to be working. And the current "resources" plugin seems to be all about creating links to CSS and JavaScript, not importing chunks of HTML.

- Jasen.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Static Content using Apache!

jasenj1
To answer my own question:
Use the the JSTL core library. Add the jstl-api and jstl-impl jars to your library directory. Put c.tld into web-app/WEB-INF/tld.
At the top of your GSP pages import the core taglib
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

Use the c:import tag
<c:import url="http://localhost:80/includes/footer.html" />

Sometimes it's hard to remember that Grails doesn't REPLACE Java, but works alongside Java and JSP. If an existing library or tag library does what you need. Use it.

- Jasen.
Loading...