• 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

Caching

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sometimes I worry about performance on our web-apps, anyone can offer tools/tips/techniques for caching certain parts of better performance?
D
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Depends on your application. If you're building/maintaining a global application you might want to look into hosted content like Akamai, Keynote, Pivia or into Application Delivery Networks (there was a good article on computerworld.com on this recently).
If you're question is more towards the feasibility of caching anything for a web application than gif/js/static content is always good to look at. Storing static content on the web server reduces lookup times for these elements, which in turn reduces network traffic between your web servers and app servers. Of course if you're in a small intranet environment you might as well cache these things on the clients themselves, but the effort maintaining these caches and distributing content outweigh the performance improvements.
Web Servers and reverse proxies usually offer different levels of caching. Check out web-cache.com for a list of products and research in this area.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, depends on the application. As far as code performance, first tip would be use pooled database connections. Next, if you retrieve and display a lot of data, examine what you are showing and determine if you really have to load it fresh on every page view. If you show information that typically will not change for a day or longer, consider loading it on startup and caching it. Just remember to provide a way to manually refresh it at any time (admin page) as well as a scheduled refresh as well (I like to use TimerTasks). Don't create caches that can only be refreshed by restarting the server....that's just messy.
Also, consider running a profiler against your code. If you see an inordinate amount of instances of one or more objects being created to perform repeated tasks, you may want to consider either refactoring that logic, or using object pools. Object pools can help offset performance problems when going from low load to a sudden spike of activity in object heavy code. Also look for a lot of time being spent in specific sections of code...perhaps the logic there could be improved to reduce the slowdown.
Finally, make sure you consider and address multi-threaded access to your cached data. You don't want your caches to get corrupted or invalidated because two threads try to modify at the same time.
my 2 cents.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic