• 2 replies
  • Latest Post - ‏2013-07-29T15:38:16Z by c.high
1 Post

Pinned topic How to cache JAXBContext in JAX-WS 2.2 Web Services

‏2013-07-28T15:08:05Z | jax-ws jaxb jaxbcontext


We have developer a Web-Service using JAX-WS 2.2 JAXB 2.x over SOAP 1.1. The services are running on WebSphere Application Server on z/OS. They are fully functional but we see even a simple operation is taking huge amount of CPU. 

We could see from profiling tools like Dynatrace or JProfiler that JAXBContext creation (newInstance) and IBM API classes of JAXB is chewing up 90% of the CPU. 10% is business logic. 

We need to tune the service on z/OS and bring down the CPU usage:

Based on our research it seems JAXBContext creation is very costly and we can create JAXBContext under application scope in the first request and then cache it for successive calls. Seen the annotation on JAX-WS @Usesjaxbcontext. 

Any help/sample code snippet on how to cache the JAXBContext and use @usesjaxbcontext annotation will be much appreciated. Or if you have any suggestions on how to tune CPU usage of the service on z/OS WAS-8.x will help. 

Thanks Jayanta