Resin Proxy Cache Support and REST support explained

From Resin 4.0 Wiki

(Difference between revisions)
Jump to: navigation, search
Line 19: Line 19:
 
==Let's create a simple page to demonstrate how the cache works==
 
==Let's create a simple page to demonstrate how the cache works==
 
Let's create a really simple JSP file so we can focus more on the REST, JMX, etc. setup.
 
Let's create a really simple JSP file so we can focus more on the REST, JMX, etc. setup.
 +
Using a standard Resin 4.0.32 install, I place this file under '''/var/resin/webapps/ROOT/cache.jsp'''.
 +
 +
<pre>
 +
<%@ page session="false" %>
 +
<%! int counter; %>
 +
<%
 +
response.addHeader("Cache-Control", "max-age=150");
 +
%>
 +
Count: <%= counter++ %>
 +
</pre>
 +
 +
The above says cache the page for 150 seconds. If you enable Resin http proxy caching, Resin will cache this page for every client for 150 seconds.
 +
Let's say, we changed the data that backs this page, and we want a faster update, how would we tell Resin to evict this page out of cache.
 +
 +
(Side note: Since Resin http proxy cache is built into Resin, it knows about every Java web resource and can cache them all without the need to use a cache providers special server side includes. Your cache includes can just be jsp:include and <%@include, etc.)
 +
 +
When you load this page, it gets put into the cache.

Revision as of 00:00, 11 January 2013

Resin provides real DevOps support

Resin is an end to end solution from load balancer, to http proxy cache, to cloud deployment. This is not to say that you could not use Resin with NginX or Varnish or XYZ, because you can. This is to say that Resin's built in support is typically the fastest most scalable, most supportable option. To demonstrate this, let's show how we can use Resin built-in proxy cache (similar to Varnish or Squid) with Resin's REST admin support.

This article will not only help you with using our Proxy Cache Support, but also with learning about our REST administrations, the envy of DevOps who have to support Java everywhere.


JMX REST support

Resin has a nice API for managing Resin that is exposed via JMX. But in this day of interoperability, cloud, REST and DevOps, it is not good enough to have a JMX interface, one must have a server that can be managed as a service via a REST interface.

All JMX operations and quite a few other operations are available via our REST admin interface as well as JMX and CLI.

Let's create a simple page to demonstrate how the cache works

Let's create a really simple JSP file so we can focus more on the REST, JMX, etc. setup. Using a standard Resin 4.0.32 install, I place this file under /var/resin/webapps/ROOT/cache.jsp.

<%@ page session="false" %>
<%! int counter; %>
<%
response.addHeader("Cache-Control", "max-age=150");
%>
Count: <%= counter++ %>

The above says cache the page for 150 seconds. If you enable Resin http proxy caching, Resin will cache this page for every client for 150 seconds. Let's say, we changed the data that backs this page, and we want a faster update, how would we tell Resin to evict this page out of cache.

(Side note: Since Resin http proxy cache is built into Resin, it knows about every Java web resource and can cache them all without the need to use a cache providers special server side includes. Your cache includes can just be jsp:include and <%@include, etc.)

When you load this page, it gets put into the cache.

Personal tools
TOOLBOX
LANGUAGES