需要耐心啊,太急于求成,希望直接就得到解决方法了...以至于正确方法都已经出现了,我却没有耐心看下去,所以反而又耽误了不少时间....

项目加载100+张图片,还有一个小的MP4,所以console警告缓存不够

org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/base/1325/WA6144-150x112.jpg] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache

The background cache eviction process was unable to free [10] percent of the cache for Context [/liuda] - consider increasing the maximum size of the cache. After eviction approximately [11,145] KB of data remained in the cache

反正就是缓存不够了

http://stackoverflow.com/questions/26893297/tomcat-8-throwing-org-apache-catalina-webresources-cache-getresource-unable-to

上面链接是stackoverflow上出现的和我一样的错误,第二个答案成功的解决了这个警告,就是把缓存弄大点。一开始没耐心看答案,直接把代码加进server.xml了,正确的应该是加到context.xml

<Resources cachingAllowed="true" cacheMaxSize="100000" />

作者:我比风更自由

来源:CSDN

原文:https://blog.csdn.net/qq_26684469/article/details/52346667

版权声明:本文为博主原创文章,转载请附上博文链接!

背景资料

一个WebSource是在Web应用程序中的文件或目录。出于性能原因,Tomcat可以缓存WebSource。默认情况下,静态资源缓存(总共所有资源)的最大值为 10240千字节(10 MB)。在请求webResource时(例如,在加载静态图像时),webResource被加载到缓存中,然后将其称为缓存条目。每个缓存条目都有一个TTL(生存时间),这是允许缓存条目保留在缓存中的时间。当TTL过期时,缓存条目有资格从缓存中删除。cacheTTL的默认值为5000毫秒(5秒)。

加载webResource时,代码会计算缓存的新大小。如果计算的大小大于默认的最大大小,则必须删除一个或多个缓存的条目,否则新大小将超过最大值。因此代码将计算“targetSize”,这是缓存希望保持的大小(作为最佳值),默认情况下为95%。为了达到此targetSize,必须从缓存中删除/逐出条目。

因此,当其TTL过期且尚未达到targetSize时,将删除缓存条目。

在尝试通过逐出缓存条目来释放缓存之后

因此,如果在尝试释放缓存后,大小仍然超过最大值,它将显示有关无法释放的警告消息:

cache.addFail=Unable to add the resource at [{0}] to the cache for web application [{1}] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache

问题

因此,正如警告信息所述,问题是

insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache

如果您的Web应用程序在短时间(5秒)内加载了大量未缓存的webResources(大约最大缓存,默认为10mb),那么您将收到警告。

当Tomcat 7无法释放缓存时,它根本不会输出任何警告,而Tomcat 8将输出警告。

因此,如果您使用的Tomcat 8具有与Tomcat 7相同的默认缓存配置,并且您在Tomcat 8中收到警告,那么Tomcat 7的(和我的)缓存设置在没有警告的情况下表现不佳。

解决方案

有多种解决方案:

  • 增加缓存(推荐)
  • 降低TTL(不推荐)
  • 禁止缓存日志警告(不推荐)
  • 禁用缓存

通过在Context元素中添加$CATALINA_BASE/conf/context.xml“XXXXX”代表增加的高速缓存大小,以kbytes为单位。默认值为10240(10 MB),因此请设置大于此值的大小。

<Resources cacheMaxSize="XXXXX" />

您必须调整以获得最佳设置。请注意,当您突然增加流量/资源请求时,问题可能会再次出现。

org.apache.catalina.webresources.Cache.backgroundProcess The background cache eviction process was unable to free [10] percent of the cache for Context [/filestore] - consider increasing the maximum s的更多相关文章

  1. org.apache.catalina.webresources.Cache.getResource Unable to add the resource

    org.apache.catalina.webresources.Cache.getResource Unable to add the resource at xxx to the cache be ...

  2. Tomcat8 启动中提示 org.apache.catalina.webresources.Cache.getResource Unable to add the resource

    Tomcat8 启动过程中提示: org.apache.catalina.webresources.Cache.getResource Unable to add the resource at xx ...

  3. at org.apache.catalina.webresources.CachedResource.validateResources

    "catalina-exec-659" #5239 daemon prio=5 os_prio=0 tid=0x00007fcba8099800 nid=0x581 waiting ...

  4. Failed to initialize component [org.apache.catalina.webresources.JarResource

    去本地仓库里删除掉对应出错的jar包,然后回到pom里面加个空行 让他重新下载(最好把maven仓库全部都删了 重新下载一次 ) 先备份 在复制回来 完美解决

  5. consider increasing the maximum size of the cache.

    虚拟机上搭建jenkins,出现unable to free [10] percent of the cache for Context [/jenkins] 提示让我加大缓存 consider in ...

  6. org.apache.catalina.LifecycleException: Failed to start component

    1.错误描述 Using CATALINA_BASE: "D:\NetBeans\apache-tomcat-8.0.12" Using CATALINA_HOME: " ...

  7. org.apache.catalina.LifecycleException: Failed to stop component(生命周期异常)

    真是郁闷透顶,以前昨天还可以用,换了myeclipse自带的tomcat就可以用: 异常: org.apache.catalina.LifecycleException: Failed to stop ...

  8. java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]

    本文为博主原创,未经允许不得转载: 被坑了好长时间的bug,差点就要重新配置环境,重新下载,重新开始的境遇.在此记录一下: 首先展示一下报错的异常: -Apr- ::] org.apache.cata ...

  9. Tomcat启动报错:org.apache.catalina.LifecycleException: Failed to start component...java.util.zip.ZipException: error in opening zip file

    1.项目环境 IntelliJ IDEA2018.1.6 apache-tomcat-8.0.53 基于springboot开发的项目 maven3.5.3 2.出现问题 从svn同步下项目 启动to ...

随机推荐

  1. mui的picker组件填坑

    在公司项目用到mui,vue进行开发 import mui from './assets/js/mui.min.js'后 加window.mui = mui再 import './assets/js/ ...

  2. VS连接Access数据库--连接字符串及执行查询语句的方法(增删改查,用户名查重,根据用户获取密码查询)

    ACCESS数据的连接及语句执行操作,不难,久不用会生疏,每次都要找资料,干脆自己整理下,记录下来,需要的时候,直接查看,提高效率.也供初学者参考 1.连接字符串 public static stri ...

  3. Mybatis基础配置及增删查改操作

    一.简介 平时我们都用JDBC访问数据库,除了需要自己写SQL之外,还必须操作Connection, Statement, ResultSet 这些其实只是手段的辅助类. 不仅如此,访问不同的表,还会 ...

  4. jar包生成exe可执行程序

    1.生成工具EXE4J下载链接:https://www.ej-technologies.com/download/exe4j/files 2.安装.使用:https://blog.csdn.net/h ...

  5. 使用OpenSSH远程管理Linux服务器

    一.使用OpenSSH远程管理Linux服务器 sshd是OpenSSH的服务器端守护进程,与之对应的Windows下客户端软件有SecureCRT/Xshell/PuTTY等. OpenSSH一般为 ...

  6. Ubuntu获取root 权限,开机自动登入root

    新机器获取root权限,只需要给root 增加密码: sudo passwd root 修改开机自动登入: #sudo gedit /etc/lightdm/lightdm.conf 修改参数: au ...

  7. 获取元素Bytagname区别/for循环应用

    一:两种获取元素方式的区别.1.var aLi = oUl.getElementsByTagName('li');TagName前面可以加其他东西,id就只能是document,2,Id是静态的,ta ...

  8. Java中protected方法访问权限的问题

    先看Test.java 此时出现上文提到的错误:The method clone from the type Object is not visiuable. 我们已经清楚Object.clone() ...

  9. selenium +python之Page Obiect设计模式

    PageObject是selenium自动化测试项目开发实践的最佳设计模式之一,它主要体现对界面交互细节的封装,这样可以使测试案例更关注于业务而非界面细节,从而提高测试案例的可读性. 1.认识Page ...

  10. 【Python图像特征的音乐序列生成】关于数据集的分享和样例数据

    数据集还在制作中,样例数据如下: 我将一条数据作为一行,X是ID,O代表了情感向量,S是速度,是一个很关键的参数,K是调式,M是节拍,L是基本拍.后面是ABC格式的序列,通过embedding化这些音 ...