• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Shared some object that everyone can use?

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am maintaining a web application which use struts 1 and web service(WS). I found that there are some WS calls which are very common that every user will repeatly need it (resulted object is same for everyone). Since WS call take times and some function need to do a few WS call in a row, the performance is not good.

1. First solution in my mind is to save the WS call result (object) in the session when the user got it from the WS call for the first time, then try to retrieve it from session whenever the user want to use it again.
2. Second solution: when deploy the application, call those WS functions and save the resulted object somewhere (in session?), then each user can get it when it is needed. I don't know how to do it if this method is applicable.

Not know which solution is better or there is other better solution? Any advices?

Thanks.
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

david arnold wrote:Hi,

I am maintaining a web application which use struts 1 and web service(WS). I found that there are some WS calls which are very common that every user will repeatly need it (resulted object is same for everyone). Since WS call take times and some function need to do a few WS call in a row, the performance is not good.

1. First solution in my mind is to save the WS call result (object) in the session when the user got it from the WS call for the first time, then try to retrieve it from session whenever the user want to use it again.
2. Second solution: when deploy the application, call those WS functions and save the resulted object somewhere (in session?), then each user can get it when it is needed. I don't know how to do it if this method is applicable.

Not know which solution is better or there is other better solution? Any advices?

Thanks.



Looking at your explanation, the data returned by the web service is independent of the user in context. i would suggest you to cache the response using a good lightweight caching framework.

For example, if you have a service "ServiceA" which has operation "getData" which internally makes WS call and returns objects as return value. then it would be a nice idea to intercept the call to getData (using AOP may be) and get the data from internal cache... if you dont find the data in cache then delegate the intercepted call to the actual service and on return place the value in the cache for further use.

This way you wont have stale data in your cache if the web service response changes time to time...

Hope this helps.


John
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic