Issue #5287 - make default CompressionPool capacity 1024

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2020-09-23 17:41:34 +10:00
parent ef816fcc42
commit 608a895aab
4 changed files with 10 additions and 6 deletions

View File

@ -923,12 +923,12 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
protected InflaterPool newInflaterPool()
{
return new InflaterPool(CompressionPool.INFINITE_CAPACITY, true);
return new InflaterPool(CompressionPool.DEFAULT_CAPACITY, true);
}
protected DeflaterPool newDeflaterPool()
{
return new DeflaterPool(CompressionPool.INFINITE_CAPACITY, Deflater.DEFAULT_COMPRESSION, true);
return new DeflaterPool(CompressionPool.DEFAULT_CAPACITY, Deflater.DEFAULT_COMPRESSION, true);
}
@Override

View File

@ -25,7 +25,7 @@ import org.eclipse.jetty.util.component.AbstractLifeCycle;
public abstract class CompressionPool<T> extends AbstractLifeCycle
{
public static final int INFINITE_CAPACITY = Integer.MAX_VALUE;
public static final int DEFAULT_CAPACITY = 1024;
private int _capacity;
private Pool<Entry> _pool;

View File

@ -42,8 +42,8 @@ public class WebSocketComponents
public WebSocketComponents()
{
this(new WebSocketExtensionRegistry(), new DecoratedObjectFactory(), new MappedByteBufferPool(),
new InflaterPool(CompressionPool.INFINITE_CAPACITY, true),
new DeflaterPool(CompressionPool.INFINITE_CAPACITY, Deflater.DEFAULT_COMPRESSION, true));
new InflaterPool(CompressionPool.DEFAULT_CAPACITY, true),
new DeflaterPool(CompressionPool.DEFAULT_CAPACITY, Deflater.DEFAULT_COMPRESSION, true));
}
public WebSocketComponents(WebSocketExtensionRegistry extensionRegistry, DecoratedObjectFactory objectFactory,

View File

@ -49,7 +49,7 @@ public class DeflaterPoolBenchmark
public static final String COMPRESSION_STRING = "hello world";
DeflaterPool _pool;
@Param({"NO_POOL", "DEFLATER_POOL_10", "DEFLATER_POOL_20", "DEFLATER_POOL_50"})
@Param({"NO_POOL", "DEFLATER_POOL_10", "DEFLATER_POOL_20", "DEFLATER_POOL_50", "DEFLATER_POOL_DEFAULT"})
public static String poolType;
@Setup(Level.Trial)
@ -75,6 +75,10 @@ public class DeflaterPoolBenchmark
capacity = 50;
break;
case "DEFLATER_POOL_DEFAULT":
capacity = DeflaterPool.DEFAULT_CAPACITY;
break;
default:
throw new IllegalStateException("Unknown poolType Parameter");
}