1) You could place a proxy server like nginx in front of Apache to serve all the static files.
2) You could use ProxyPassMatch to tell Apache to send only cfm and cfc requests to Tomcat and let Apache serve the static content.
We are going to do the second option and let Apache handle the static content and pass only the dynamic request on to Tomcat. To do this we will use the ProxyPassMatch Directive which allows us to construct a regular expression and will replace the ProxyPass Directive we used before.
This is how the proxy information in your vhosts.conf file looks like now.
<Proxy balancer://mycluster>
BalancerMember ajp://<your server1 ip>:8009/ route=node1 loadfactor=1
ProxySet lbmethod=byrequests
</Proxy>
ProxyPreserveHost On
ProxyPass / balancer://mycluster/ nofailover=On
And this is what it should look like after using ProxyPassMatch
<Proxy balancer://mycluster>
BalancerMember ajp://<your server1 ip>:8009/ route=node1 loadfactor=1
ProxySet lbmethod=byrequests
</Proxy>
ProxyPreserveHost On
ProxyPassMatch ^/(.*\.cf[cm]/?.*)$ balancer://mycluster/$1 nofailover=On
The only real difference is the conversion of the ProxyPass directive to ProxyPassMatch, as was said earlier this will pass only cfm and cfc calls on to Tomcat and let Apache deal with all of the static files. This means you need to set up a 404 handler in Apache for missing files, and subsequently a missing template handler for missing cfc or cfm files.
Using ProxyPassMatch should help you squeeze more performance out of your machine since Tomcat will now only be involved in processing Coldfusion instead of having to return static content as well. You should still tune your jvm settings as suggested by Railo and do other performance tuning exercises based on your specific needs.
0 Kommentare:
Kommentar veröffentlichen