Skip to content

Commit

Permalink
Disable cache TTL by default
Browse files Browse the repository at this point in the history
The current cache TTL default is 30 minutes, which is relatively short
and could easily lead to hiccups if there is a lull in data, a schema is
removed from the cache and Daffodil needs to recompile it when data
starts flowing again.

To avoid these hiccups, this changes the default to 0 seconds, which
means to never remove schemas from the cache. In most cases, if a user
uses a schema once they are probably going to use it again, so this
avoids recompilations that could lead to unexpected latencies.
  • Loading branch information
stevedlawrence committed Jan 30, 2024
1 parent 67ca394 commit afd0d57
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public abstract class AbstractDaffodilProcessor extends AbstractProcessor {
public static final PropertyDescriptor CACHE_SIZE = new PropertyDescriptor.Builder()
.name("cache-size")
.displayName("Cache Size")
.description("Maximum number of compiled DFDL schemas to cache. Zero disables the cache.")
.description("Maximum number of compiled DFDL schemas to cache. Zero disables the cache. Restart the processor to manually empty the cache and recompile/reload schemas as needed.")
.required(true)
.defaultValue("50")
.addValidator(StandardValidators.NON_NEGATIVE_INTEGER_VALIDATOR)
Expand All @@ -138,9 +138,9 @@ public abstract class AbstractDaffodilProcessor extends AbstractProcessor {
public static final PropertyDescriptor CACHE_TTL_AFTER_LAST_ACCESS = new PropertyDescriptor.Builder()
.name("cache-ttl-after-last-access")
.displayName("Cache TTL After Last Access")
.description("The cache TTL (time-to-live) or how long to keep compiled DFDL schemas in the cache after last access.")
.description("Defines how long keep unused compiled DFDL schemas in the cache before removing them to free memory. Defaults to '0 seconds' which means to never remove cached schemas. Restart the processor to manually empty the cache and recompile/reload schemas as needed.")
.required(true)
.defaultValue("30 mins")
.defaultValue("0 seconds")
.addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@ <h2>Compiled DFDL Schema Cache</h2>
Cached compiled DFDL schemas that go unused for a specified amount of time are removed from the cache to
save memory. This time is defind by the <tt>Cache TTL after last access</tt> property, with the format of
<tt>&lt;duration&gt; &lt;time_unit&gt;</tt>, where <tt>&lt;duration&gt;</tt> is a non-negative integer and
<tt>&lt;time_unit&gt;</tt> is a supported unit of time, such as nanos, millis, secs, mins, hrs, days. If set
to zero (e.g. "0 seconds"), cached compiled DFDL schemas are never removed from the cache. The default value
is 30 minutes.
<tt>&lt;time_unit&gt;</tt> is a supported unit of time, such as nanos, millis, secs, mins, hrs, days. The
default is "0 seconds", which means compiled DFDL schemas are never removed from the cache.
</p>
<p>
For example, if a schema is used occasionally (once a day perhaps), then set this to <tt>24 hours</tt> to
Expand All @@ -150,6 +149,9 @@ <h2>Compiled DFDL Schema Cache</h2>
</dd>
</dl>
</p>
<p>
Restart the processor to manually empty the cache and recompile/reload schemas as needed.
</p>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,8 @@ <h2>Compiled DFDL Schema Cache</h2>
Cached compiled DFDL schemas that go unused for a specified amount of time are removed from the cache to
save memory. This time is defind by the <tt>Cache TTL after last access</tt> property, with the format of
<tt>&lt;duration&gt; &lt;time_unit&gt;</tt>, where <tt>&lt;duration&gt;</tt> is a non-negative integer and
<tt>&lt;time_unit&gt;</tt> is a supported unit of time, such as nanos, millis, secs, mins, hrs, days. If set
to zero (e.g. "0 seconds"), cached compiled DFDL schemas are never removed from the cache. The default value
is 30 minutes.
<tt>&lt;time_unit&gt;</tt> is a supported unit of time, such as nanos, millis, secs, mins, hrs, days. The
default is "0 seconds", which means compiled DFDL schemas are never removed from the cache.
</p>
<p>
For example, if a schema is used occasionally (once a day perhaps), then set this to <tt>24 hours</tt> to
Expand All @@ -151,6 +150,9 @@ <h2>Compiled DFDL Schema Cache</h2>
</dd>
</dl>
</p>
<p>
Restart the processor to manually empty the cache and recompile/reload schemas as needed.
</p>

</body>
</html>

0 comments on commit afd0d57

Please sign in to comment.