ARTEMIS-3733 - Destination cache size too small for OpenWire clients
This commit is contained in:
parent
84c1feae8c
commit
bb44e37e84
|
@ -136,6 +136,8 @@ public class OpenWireProtocolManager extends AbstractProtocolManager<Command, O
|
|||
//to management service
|
||||
private boolean suppressInternalManagementObjects = true;
|
||||
|
||||
private int openWireDestinationCacheSize = 16;
|
||||
|
||||
private final OpenWireFormat wireFormat;
|
||||
|
||||
private final Map<SimpleString, RoutingType> prefixes = new HashMap<>();
|
||||
|
@ -718,6 +720,14 @@ public class OpenWireProtocolManager extends AbstractProtocolManager<Command, O
|
|||
this.suppressInternalManagementObjects = suppressInternalManagementObjects;
|
||||
}
|
||||
|
||||
public int getOpenWireDestinationCacheSize() {
|
||||
return this.openWireDestinationCacheSize;
|
||||
}
|
||||
|
||||
public void setOpenWireDestinationCacheSize(int openWireDestinationCacheSize) {
|
||||
this.openWireDestinationCacheSize = openWireDestinationCacheSize;
|
||||
}
|
||||
|
||||
public void setVirtualTopicConsumerWildcards(String virtualTopicConsumerWildcards) {
|
||||
for (String filter : virtualTopicConsumerWildcards.split(",")) {
|
||||
String[] configuration = filter.split(";");
|
||||
|
|
|
@ -200,8 +200,8 @@ public class AMQSession implements SessionCallback {
|
|||
//lazy allocation of the cache
|
||||
if (existingQueuesCache == null) {
|
||||
//16 means 64 bytes with 32 bit references or 128 bytes with 64 bit references -> 1 or 2 cache lines with common archs
|
||||
existingQueuesCache = new String[16];
|
||||
assert (Integer.bitCount(existingQueuesCache.length) == 1) : "existingQueuesCache.length must be power of 2";
|
||||
existingQueuesCache = new String[protocolManager.getOpenWireDestinationCacheSize()];
|
||||
assert (Integer.bitCount(existingQueuesCache.length) == 1) : "openWireDestinationCacheSize must be a power of 2";
|
||||
this.existingQueuesCache = existingQueuesCache;
|
||||
}
|
||||
final int hashCode = physicalName.hashCode();
|
||||
|
|
|
@ -81,6 +81,18 @@ The two parameters are configured on an OpenWire `acceptor`, e.g.:
|
|||
<acceptor name="artemis">tcp://localhost:61616?protocols=OPENWIRE;supportAdvisory=true;suppressInternalManagementObjects=false</acceptor>
|
||||
```
|
||||
|
||||
## OpenWire Destination Cache
|
||||
For improved performance of the broker we keep a cache of recently used destinations, so that when new messages are dispatched to them,
|
||||
we do not have to do a lookup every time. By default, this cache holds up to `16` destinations. If additional destinations are added
|
||||
they will overwrite older records.
|
||||
If you are dealing with a large amount of queues you might want to increase this value, which is done via configuration option:
|
||||
`openWireDestinationCacheSize` set on the OpenWire `acceptor` like this:
|
||||
```xml
|
||||
<acceptor name="artemis">tcp://localhost:61616?protocols=OPENWIRE;openWireDestinationCacheSize=64</acceptor>
|
||||
```
|
||||
|
||||
This cache has to be set to a power of 2, i.e.: `2`, `16`, `128` and so on.
|
||||
|
||||
## Virtual Topic Consumer Destination Translation
|
||||
|
||||
For existing OpenWire consumers of virtual topic destinations it is possible to
|
||||
|
|
Loading…
Reference in New Issue