This page last changed on Aug 04, 2013 by orjo.
i`m manipulating a xml-file with a shell script on a linux machine executed by a lirc-command.
The xml-file is read out by OR und used for a sensor-status.
That is how it works
Button-Press (IR-RC) -> create temp.xml with changed value -> move temp.xml to webapps/status/status.xml (overwrite!)
When changing a value in the xml via the script(lirc) it`s availible within about 500ms in the webapps/status/status.xml
But refreshing the browser (without cache, STRG+F5) it takes about 3 to 5 seconds to get the new xml-file from tomcat.
So i think tomcat has a cache which delivers the old version to the browser.
Is there any possibility to work around this behaviour or disable tomcat "delivery-cache" completely.
Together with the polling interval of the OR-Sensor it takes sometimes about 10 seconds to refresh a label linked to the sensor (webconsole).
More "in-time" would be great.
I'm not aware there's any such cache in Tomcat.
I tried by creating a status webapp context and a status.xml in it. As far as I can tell the change is "immediate" (or as fast as I'm able to save file, switch to browser and reload the page, so maybe within one second). I used the regular browser reload which works fine as long as Tomcat default settings haven't been changed (dev mode checks the timestamps for changed files and serves them immediately, no caching)
The only difference I could think of is processing speed, what kind of system are you running on? Or if you've changed any of the Tomcat default configs?
Posted by juha at Aug 04, 2013 09:00
i didn`t do any changes to the tomcat standard config.
Openremote is running on a via Via Epia M860.
I tried to run a cat on the xml file in console window refreshing every second while refreshing the browser. (watch -n 1 cat /opt/openremote../status.xml)
In the xml file it is changed instant but the browser takes about 3 seconds to recognize the change.
CPU-Usage is never over 15% when sending massive IR-Requests and refreshing the browser very often.
Posted by orjo at Aug 04, 2013 09:18
Ok, can see the difference with watch. Thanks for that.
Looking at cache options in Tomcat default contexts. Will try if can make a difference. Learning something new today
Posted by juha at Aug 04, 2013 09:51
This seems to make a difference to me:
In controller's /conf/context.xml, modify the default <Context> with cache time-to-live attribute. Change:
This value defaults to 5000 milliseconds if not modified.
Note that changing this in the /conf/context.xml impacts every web application you deploy, as it is the default template if no other webapp specific context.xml is deployed.
For more information and reference, see : http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
Posted by juha at Aug 04, 2013 09:58
Thank you, now it`s "in time"
Posted by orjo at Aug 04, 2013 10:24
Little bit off topic but is there an oversight of which tags can be used in this forum?
I`m writing a how to and it would be great to use something like b.
Only found the tag somewehere in the forum.
Posted by orjo at Aug 04, 2013 11:27
This should help you get started: Wiki Markup Quick Start
Let us know if anything relevant is missing.
Posted by juha at Aug 04, 2013 11:30