Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

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
 
Would anybody like some fudge? I made it an hour ago. And it goes well with a tiny ad ...
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic