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

项目加载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. Win10专业版系统下添加其他国家语言

    Win10专业版系统下如何添加其他国家语言?国内的win10专业版系统默认情况下是安装简体中文,但是有的用户出于工作原因需要使用其它字体.比如外国友人就需要使用英语,西班牙等.其实win10专业版是支 ...

  2. (转)Linux Network IO Model、Socket IO Model - select、poll、epoll

    Linux Network IO Model.Socket IO Model - select.poll.epoll  原文:https://www.cnblogs.com/LittleHann/p/ ...

  3. 专题《一》 mysql优化

    从今天开始,在这里记录面试会问的问题,针对java高级开发,架构师方向. 1.数据库设计要合理.开发经验不同  设计表水平不同  影响后面操作 三范式:1------------原子约束,每列不可分割 ...

  4. Control中的AOP实现非业务需求

    一.能够使用Control中的AOP实现非业务需求的功能 本文目录 一.ActionFilterAttribute类 二.实现自定义Attribute 一.ActionFilterAttribute类 ...

  5. JAVA基础之Properties类、序列化流及打印流、commons-IO

    个人理解: Properties类是个存储String类型的键值对的集合类,可以用其存储一些关键的账号密码什么的,同时后面的注释可以很好的帮助理解,但是需要注意的是其文件中不能出现其他的符号:序列化与 ...

  6. w3c万维网的介绍和html基本构成

    怎么与浏览器交互? 1.鼠标 2.键盘输入 w3c标准: 中文名:万维网联盟!外文名:world wide web cansortium万维网联盟创建于1994年,是web技术领域最具权威个影响的国际 ...

  7. Windows 8 / win8 拼音输入法/搜狗输入法 visual Studio 2010 / VS2010 不兼容

    是visual assist X 的问题,更新到VA_X_Setup 2001 解决问题 老版本处理:Tools-->Extension Manager-->Uninstall

  8. 关于学习Lisp的一点思考

    以前读<黑客与画家>,其中对Lisp语言的赞美和推崇,让我燃起学习Lisp语言的强烈冲动,但很快发现在实际工作中应用的场景很少,出于功利心最终放弃了.直到上周未在家里读完了<大教堂与 ...

  9. Bezier(贝塞尔曲线)

    CDC::PolyBezierBOOL PolyBezier( const POINT* lpPoints, int nCount ); 和 曲线原理及多段曲线连接处如何光滑连接:第一段曲线要有4个点 ...

  10. 程序员的智囊库系列之3--分布式文件系统(Distributed file systems)

    程序员的智囊库系列之3--分布式文件系统(Distributed file systems) 这是程序员的智囊库系列的第三篇文章.上一篇文章本来打算介绍几个搭建网站的框架,但由于这部分的内容较多,还需 ...