Serving and caching content from Amazon S3 with Tomcat
Posted
by Rob
on Server Fault
See other posts from Server Fault
or by Rob
Published on 2010-03-22T22:08:28Z
Indexed on
2010/03/22
22:11 UTC
Read the original article
Hit count: 363
Hi all,
We're looking to serve a range of content using Amazon S3 as a store for the content and Tomcat to host the web application. The content is divided into free and paid for content. We intend to authenticate the users when they access the web application running in Tomcat. Based around their authentication we are able to tell if the user has access to paid for content or simply free stuff.
So I envision the flow of a request being something like this:
- Authenticated request to Tomcat
- If user is "paid" user, display links to premium content
- Direct requests for paid content back through Tomcat to prevent direct access to it by non-paying users.
- Tomcat makes request to S3 through a web cache to keep our costs down
- Content is returned to user.
As we have to pay for each request to S3, I'd ideally like to cache content locally to the Tomcat instance after it has been requested for the first time to keep costs to a minimum and to speed things up. I would also like to be able to invalidate this cache if we publish fresh content to S3.
So to confirm my proposal:
Client Request -> Tomcat -> Web Cache -> S3
To invalidate the cache, I was thinking of using something like PubSubHubbub with the cache waiting for updates to the feed for content that it should invalidate.
I'd appreciate some general feedback on this approach as I've no real experience of caching and I'm sure I've made some invalid assumptions. I'd also appreciate any recommendations for caching technologies.
Thanks.
© Server Fault or respective owner