Cache Cache Cache – series 1

hi web crasher,
(it was prepared for
(this post is cross published over
i belief many JPGroup members are utilizing cache in most of the case. in my short post i will show few caching plan and tools.

today, i will highlight on web cache related stuff, let’s imagine we can’t modify our source code, no application level cache. this cache will be maintained separately.

My intended readers are those who didn’t get in touch with web cache related stuffs and those who heard these terms, but didn’t give a try on their project yet.

Let’s assume “” a site which you have developed, it is a community driven portal, you are expecting 2000 users who will browse this site with in few couple of hours.

so one fine releasing date, you got kicked off, you didn’t expect that you will get around 5000 users with in couple of hours. god damn… you have two severs with distributed session. both are in low latency network. you found your server “A1” is wasting 50% processor on each request. Obviously lot of tuning over your code is left.

let’s assume, your community site have many aggregation stuffs. for example, the recent user list, the most rated stuffs, most hated stuffs, tag cloud, most comment shit, many things.

obviously, you can’t reduce any feature otherwise it won’t have any difference with other community sites.

so what was happened then, let me continue the story. while your server “A1” was frequently utilizing 50% processor, and your another server “A2” was almost utilizing the same processor, you have heavy database processing and many calculation and many stuffs.

So you have hired a consultant to resolve this problem, now let me pretend what he will do with your project.

You had few preconditions:

1. you can’t change the source or anything won’t be happened over development related stuff.
2. you have been assigned a shortest time, so the consultant has to do it before you dead.
Your hired guy may be happy because of your preconditions, because few stuffs that already helping on this kind of problem.

# Reverse proxy:
[visitor] [proxy server with cache] [application server]
Now how it will help to solve your problem:

1. Visitor won’t get access to your application server,
2. All heavily functional pages will be served from proxy server’s cache
3. proxy server to application connection is in low latency network
What is the changes?
The following changes will boost your community site’s performance.

1. the heavily database or complex logic related functions won’t be executed every time.
2. visitor won’t get 100% up to date data on the fly, perhaps it will take bit longer time based on your cache expire rule.
3. it doesn’t require any code related change.
4. many products and open source stuffs are available on the shelf
5. not suitable for heavily dynamic site, where every second is a change.
6. proxy server can be utilized for load balancing, later you can add more servers.
7. common solution apache with mod_proxy or separate dedicated proxy server. Squid, varnished (which is a modified version of squid proxy server, introduced by linpro)

Have a look on the wiki page, for more proxy server product.

# OSCache servlet filter
This is another alternative solution, it will require few changes on “web.xml” file.
You have to put a OSCache filter servlet, which will cache each and every unique request. For expiring all these cache you can set up the cache expire event.

OSCache servlet filter is easy to use, and you can write your cache expire rule on a java class. As it is not the change on your core system, so no conflict with your preconditions.

# Oracle web cache
Oracle has reverse proxy type solution which they have labeled as “Web cache”
It can scale your community site, it had coupling with oracle application server. So if your application server is oracle$ application server, you can give a try.
That’s all for today.
Best wishes for those who died 21st February to bring our mother tongue.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

my tweets

February 2007
« Jan   Mar »

Flickr Photos

RSS my shared links on google reader

  • An error has occurred; the feed is probably down. Try again later.
%d bloggers like this: