20031121 Friday November 21, 2003

RE: Compressing and Caching in your webapps Jayson Falkner writes about two Filters everyone should have in their webapps: one for compression (via gzip) and one for caching. I try to add a CompressionFilter to all the apps I write, but I don't have a CacheFilter. So my question is: should I add Jayson's CacheFilter to AppFuse or should I use OSCache? I haven't got to Dave's chapter yet on performance and caching (in JSP 2.0), so I haven't read his opinion - what's your opinion? I like Jayson's solution because I can add 3 new classses with no additional JARs - AppFuse already has 21 jars (Struts, Hibernate, JSTL + a few other taglibs). Posted in Java at Nov 21 2003, 11:57:41 AM MST 4 Comments

Comments:

"caching at the filter level is most helpful, as it allows you to save the entire response any particular JSP" JSP's normaly display content from DB, which is dynamic. I do caching in DAO that does auto flush on updates. So I say caching is for static jsp's, hence no use, unless you are trying to cheat on a stress test. But gzip.... hmmm. .V

Posted by Vic on November 21, 2003 at 12:37 PM MST #

Vic, you still have the rendering layer to go through however. Caching the JSP's output saves you even that step. Matt, I think that if you aren't concerned with all the caching bells-and-whistles (distribution, multiple eviction strategies, et al) that Jayson's solution should work just fine. But I wish he had factored out some of the code better, it was a bit painful to read ;-)

Posted by Lance on November 21, 2003 at 01:25 PM MST #

Were you able to make the CompressionFilter work on tomcat 4.1.18+? I have a similar CompressionFilter but the problem is Tomcat's PageContextImpl.release method will not flush the jsp output into the OutputStream/Writer wrapper thus in the compression filter I could not get any data to compress. I wonder how you could get around the problem other than having an explicit "out.flush()" in the jsp code. Thanks

Posted by Vincent on November 23, 2003 at 11:46 PM MST #

I got my problem figured out: I was confused for a while how to force the data flush. I guess you also need call flush on the PrintWriter in your wrapper before returning the character array. this will force the data to be flushed from the printwriter into your char writer

Posted by Vincent on November 24, 2003 at 12:23 AM MST #

Post a Comment:
Comments are closed for this entry.
Click me to subscribe
Matt Raible is the Lead UI Architect at LinkedIn. The opinions on this site are mine, not my employers.
« November 2008
SunMonTueWedThuFriSat
      
1
2
3
6
7
8
9
10
11
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
      
Today

Recent Entries

Tag Cloud