Changeset 44d6e11 for installer


Ignore:
Timestamp:
Oct 20, 2014 2:01:36 PM (6 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
b6234e1
Parents:
8a12b7c
Message:

Console and Eepsite Jetty:
Switch back to QueuedThreadPool? (ticket #1395)
In Jetty 5/6, the default QTP was not concurrent, so we switched to
ThreadPoolExecutor? with a fixed-size queue, a set maxThreads,
and a RejectedExecutionPolicy? of CallerRuns?.
Unfortunately, CallerRuns? causes lockups in Jetty NIO.
In addition, no flavor of TPE gives us what QTP does:

  • TPE direct handoff (which we were using) never queues. This doesn't provide any burst management when maxThreads is reached. CallerRuns? was an attempt to work around that.
  • TPE unbounded queue does not adjust the number of threads. This doesn't provide automatic resource management.
  • TPE bounded queue does not add threads until the queue is full. This doesn't provide good responsiveness to even small bursts.

QTP adds threads as soon as the queue is non-empty.
QTP as of Jetty 7 uses concurrent.
QTP unbounded queue is the default in Jetty.
So switch back to QTP with a bounded queue, which does what we want,
which is first expand the thread pool, then start queueing, then reject.

ref:
http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html
https://wiki.eclipse.org/Jetty/Howto/High_Load

File:
1 edited

Legend:

Unmodified
Added
Removed
  • installer/resources/eepsite/jetty.xml

    r8a12b7c r44d6e11  
    5454      <!-- PICK ONE -->
    5555
    56       <!-- If you don't have or want threadpool
    57            Requests above the max will be queued
     56      <!--
     57           Recommended.
     58           Two threads are used for the Connector and Acceptor.
     59           Concurrent requests above maxThreads + queue size - 2 will be rejected and logged.
     60           Due to the way QTP works, queue size should be larger than maxThreads.
     61           Increase all values for high-traffic eepsites.
     62
     63           ref:
     64           https://wiki.eclipse.org/Jetty/Howto/High_Load
     65           http://trac.i2p2.i2p/ticket/1395
    5866       -->
    59      <!--
    6067      <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
    61         <Set name="minThreads">1</Set>
    62         <Set name="maxThreads">16</Set>
     68        <Arg>
     69           <New class="java.util.concurrent.LinkedBlockingQueue">
     70              <Arg type="int">40</Arg>
     71           </New>
     72        </Arg>
     73        <Set name="minThreads">3</Set>
     74        <Set name="maxThreads">20</Set>
     75        <Set name="maxIdleTimeMs">60000</Set>
     76        <Set name="daemon">true</Set>
     77        <Set name="name">Eepsite Jetty</Set>
    6378      </New>
    64      -->
    6579
    6680      <!-- Optional Java 5 bounded threadpool with job queue
    6781           Requests above the max will be rejected and logged.
    6882           High-traffic sites should increase maximumPoolSize.
     83
     84           Args are:
     85             corePoolSize (should be at least 3)
     86             maximumPoolSize
     87             keepAliveTime (milliseconds)
     88             timeout (TimeUnit)
     89             queue (BlockingQueue)
     90
     91           Not recommended.
     92           ref:
     93           http://trac.i2p2.i2p/ticket/1395
     94           http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html
    6995       -->
     96     <!--
    7097      <New class="org.eclipse.jetty.util.thread.ExecutorThreadPool">
    71         <!-- corePoolSize (should be at least 3) -->
    7298        <Arg type="int">3</Arg>
    73         <!-- maximumPoolSize -->
    7499        <Arg type="int">20</Arg>
    75         <!-- keepAliveTime (milliseconds) -->
    76100        <Arg type="long">60000</Arg>
    77101        <Arg>
     
    84108        </Arg>
    85109      </New>
     110     -->
    86111    </Set>
    87112
Note: See TracChangeset for help on using the changeset viewer.