前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Resin?Tomcat?Java? 原

Resin?Tomcat?Java? 原

作者头像
阿dai学长
发布2019-04-03 10:30:32
6660
发布2019-04-03 10:30:32
举报
文章被收录于专栏:阿dai_linux阿dai_linux

配置文件解析

代码语言:javascript
复制
<!--
   - Resin 3.1 configuration file.
  -->
<resin xmlns="http://caucho.com/ns/resin"
       xmlns:resin="http://caucho.com/ns/resin/core">

  <!-- 加载resin/lib目录下所有.jar文件 -->
  <class-loader>
    <tree-loader path="${resin.home}/ext-lib"/>
    <tree-loader path="${resin.root}/ext-lib"/>

    <tree-loader path="${resin.home}/lib"/>
    <tree-loader path="${resin.root}/lib"/>
  </class-loader>

  <!-- JDK日志接口管理:名称、级别('info' 生产环境 'fine' 开发环境 'finer' 调试环境)、输出位置、时间戳、格式、切割周期 -->
  <log name="" level="info" path="stdout:" timestamp="[%H:%M:%S.%s] " format="${log.level}-${log.threadID}-${log.message}-${log.shortName}"/>

  <logger name="com.caucho.java" level="config"/>
  <logger name="com.caucho.loader" level="config"/>


  <stdout-log path-format="log/stdout.log.%Y-%m-%d" rollover-period='1D'/>
  <stderr-log path-format="log/stderr.log.%Y-%m-%d" rollover-period='1D'/>

  <!--
     - 'info' for production
     - 'fine' or 'finer' for development and troubleshooting
    -->
  <logger name="com.caucho" level="info"/>

  <logger name="com.caucho.java" level="config"/>
  <logger name="com.caucho.loader" level="config"/>

  <!--
     - 环境上下文检测周期,对于生产站点,这个要设置的长一点,例如600秒
     - For production sites, change dependency-check-interval to something
     - like 600s, so it only checks for updates every 10 minutes.
    -->
  <dependency-check-interval>600s</dependency-check-interval>

  <!--
     - 发送邮件通知的SMTP服务器
     - SMTP server for sending mail notifications
    -->
  <system-property mail.smtp.host="127.0.0.1"/>
  <system-property mail.smtp.port="25"/>

  <!--
     - 配置语言环境
     - Sets the default character encoding to utf-8
     -
     - <character-encoding>utf-8</character-encoding>
    -->

  <!--
     - 配置编译器
     - You can change the compiler to "javac", "eclipse" or "internal".
    -->
  <javac compiler="internal" args="-source 1.6"/>


  <!-- 配置集群根目录,相对于server.root  -->
  <cluster id="app-tier">
    <!-- sets the content root for the cluster, relative to server.root -->
    <root-directory>.</root-directory>

    <server-default>
      <!-- The http port 配置http服务的端口 -->
      <http address="*" port="7081"/>


      <!--
         - The JVM arguments
         - JVM参数配置:(参考:https://blog.csdn.net/rickyit/article/details/53895060)
         - Xmx:程序运行期间最大可用内存。一般来讲,大点,程序会启动的快一点,但是也可能会导致机器暂时间变慢。
         - Xms:程序启动时占用内存大小。如果程序运行需要占用更多的内存,超出了这个设置值,就会抛出OutOfMemory异常。
         - Xss:每个线程的内存大小。
         - Xmn:设置年轻代大小为2G。整个堆大小=年轻代大小 + 年老代大小 + 持久代大小。
         - 持久代一般固定大小为64m,所以增大年轻代后,将会减小年老代大小。此值对系统性能影响较大,Sun官方推荐配置为整个堆的3/8。
         - 命令行参数:
         - “-XX:NewRatio”=4 :设置年轻代(包括Eden和两个Survivor区)与年老代的比值(除去持久代)。设置为4,则年轻代与年老代所占比值为1:4,年轻代占整个堆栈的1/5
         - “-XX:SurvivorRatio”=4 :设置年轻代中Eden区与Survivor区的大小比值。设置为4,则两个Survivor区与一个Eden区的比值为2:4,一个Survivor区占整个年轻代的1/6
         - “-XX:MaxPermSize”=16m :设置持久代大小为16m。
         - “-XX:MaxTenuringThreshold”=0 :设置垃圾最大年龄。
         - 如果设置为0的话,则年轻代对象不经过Survivor区,直接进入年老代 。对于年老代比较多的应用,可以提高效率。
         - 如果将此值设置为一个较大值,则年轻代对象会在Survivor区进行多次复制,这样可以增加对象再年轻代的存活时间 ,增加在年轻代即被回收的概论。
        -->
      
      <jvm-arg>-Xmx2048m</jvm-arg>
      <jvm-arg>-Xms400M</jvm-arg>
      <jvm-arg>-Xss100m</jvm-arg>
      <jvm-arg>-XX:MaxPermSize=256m</jvm-arg>
      <jvm-arg>-server</jvm-arg>
      <jvm-arg>-Dcom.sun.management.jmxremote</jvm-arg>


      <!--
         - arguments for the watchdog process
        -->
      <watchdog-jvm-arg>-Dcom.sun.management.jmxremote</watchdog-jvm-arg>
      <watchdog-port>6602</watchdog-port>

      <!--
         - Configures the minimum free memory allowed before Resin
         - will force a restart.
         - 配置resin强制重启时的最新空闲内存
        -->
      <memory-free-min>512m</memory-free-min>

      <!-- Maximum number of threads. 配置最大线程数量 -->
      <thread-max>128</thread-max>

      <!-- Configures the socket timeout 配置套接字等待时间 -->
      <socket-timeout>65s</socket-timeout>

      <!-- Configures the keepalive 配置Keepalive-->
      <keepalive-max>128</keepalive-max>
      <keepalive-timeout>15s</keepalive-timeout>

      <!--
         - If starting bin/resin as root on Unix, specify the user name
         - and group name for the web server user.
         - 如果使用的是Unix,在此配置启动用户的属主和属组
         - <user-name>resin</user-name>
         - <group-name>resin</group-name>
        -->
   
    </server-default>

    <!-- define the servers in the cluster 定义集群服务器 -->
    <server id="" address="127.0.0.1" port="6801"/>

    <web-app-default>
      <prologue>
        <!--
           - Extension library for common jar files.  The ext is safe
           - even for non-classloader aware jars.  The loaded classes
           - will be loaded separately for each web-app, i.e. the class
           - itself will be distinct.
           - 扩展库的公共jar文件,扩展是安全的即使没有类装载器知道的jars,
           - 装载的类将为每个应用分别装载,也就是这些类都是不同的
          -->
        <class-loader>
          <tree-loader path="${resin.root}/ext-webapp-lib"/>
        </class-loader>

        <!--
           - Enable EL expressions in Servlet and Filter init-param
           - 启用EL表达式
          -->
        <allow-servlet-el/>
      </prologue>
      
      <!--
         - Sets timeout values for cacheable pages, e.g. static pages.
         - 缓存配置
        -->
      <cache-mapping url-pattern="/" expires="5s"/>
      <cache-mapping url-pattern="*.gif" expires="60s"/>
      <cache-mapping url-pattern="*.jpg" expires="60s"/>
      <cache-mapping url-pattern="*.png" expires="60s"/>

      <!--
         - for security, disable session URLs by default.
         - 出于安全考虑,默认禁用会话URLs(重定向)
        -->
      <session-config>
        <enable-url-rewriting>false</enable-url-rewriting>
      </session-config>

        <!--
           - 一些JSP包有不正确的 .tld文件。
           - 可以把validate-taglib-schema设置成false,可能继续正常工作
        -->
        <jsp>
          <validate-taglib-schema>true</validate-taglib-schema>
          <fast-jstl>true</fast-jstl>
        </jsp>
    </web-app-default>

    <!-- 简单的数据配置
       - The JDBC name is java:comp/env/jdbc/test
    <database>
        <jndi-name>jdbc/mysql</jndi-name>
        <driver type="org.gjt.mm.mysql.Driver">
        <url>jdbc:mysql://localhost:3306/test</url>
        <user></user>
        <password></password>
        </driver>
        <prepared-statement-cache-size>8</prepared-statement-cache-size>
        <max-connections>20</max-connections>
        <max-idle-time>30s</max-idle-time>
    </database>
    -->

    <!-- includes the app-default for default web-app behavior 
       - 包含web应用的默认行为
    -->
    <resin:import path="${resin.home}/conf/app-default.xml"/>
    
    <!-- 定义所有虚拟主机的默认配置 -->
    <host-default>
    <!-- 如果和别的web服务器整合,这个可以被去掉,因为web服务器也可以记录这些信息。 -->
      <access-log path="logs/access.log" 
            format='%h %l %u %t "%r" %s %b time:%D "%{Referer}i" "%{User-Agent}i"'
            rollover-period="1D"/>
      <!-- .war文件(应用文件)部署目录 -->
      <web-app-deploy path="webapps"/>
    </host-default>


    <!-- 
       - configures a deployment directory for virtual hosts
       - 虚拟主机的部署目录
     -->
    <host-deploy path="hosts">
      <host-default>
        <resin:import path="host.xml" optional="true"/>
      </host-default>
    </host-deploy>

    <!-- 默认虚拟主机配置 -->
    <host id="" root-directory=".">
      <!-- 默认应用文件目录配置 -->
      <web-app id="/" root-directory="webapps/ROOT"/>
    </host>
  </cluster>

</resin>

参考:https://blog.csdn.net/qyf_5445/article/details/8152042

(adsbygoogle = window.adsbygoogle || []).push({});

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018/04/03 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 配置文件解析
相关产品与服务
轻量应用服务器
轻量应用服务器(TencentCloud Lighthouse)是新一代开箱即用、面向轻量应用场景的云服务器产品,助力中小企业和开发者便捷高效的在云端构建网站、Web应用、小程序/小游戏、游戏服、电商应用、云盘/图床和开发测试环境,相比普通云服务器更加简单易用且更贴近应用,以套餐形式整体售卖云资源并提供高带宽流量包,将热门开源软件打包实现一键构建应用,提供极简上云体验。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档