Resources Caching Tomcat
Suite à la mise à jour de Tomcat
en version 8
des avertissements sont apparus dans la trace d'exécution pour l'application Jenkins
.
AVERTISSEMENT: Unable to add the resource at [/WEB-INF/side-files/jenkins/model/AssetManager/index.html] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache
Ceci n'entraîne pas de disfonctionnement, mais cela complexifie l'analyse de potentielles anomalies. Cet article présente une résolution possible en paramétrant l'instance en augmentant la taille du cache des ressources.
Sommaire
Votre avis
Nobody voted on this yet
|
|
Analyse
Dans le cadre de cette installation sur une machine Ubuntu
, la trace d'exécution se trouve à l'emplacement /var/log/tomcat8/catalina.out
.
Le message indique un problème de taille du cache, où il est impossible d'allouer suffisament d'espace. L'augmentation de la taille du cache s'effectue au niveau de l'instance démarré en ajoutant la configuration suivante dans le fichier context.xml
de l'instance, soit à l'emplacement /etc/tomcat8/context.xml
dans le cadre d'une installation sous Ubuntu.
<Resources cachingAllowed="true" cacheMaxSize="100000" />
Configuration
Pour une installation sous Ubuntu
, le fichier context.xml
se trouve à l'emplacement /etc/tomcat8/context.xml
.
Il suffit de l'éditer et d'y ajouter la configuration mentionnée. Le fichier standard devient le suivant.
<?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 -->
<Context>
<!-- 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="" />
-->
<!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->
<Resources cachingAllowed="true" cacheMaxSize="100000" />
</Context>
Il suffit alors de redémarrer l'instance pourque cela soit pris en compte.
#sudo service tomcat8 stop #sudo service tomcat8 start
Voir aussi
Cette modification de configuration est présentée sur le support officiel de Jenkins
.
https://support.cloudbees.com/hc/en-us/articles/216567087-Cache-warnings-in-catalina-logging