tomcat性能調(diào)優(yōu)

一. 解決tomcat掃描jar包錯(cuò)誤

vim catalina.properties
找到相應(yīng)配置在后面加镀首,*

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=\,*
tomcat.util.scan.StandardJarScanFilter.jarsToScan=\,*
二. 解決一系列tomcat部署問(wèn)題 create a memory leak.錯(cuò)誤
rm -rf ~/elastic/
三. 解決

tomcat server配置:

<?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.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="7027" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 7071
    -->
    <Connector port="7071" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="7446" 
               maxThreads="2000"
               maxProcessors="2000"
               acceptCount="2000"
               minSpareThreads="100"
               maxSpareThreads="2000"
               enableLookups="false"/>
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="7071" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="7446" />
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 7446
         This connector uses the NIO implementation that requires the JSSE
         style configuration. When using the APR/native implementation, the
         OpenSSL style configuration is required as described in the APR/native
         documentation -->
    <!--
    <Connector port="7446" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 7010 -->
    <Connector port="7010" protocol="AJP/1.3" redirectPort="7446" />


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市樱报,隨后出現(xiàn)的幾起案子蝙昙,更是在濱河造成了極大的恐慌闪萄,老刑警劉巖,帶你破解...
    沈念sama閱讀 211,743評(píng)論 6 492
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件奇颠,死亡現(xiàn)場(chǎng)離奇詭異败去,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)烈拒,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,296評(píng)論 3 385
  • 文/潘曉璐 我一進(jìn)店門(mén)圆裕,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人荆几,你說(shuō)我怎么就攤上這事颜屠《倩荆” “怎么了?”我有些...
    開(kāi)封第一講書(shū)人閱讀 157,285評(píng)論 0 348
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)懒构。 經(jīng)常有香客問(wèn)我颅筋,道長(zhǎng),這世上最難降的妖魔是什么? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 56,485評(píng)論 1 283
  • 正文 為了忘掉前任竭缝,我火速辦了婚禮,結(jié)果婚禮上沼瘫,老公的妹妹穿的比我還像新娘抬纸。我一直安慰自己,他們只是感情好耿戚,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,581評(píng)論 6 386
  • 文/花漫 我一把揭開(kāi)白布湿故。 她就那樣靜靜地躺著,像睡著了一般膜蛔。 火紅的嫁衣襯著肌膚如雪晓锻。 梳的紋絲不亂的頭發(fā)上,一...
    開(kāi)封第一講書(shū)人閱讀 49,821評(píng)論 1 290
  • 那天飞几,我揣著相機(jī)與錄音,去河邊找鬼独撇。 笑死屑墨,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的纷铣。 我是一名探鬼主播卵史,決...
    沈念sama閱讀 38,960評(píng)論 3 408
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼搜立!你這毒婦竟也來(lái)了以躯?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書(shū)人閱讀 37,719評(píng)論 0 266
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤啄踊,失蹤者是張志新(化名)和其女友劉穎忧设,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體颠通,經(jīng)...
    沈念sama閱讀 44,186評(píng)論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡址晕,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,516評(píng)論 2 327
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了顿锰。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片谨垃。...
    茶點(diǎn)故事閱讀 38,650評(píng)論 1 340
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖硼控,靈堂內(nèi)的尸體忽然破棺而出刘陶,到底是詐尸還是另有隱情,我是刑警寧澤牢撼,帶...
    沈念sama閱讀 34,329評(píng)論 4 330
  • 正文 年R本政府宣布匙隔,位于F島的核電站,受9級(jí)特大地震影響浪默,放射性物質(zhì)發(fā)生泄漏牡直。R本人自食惡果不足惜缀匕,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,936評(píng)論 3 313
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望碰逸。 院中可真熱鬧乡小,春花似錦、人聲如沸饵史。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 30,757評(píng)論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)胳喷。三九已至湃番,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間吭露,已是汗流浹背吠撮。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 31,991評(píng)論 1 266
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留讲竿,地道東北人泥兰。 一個(gè)月前我還...
    沈念sama閱讀 46,370評(píng)論 2 360
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像题禀,于是被迫代替她去往敵國(guó)和親鞋诗。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,527評(píng)論 2 349

推薦閱讀更多精彩內(nèi)容

  • 增加JVM內(nèi)存迈嘹,修復(fù)JRE內(nèi)存泄漏削彬,線程池設(shè)置,安裝apr,壓縮 Tomcat性能優(yōu)化方案整理 考慮一下這種場(chǎng)景秀仲,...
    SkTj閱讀 915評(píng)論 0 0
  • 試想以下這個(gè)情景: 你已經(jīng)開(kāi)發(fā)好了一個(gè)程序融痛,這個(gè)程序的排版很不錯(cuò),而且有著最前沿的功能和其他一些讓你這程序增添不少...
    FTOLsXD閱讀 452評(píng)論 0 3
  • Tomcat 容器內(nèi)的優(yōu)化 一神僵、 tomcat的3種運(yùn)行模式 1酌心、 bio 默認(rèn)的模式,性能非常低下,沒(méi)有經(jīng)過(guò)任何...
    Tucke閱讀 9,034評(píng)論 0 52
  • 一、Tomcat三種運(yùn)行模式選擇 1挑豌、bio模式 性能最差不推薦使用 2安券、nio模式(優(yōu)先) (1)java IO...
    半路自由閱讀 685評(píng)論 0 0
  • 給大家分享下JVM的概念,根據(jù)JVM規(guī)范氓英,JVM 內(nèi)存共分為程序計(jì)數(shù)器(Program Counter Regis...
    IT小胖豆閱讀 469評(píng)論 0 1