Skip to content

Instantly share code, notes, and snippets.

@aitseitz
Last active January 16, 2025 13:05
Show Gist options
  • Save aitseitz/4ddf03cb3be6913ab44f2ffcb8ce06ec to your computer and use it in GitHub Desktop.
Save aitseitz/4ddf03cb3be6913ab44f2ffcb8ce06ec to your computer and use it in GitHub Desktop.
ACS "consider increasing the maximum size of the cache"
INFO [localhost-startStop-1] [catalina.startup.HostConfig] Deploying deployment descriptor [/opt/content-services/tomcat/conf/Catalina/localhost/share.xml]
...
WARN [localhost-startStop-1] [catalina.webresources.Cache] Unable to add the resource at [/WEB-INF/classes/] to the cache for web application [/share] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache
WARN [localhost-startStop-1] [catalina.webresources.Cache] Unable to add the resource at [/WEB-INF/classes/] to the cache for web application [/share] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache
WARN [localhost-startStop-1] [catalina.webresources.Cache] Unable to add the resource at [/WEB-INF/classes/] to the cache for web application [/share] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache
...
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<!-- If we deploy applications in our server that still uses System.out and/or System.err,
we can force them to use our logger adding swallowOutput="true" in the default
$CATALINA_BASE/conf/context.xml of the server.
-->
<Context swallowOutput="true">
<!-- Default set of monitored resources. If one of these changes, the -->
<!-- web application will be reloaded. -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
<!-- If not specified, the default cacheMaxSize value is 10240 kb (10 megabytes)
and the default cacheObjectMaxSize is 512kb (0.5 megabytes)
see: http://tomcat.apache.org/tomcat-8.5-doc/config/resources.html
Increased Cache value to get rid of the WARN messages:
WARN Unable to add the resource at [/WEB-INF/classes/] to the cache for web application [/share]
because there was insufficient free space available after evicting expired cache entries
- consider increasing the maximum size of the cache
-->
<Resources cachingAllowed="true" cacheMaxSize="{{ tomcat_resource_cache_max_size | default ('10240') }}" cacheObjectMaxSize="{{ tomcat_resource_cache_object_max_size | default('512') }}" />
</Context>
<?xml version='1.0' encoding='utf-8'?>
<Context crossContext="true" docBase="{{ acs_home }}/war_delivery/{{ share_war_name.files[0].path | basename }}">
<Resources cacheMaxSize="51200" cacheObjectMaxSize="1024">
<PostResources base="${catalina.base}/modules/share"
className="org.apache.catalina.webresources.DirResourceSet"
webAppMount="/WEB-INF/lib"/>
</Resources>
</Context>
@aitseitz
Copy link
Author

aitseitz commented Jul 12, 2021

How to handle "consider increasing the maximum size of the cache" Messages when booting up Alfresco Content Services

If you follow the Alfresco Content Services Installation via distribution.zip you might end up getting the following WARN Messages when booting up the Tomcat:

WARN [localhost-startStop-1] [catalina.webresources.Cache] Unable to add the resource at [/WEB-INF/classes/] to the cache for web application [/share] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache

Solutions:

You have serveral options to handle that kind of WARN message

  • Increase cache (recommended)
  • Lower the TTL (not recommended)
  • Suppress cache log warnings (not recommended)
  • Disable cache

which are really good described in this stackoverflow case:
https://stackoverflow.com/questions/26893297/tomcat-8-throwing-org-apache-catalina-webresources-cache-getresource-unable-to

In case of Alfresco and Share the solution to increase just the case size globally via
$CATALINA_BASE/conf/context.xml like
<Resources cacheMaxSize="XXXXX" />
is not enough to get rid of all the WARN messages. Specially for the /share context we also need to increase the cacheObjectMaxSize from default 512kb to at least 1024kb.

This can either be done globally in the $CATALINA_BASE/conf/context.xml
with
<Resources cacheMaxSize="204800" cacheObjectMaxSize="1024">
or via the share.xml deployment descriptor to increase only the objectCache for share.war:

  <?xml version='1.0' encoding='utf-8'?>
  <Context crossContext="true">
    <Resources cacheMaxSize="204800" cacheObjectMaxSize="1024">
      <PostResources base="${catalina.base}/modules/share"
                     className="org.apache.catalina.webresources.DirResourceSet"
                     webAppMount="/WEB-INF/lib"/>
    </Resources>
  </Context>

Dokumentation see:
http://tomcat.apache.org/tomcat-8.5-doc/config/resources.html#Attributes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment