![Page 1: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/1.jpg)
End to End Caching Protocol for Web Services
Amila Liyanaarachchi
Shahani Weerawarana
![Page 2: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/2.jpg)
Outline• Background of the problem
• What needs to be improved related to WS performance
• Related research
• Proposed solution
• Architecture and Design
• Performance analysis
• Conclusion
• Future work
![Page 3: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/3.jpg)
Background
• Web services are widely used
• In some areas web services can’t deliver the expected performance requirements
• What are the key factors controlling web services performance?
![Page 4: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/4.jpg)
Literature: web services performance
• Network round-trip time [1]
• XML parsing overhead [2]
• XML parsing adds an additional overhead compared to binary peers used in distributed computing (Java RMI, CORBA) [3]
• Actual service execution time
![Page 5: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/5.jpg)
Factors affecting performance of WS
Client
Server
Network
![Page 6: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/6.jpg)
Factors affecting performance of WS
![Page 7: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/7.jpg)
Factors affecting performance of WS : XML Processing
<getPrice>
<part>IBM001</part>
</getPrice>
public double getPrice(String partNo)
{
…….
}
![Page 8: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/8.jpg)
Factors affecting performance of WS : Service Execution
public double getPrice(String partNo)
{
// Database access
...
// Computations
...
return price;
}
![Page 9: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/9.jpg)
What needs to be improved
• Avoid/Minimize network round trip delay
• Minimize XML processing overhead
• Avoid/Minimize service execution time
![Page 10: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/10.jpg)
Related research
• T. Takase et. al “A Web Services Cache Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML message in syntactically different forms.
• Uses XML canonicalization to address this problem.
![Page 11: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/11.jpg)
Related research …• Maintaining a mapping between the cached responses and origin data is always a problem in web services which effects cache invalidation.
• J. Tatemura et al “WReX: A Scalable Middleware Architecture to Enable XML Caching for Web-Services” [5] proposed a middleware architecture for RDBMS based web services enabling the aforementioned mapping.
![Page 12: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/12.jpg)
Related research …
• Cache key and cache value representations are very important in any caching scheme.
• T. Takase, M. Tatsubori “Efficient web services response caching by selecting optimal data representation” [1] evaluates several cache key representations
• Cache value representations are also evaluated and XML response, SAX event sequence, application objects are being considered.
![Page 13: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/13.jpg)
•Related research …
• When the number of parameters of the web service increases, hit rate of reverse proxy cache decreases.
• Application object caching is a good alternative in such scenarios
• Based on this concept research, L. Li et al "An adaptive caching mechanism for Web Services” [2], proposes an adaptive cache scheme based on the hit rate.
![Page 14: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/14.jpg)
•What can we learn from HTTP
• Information exchange similar to WS
• In both scenarios,
• A request from a client
• Server provides a response
• Caching has been utilized for improving performance
![Page 15: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/15.jpg)
•How does HTTP 1.1 caching work?
• Cache-Control HTTP Header & directives
• max-age
• public/private
• no-store
• must-revalidate
• HTTP Validation with E-tag
• Send the request with if-non-match directive
• Response should be HTTP 304 Not-modified/full resource
![Page 16: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/16.jpg)
•Proposed Solution
• Introduce caches at server as well as at client
• New cache managers controlling the protocol
![Page 17: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/17.jpg)
•Validation• A validation mechanism similar to HTTP validation using E-Tags
• Response hash* will be used as the e-tag in the new protocol
• Validation takes place against the cached copy at server cache
• * Axis2 implementation of DOMHash Algorithm will be used to generate the hash, which considers only the XML payload ignoring the namespace differences
![Page 18: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/18.jpg)
•Cache hit/miss scenarios
1. Client cache hit, no validation 2. Server cache hit
3. Client cache hit, validate 4. Cache miss
![Page 19: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/19.jpg)
How each performance bottle-neck is addressed in the proposed scheme?
• Client cache hit: Eliminates the service execution, XML processing at server, Network round-trip
• Server cache hit: Eliminates XML processing, Service execution
• Client cache hit with validation: if the stored copies are identical, full response will not sent to the client saving network bandwidth
![Page 20: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/20.jpg)
•Architecture and Design
• Proposed caching protocol was developed on Apache Axis2
• Axis2 is known to be a very good web services development platform
• Axis2 is easily extensible
![Page 21: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/21.jpg)
•Server Cache
• Extended WSO2 Carbon caching module
• Cache configuration information will be stored on deployment descriptors (module.xml, services.xml)
![Page 22: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/22.jpg)
•CachingInHandler• Initialize cache manager (if not already initialized)• Check if the service is cacheable• Check for already cached responses for the same
request• Attach the cached response object to operation
context, if it is expired then attach an empty object and clear the expired response from cache
• Service specific cache control parameters will be read from the services.xml and set them in the cached object
• Validation is also takes place at this handler, and the state will be stored in cached object
![Page 23: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/23.jpg)
•CachedMessageReceiver
• Extract the cached object from the operation context, and check if it is empty
• If the extracted cached object is non-empty then it will be returned in the out path
• Otherwise the actual service invocation will be done by the message receiver and the response will be return in the out path
![Page 24: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/24.jpg)
•CachingOutHandler
• Cached object will be extracted from the operation context
• If the cached object is empty then it will be updated with the response information
• Updated cached object will be linked with the cache manager
• Finally it will set the cache control SOAP headers in the response message
![Page 25: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/25.jpg)
•Configuration: module.xml
•Configuration: services.xml
![Page 26: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/26.jpg)
•Axis2 extended Client API (Class: CachedServiceClient)
• CachedServiceClient: extended from ServiceClient
• SendReceive:
• This method has overwritten to support caching
• Overloads to force service execution, get cached only responses
• Applications are supposed to use the CachedServiceClient instead of ServiceClient
![Page 27: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/27.jpg)
• Apache Derby database is used in the embedded mode to store cached responses at each client
•Client Cache
![Page 28: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/28.jpg)
•Idea: Managing the caching protocol
HTTP/1.1 200 OK
Date: Fri, 30 Oct 1998 13:19:41 GMT
Server: Apache/1.3.3 (Unix)
Cache-Control: max-age=3600, must-revalidate
ETag: "3e86-410-3596fbbc"
Content-Length: 1040
Content-Type: text/html
<?xml version="1.0"?>
<soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
<MAX-AGE>3600</MAX-AGE>
<ETAG>3e86-410-3596fbbc</ETAG>
</soap:Header>
<soap:Body xmlns:m="http://www.example.org/stock">
<m:StockPrice>
<m:StockName>IBM</m:StockName>
<m:Price>200</m:Price>
</m:StockPrice>
</soap:Body>
</soap:Envelope>
![Page 29: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/29.jpg)
•New SOAP headers used in the protocol
• max-age
• no-store
• must-revalidate
• etag
• if-non-match
• not-modified
• only-if-cached
• force-service
![Page 30: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/30.jpg)
•Performance Analysis
• Following tests were performed
• Performance with different cache hit/miss scenarios
• Average response time vs. response message size
• Average response time vs. service execution time
• Average response time was measured by repeating the same test 100 times
![Page 31: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/31.jpg)
A service with service execution time ~500ms was used in this test
•Results
![Page 32: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/32.jpg)
![Page 33: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/33.jpg)
•Results: Average response time vs. service execution time
A: Average response time with re-validation offB: Average response time with re-validation onE: Average response time with no caching
0
50
100
150
200
250
300
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Ave
rage
re
spo
nse
tim
e (
ms)
Service execution time (ms)
A
B
E
![Page 34: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/34.jpg)
•Results: Average response time vs. service execution time
A: Average response time with re-validation offB: Average response time with re-validation onE: Average response time with no caching
0
50
100
150
200
250
300
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Ave
rage
re
spo
nse
tim
e (
ms)
Service execution time (ms)
A
B
E
![Page 35: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/35.jpg)
•Results: Average response time vs. service execution time
A: Average response time with re-validation offB: Average response time with re-validation onE: Average response time with no caching
0
50
100
150
200
250
300
350
0 50 100 150 200 250
Ave
rage
re
spo
nse
tim
e (
ms)
Service execution time (ms)
E
A
B
![Page 36: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/36.jpg)
•Conclusion
• This protocol addresses 2 out of 3 performance bottle necks identified in WS user scenarios
• According to the results this protocol delivers better performance when the service execution time is greater than 80ms
![Page 37: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/37.jpg)
•Future Work
• Use of HTTP headers instead of new SOAP headers to exchange cache control information when the transport is HTTP
![Page 38: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/38.jpg)
•References• [1] T. Takase, M. Tatsubori, “Efficient web services response caching by selecting
optimal data representation”, Proceedings of the 24th IEEE International Conference on Distributed Computing Systems (ICDCS'04), pp: 188-197, 2004
• [2] L. Li, C. Niu, H. Zheng, J. Wei, "An adaptive caching mechanism for Web Services", Proceedings of the IEEE Sixth International Conference on Quality Software, pp: 303-312, 2006.
• [3] D.Davis and M.Parashar. “Latency performance of SOAP implementations”, In Proceedings of the 2nd IEEE/ACM International Symposium on Cluster Computing and the Grid, pp: 407-412, 2002.
• [4] T. Takase, Y. Nakamura, R. Neyama, H. Eto, "A Web Services Cache Architecture Based on XML Canonicalization", IBM Research, 2002. [Online]. Available: http://www.www2002.org/CDROM/poster/126/ [Accessed: November 2009]
• [5] J. Tatemura et al, "WReX: A Scalable Middleware Architecture to Enable XML Caching for Web-Services", Proceedings of the ACM/IFIP/USENIX 2005 International Conference on Middleware, pp: 124-143, 2005.
![Page 39: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/39.jpg)
THANK YOU!
![Page 40: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/40.jpg)
•Appendix: Architecture - Axis Engine• Axis2 engine’s SOAP processing model consists of in and out pipes names flows
• There are four such flows,• In-Flow
• Out-Flow
• In-Fault-Flow
• Out-Fault-Flow
• All incoming messages will come through the in-flow and the out going messages will follow the out-flow
![Page 41: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/41.jpg)
•Appendix: Architecture - Axis Engine …
• Each flow consists of a set of phases
• Phases are further divided into smaller components called handlers
• A group of logically related handlers are grouped in to one module
![Page 42: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/42.jpg)
•Appendix: Axis2 Information model
![Page 43: End to End Caching Protocol for Web Services · 2016. 6. 26. · Architecture Based on XML Canonicalization” [4], discusses the problem of representing semantically identical XML](https://reader033.vdocuments.us/reader033/viewer/2022060905/60a0ab6fe33d7253613001b0/html5/thumbnails/43.jpg)
Appendix: Axis2 Client API (Class: ServiceClient)• SendRobust:
• Send request and ignore response, exception on invocation problems.
• FireAndForget: • Send request and ignore response (IN-ONLY MEP)
• SendReceive: • Send request, accept return value (IN-OUT MEP)
• SendReceiveNonBlocking: • Similar to SendReceive but non blocking invocation