I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
  • zzz's avatar
    44d6e117
    Console and Eepsite Jetty: · 44d6e117
    zzz authored
    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
    44d6e117
    History
    Console and Eepsite Jetty:
    zzz authored
    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