开发者

How to load multiple jax-ws web services inside a single spring container

开发者 https://www.devze.com 2023-01-08 01:11 出处:网络
We are working on a SOA Project consisting of multiple web services. Each web service is based on Metro JAX-WS Framework and internally uses spring and hibernate.Each web service loads as a web-appli

We are working on a SOA Project consisting of multiple web services.

Each web service is based on Metro JAX-WS Framework and internally uses spring and hibernate.Each web service loads as a web-application inside a separate spring container.

This means that our deployment architecture consists of multiple web-applications each running a different service.

However we are facing some performance issues because each web-application loads its own spring container/hibernate session f开发者_开发百科actory.

Possible alternatives:

  1. Single web-application single spring context
  2. Multiple web-applications single spring context

All our web services will always run together on a single server. What will be the best architecture for our case? And how to achieve the same i.e. how to use a single spring context with multiple web services?


The "best" in "the best architecture" is quite subjective, as it depends on your current architecture, which you haven't defined very well.

However, I have some suggestions:

  1. Consider the impact on maintenance that consolidating all the business logic related to your services in a single web app will have, not to mention all the spring-configured-beans that you will have to inter-mangle to re-factor all you services. In that sense, keeping separate web apps tends to be better according to my experience.

  2. Consider to move the hibernate session factory away from each service and to a centralized location, for instance, in JBoss, you could create some type of "hibernate interface" in the way of a .HAR file, each service will only have to "ask" for a hibernate session. Maybe you could do something like that in your particular application server. There are several patterns to efficiently retrieve a Hibernate Session that apply here.

  3. Most web services performance issues are also associated with the way they are used, sync or async. We solved one such issue at my company by implementing a messaging systems under the covers to handle the web service requests asynchronously, whenever a request comes in you place them in a Queue, there are other services waiting for certain types of requests to process them. This can be easily implemented with Spring and ActiveMQ.

That's enough for the moment.

Regards.

0

精彩评论

暂无评论...
验证码 换一张
取 消