On 04/10/18 14:41, Berneburg, Cris J. - US wrote:
> Hi Folks
> 
> Anyone have advice on, experience with, or info about setting 
> cachingAllowed=false?
> 
> BACKGROUND:
> 
> Our customer is suddenly getting a JasperException in production.  To solve, 
> we're planning to upgrade Tomcat to 8.5.x.  In our testing of TC 8.5.32 on 
> Java 8u181, report output Excel files won't load (immediately).  An error is 
> displayed to the user.  These Stack Overflow topics below point to a 
> cachingAllowed setting:
> 
> - 
> https://stackoverflow.com/questions/44852505/tomcat-8-5-takes-too-long-to-recognize-new-content
> 
> - https://stackoverflow.com/questions/3743136/how-to-disable-tomcat-caching
> 
> I added <Resources cachingAllowed="false" /> to the <Context> in 
> TC/conf/context.xml, which solved the problem.
> 
> QUESTIONS:
> 
> 1. What are the ramifications of disabling the cache?  IOW, what are the 
> potential side-effects?

The cache keeps the contents of static files in memory to improve
performance. In theory - the more of your requests that can be served
from memory, the faster the response time. The side effect is a slower
response time. How much actual difference this feature makes will depend
on how much static content there is in your app, how frequently it is
requested and how frequently it is changed.

> 2. Is there a "better" way to specify the setting?

Maybe. The change you made applied that setting to ALL web applications
in that Tomcat instance. If you only wanted to apply it to "/foo" then
you would create:
$CATALINA_BASE/conf/<engine-name/<host-name>/foo.xml
and add content something like:
<Context>
  <Resources cachingAllowed="false" />
</Context>

> 3. Is there a "better" way to solve the problem?

For a given value of "better"...

What is happening is that:
- "something 1" requests the file
- the file is not found and the cache records this
- "something 2" creates the file
- "something 3" requests the newly created file
- the cache is still valid so the not found' response is returned
- time passes, 'not found' cache response expires
- "something 4" requests the newly created file which is now returned

something 1/2/3/4
- may all be different
- some may be the same
- may be Tomcat or application code

What you'd need to figure out is what is "something 1" and what triggers
it before "something 2". With that information, you should be able to
refactor the app so "something 1" doesn't happen or happens after
"something 2".

> CAVEATS:
> 
> a. This is a low-volume application.  Little traffic and few users.
> 
> b. Seeing as we're addressing production, we would like to implement a rapid 
> solution.  Don't want to refactor the application, which would take more time.
> 
> THANKS: for your time and assistance!

Given the caveats, you solution looks to be the best (assuming
performance is acceptable).

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to