Friday, April 24, 2009

Resource Caching for WSO2 Registry

Once I started employing at WSO2 I was assigned to work with WSO2 Registry which is again another useful product ships Under carbon platform. This is a Registry which users can keep all the resource in their SOA platform and manage all of those resource in elegant manner. As the very first job I was assigned was to implement resource caching for the WSO2 Registry.
In Registry every content is treated as Resource which is having a defined path for each resource to identify it. With resource caching when a particular user do a get operation for a particular resource first it checks in the Hashmap resurce is already cached or not so that it can find whether the user is going to do a new get operation or not. If user is doing a new get operation it adds that resource in to the Hashmap after checking the maximum size of the hashmap and directly get the resource from the serverside and return it. If that resource is already in the Hashmap it send the last modified date to the server side. In the server code it check whether somebody modified or not by comparing metadata of the resource and send a 304 HTTP header if nobody modified. If we get a 304 for the Remote Registry we just give the cached resource rather getting it from our server.
When users are dealing with large datasets this approach uses the users bandwith in an efficient manner rather getting resources from the serverside each and everytime user request for resources. You will be able to get this feature with our next release or if you are using our SVN repository it's already available for you.

No comments :