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.htmlhttps://wiki.eclipse.org/Jetty/Howto/High_Load
- Fix model and family calculation
- Fix most AMD family 15 IDs
- Add AMD Llano, Jaguar, Bulldozer 2
- Add Intel Ivy Bridge, Haswell, Broadwell, Penryn, Pineview, Cedarview, Bay Trail, Avoton, and others
- Set best-guess capabilities for most Intel processors
- Supply best-guess model string in most cases
- Processors listed above, and some others, may see crypto speedups as a result
- Code cleanup, reduce number of JNI calls
- Merge dup cases
- Tab removal
- Javadocs
- Prep for future enhancements by refactoring to a state machine model
- Reduce object churn; use SimpleByteCache
- Synchronization
- Define some constants
- More finals
- Log tweaks
- Move from core to RouterKeyGenerator in router.jar
- Leave RoutingKeyGenerator as a simple abstract class
- DatabaseEntry now uses timestamp instead of mod data
to determine if mod data has changed. Don't expose
mod data to DatabaseEntry any more.
- I2PAppContext.routingKeyGenerator() now returns null;
you must be in RouterContext to get a generator.
- Add ACKBitfield.highestReceived() for efficiency
- Only write as many partial bitfield bytes as required,
rather than 10 (for 64 bits) every time.
- Don't allow more than 10 bytes when reading in bitfield
- Don't send an extra byte if (fragments % 7) == 0
- Don't send a corrupt ack packet if the partial ack got completed (race)
- Log tweaks
Fix SSU Output Queue errors due to races with PacketBuilder:
- Remove all buffer caching as it can't be made thread-safe.
Just allocate buffer in constructor and let GC handle it
- Do fragmenting in constructor and make all fragment fields final
- Don't track per-fragment retransmissions as it wasn't used
- Move ack tracking from an array to a long
- Sync all ack methods
- Entire class now thread-safe (thx dg)