This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/struts-site.git
The following commit(s) were added to refs/heads/asf-site by this push: new 3220bd697 Automatic Site Publish by Buildbot 3220bd697 is described below commit 3220bd69709bdff3b8d6df9cc7be0ecda2cbfef4 Author: buildbot <us...@infra.apache.org> AuthorDate: Fri Jan 3 06:45:53 2025 +0000 Automatic Site Publish by Buildbot --- output/core-developers/performance-tuning.html | 37 ++++++++++++++++++-------- output/tag-developers/freemarker.html | 16 +++++------ 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/output/core-developers/performance-tuning.html b/output/core-developers/performance-tuning.html index e7bffee72..074a11a4f 100644 --- a/output/core-developers/performance-tuning.html +++ b/output/core-developers/performance-tuning.html @@ -149,34 +149,45 @@ <section class="col-md-12"> <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/performance-tuning.md" title="Edit this page on GitHub">Edit on GitHub</a> - <h1 id="performance-tuning">Performance Tuning</h1> - -<h2 id="performance-tuning-1">Performance tuning</h2> + <h1 class="no_toc" id="performance-tuning">Performance Tuning</h1> + +<ul id="markdown-toc"> + <li><a href="#turn-off-logging-and-devmode" id="markdown-toc-turn-off-logging-and-devmode">Turn off logging and devMode</a></li> + <li><a href="#use-the-java-templates" id="markdown-toc-use-the-java-templates">Use the Java Templates</a></li> + <li><a href="#do-not-use-interceptors-you-do-not-need" id="markdown-toc-do-not-use-interceptors-you-do-not-need">Do not use interceptors you do not need</a></li> + <li><a href="#use-the-correct-http-headers-cache-control--expires" id="markdown-toc-use-the-correct-http-headers-cache-control--expires">Use the correct HTTP headers (Cache-Control & Expires)</a></li> + <li><a href="#copy-the-static-content-from-the-struts-2-jar-when-using-the-ajax-theme-dojo-or-the-calendar-tag" id="markdown-toc-copy-the-static-content-from-the-struts-2-jar-when-using-the-ajax-theme-dojo-or-the-calendar-tag">Copy the static content from the Struts 2 jar when using the Ajax theme (Dojo) or the Calendar tag</a></li> + <li><a href="#create-a-freemarkerproperties-file-in-your-web-infclasses-directory" id="markdown-toc-create-a-freemarkerproperties-file-in-your-web-infclasses-directory">Create a freemarker.properties file in your WEB-INF/classes directory</a></li> + <li><a href="#enable-freemarker-template-caching" id="markdown-toc-enable-freemarker-template-caching">Enable Freemarker template caching</a></li> + <li><a href="#when-overriding-a-theme-copy-all-necessary-templates-to-the-theme-directory" id="markdown-toc-when-overriding-a-theme-copy-all-necessary-templates-to-the-theme-directory">When overriding a theme, copy all necessary templates to the theme directory</a></li> + <li><a href="#do-not-create-sessions-unless-you-need-them" id="markdown-toc-do-not-create-sessions-unless-you-need-them">Do not create sessions unless you need them</a></li> + <li><a href="#when-using-freemarker-try-to-use-the-freemarker-equivalent-rather-than-using-the-jsp-tags" id="markdown-toc-when-using-freemarker-try-to-use-the-freemarker-equivalent-rather-than-using-the-jsp-tags">When using Freemarker, try to use the Freemarker equivalent rather than using the JSP tags</a></li> +</ul> <p>The following are some tips and tricks to squeeze the most performance out of Struts 2.</p> <blockquote> <p>For Struts 2 versions before 2.3: the OGNL version 3.0.3 library is a drop-in replacement for older OGNL jars, and provides <strong>much</strong> better performance. See the following JIRA issue for more information: -<a href="https://issues.apache.org/jira/browse/WW-3580">https://issues.apache.org/jira/browse/WW-3580</a></p> +<a href="https://issues.apache.org/jira/browse/WW-3580">WW-3580</a></p> </blockquote> <h2 id="turn-off-logging-and-devmode">Turn off logging and devMode</h2> -<p>The <a href="development-mode">devMode</a> allows reloading of configuration and validation related files, but because they -happen on each request, this setting will totally kill your performance. +<p>The <a href="development-mode">devMode</a> allows reloading of configuration and validation related files, but because they happen on each +request, this setting will totally kill your performance. When using logging, make sure to turn off logging (esp. Freemarker generates a LOT of logging), and check if a level is enabled before printing it, or you will get the cost of the String parsing/concatenation anyways.</p> <h2 id="use-the-java-templates">Use the Java Templates</h2> <p>If you use the simple theme, and do not overwrite any of the FreeMarker templates, consider using the <a href="../plugins/javatemplates-plugin/">java templates</a>, -which provide a drop in replacement for most tags, and are a lot faster than the regular tags.</p> +which provide a drop in replacement for most of the tags, and are a lot faster than the regular tags.</p> <h2 id="do-not-use-interceptors-you-do-not-need">Do not use interceptors you do not need</h2> <p>If you do not require a full stack of interceptors for an Action, then try using a different one (basicStack), -or remove interceptors you do not need. Remove the I18nInterceptor interceptor if you don’t need it, as it can cause +or remove interceptors you do not need. Remove the <code class="language-plaintext highlighter-rouge">I18nInterceptor</code> interceptor if you don’t need it, as it can cause a session to be created.</p> <h2 id="use-the-correct-http-headers-cache-control--expires">Use the correct HTTP headers (Cache-Control & Expires)</h2> @@ -186,7 +197,7 @@ a session to be created.</p> <h2 id="copy-the-static-content-from-the-struts-2-jar-when-using-the-ajax-theme-dojo-or-the-calendar-tag">Copy the static content from the Struts 2 jar when using the Ajax theme (Dojo) or the Calendar tag</h2> <p>Struts 2 uses some external javascript libraries and cascading stylesheets for certain themes and tags. These by default -are located inside the Struts 2 jar, and a special filter returns them when requesting a special path (<code class="language-plaintext highlighter-rouge">/struts</code>). +are located inside the Struts 2 jar, and a special filter returns them when requesting a special path (<code class="language-plaintext highlighter-rouge">/static</code>). Although Struts 2 can handle these requests, an application/servlet container is not optimized for these kind of requests. Consider moving these .js and .css files to a seperated server (Lighttpd, Apache HTTPD, ..).</p> @@ -201,12 +212,16 @@ Consider moving these .js and .css files to a seperated server (Lighttpd, Apache is 500 ms. Since there is no reason to check if a template needs reloading, it is best to set this to a very large value. Note that this value is in seconds and freemarker will convert this value to milliseconds.</p> -<p>You can also use <code class="language-plaintext highlighter-rouge">struts.freemarker.templatesCache.updateDelay</code> constant to achieve the same effect.</p> +<p>You can also use <code class="language-plaintext highlighter-rouge">struts.freemarker.templatesCache.updateDelay</code> constant to achieve the same effect.</p> -<p>See also: <a href="http://freemarker.sourceforge.net/docs/api/freemarker/template/Configuration.html\#setSetting(java.lang.String,%20java.lang.String)">Freemarker configuration properties</a></p> +<p>See also: <a href="https://freemarker.apache.org/docs/pgui_config_settings.html">Freemarker configuration properties</a></p> <h2 id="enable-freemarker-template-caching">Enable Freemarker template caching</h2> +<blockquote> + <p>Note: support for this options has been removed in Struts. See the <a href="../tag-developers/freemarker#cache">Cache</a> section of the FreeMarker page.</p> +</blockquote> + <p>As of Struts 2.0.10, setting the property <code class="language-plaintext highlighter-rouge">struts.freemarker.templatesCache</code> to true will enable the Struts internal caching of Freemarker templates. This property is set to false by default.</p> diff --git a/output/tag-developers/freemarker.html b/output/tag-developers/freemarker.html index 42733d9ed..e40697efa 100644 --- a/output/tag-developers/freemarker.html +++ b/output/tag-developers/freemarker.html @@ -466,10 +466,10 @@ logic to take place instead.</p> <ul> <li><code class="language-plaintext highlighter-rouge"><constant name="struts.freemarker.mru.max.strong.size" value="250" /></code> - this option will be used -by <a href="http://freemarker.org/docs/api/freemarker/cache/MruCacheStorage">freemarker.cache.MruCacheStorage</a></li> - <li><code class="language-plaintext highlighter-rouge"><constant name="struts.freemarker.templatesCache.updateDelay" value="1800" /></code> - default update cache interval (5 seconds) --<code class="language-plaintext highlighter-rouge"><constant name="struts.freemarker.templatesCache" value="true" /></code> - *<strong>DEPRECATED</strong>* this option will use a internal -ConcurrentHashMap in FreemarkerTemplateEngine but not freemarker native cache</li> +by <a href="http://freemarker.org/docs/api/freemarker/cache/MruCacheStorage">freemarker.cache.MruCacheStorage</a>, see also <a href="https://freemarker.apache.org/docs/pgui_config_templateloading.html#pgui_config_templateloading_caching">Template caching</a>.</li> + <li><code class="language-plaintext highlighter-rouge"><constant name="struts.freemarker.templatesCache.updateDelay" value="60 s" /></code> - default update cache interval (60 seconds), as from <a href="https://freemarker.apache.org/docs/versions_2_3_23.html#autoid_176">FreeMarker 2.3.23</a> timeunits are also supported</li> + <li><code class="language-plaintext highlighter-rouge"><constant name="struts.freemarker.templatesCache" value="true" /></code> - <strong>DEPRECATED</strong> this option will use an internal +ConcurrentHashMap in FreemarkerTemplateEngine but not freemarker native cache (this option has been removed in the latest Struts versions)</li> </ul> <p>Setting <code class="language-plaintext highlighter-rouge">devMode</code> to <code class="language-plaintext highlighter-rouge">true</code> will disable cache and updateDelay immediately, but you can explicit specify these constants @@ -477,15 +477,15 @@ to enable cache even in <code class="language-plaintext highlighter-rouge">devMo <h3 id="incompatible-improvements">Incompatible Improvements</h3> -<p>By default Struts is using FreeMarker in way to be backward compatible as much as possible but if you need to enable new -features you can do it via <code class="language-plaintext highlighter-rouge">freemarker.properties</code> by defining +<p>By default, Struts is using FreeMarker in way to be backward compatible as much as possible but if you need to enable new +features you can do it via <code class="language-plaintext highlighter-rouge">freemarker.properties</code> by defining <a href="http://freemarker.org/docs/pgui_config_incompatible_improvements.html#pgui_config_incompatible_improvements_how_to_set">incompatible improvements</a> -settings, ie.:</p> +settings, i.e.:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>incompatible_improvements=2.3.22 </code></pre></div></div> -<p>You can also pass this setting via <code class="language-plaintext highlighter-rouge">ServletContext</code> setting <code class="language-plaintext highlighter-rouge"><init-param/></code> (since Struts 2.5.13):</p> +<p>You can also pass this setting via <code class="language-plaintext highlighter-rouge">ServletContext</code> setting <code class="language-plaintext highlighter-rouge"><init-param/></code> (since Struts 2.5.13):</p> <div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt"><init-param></span> <span class="nt"><param-name></span>freemarker.incompatible_improvements<span class="nt"></param-name></span>