ARTEMIS-1056 Performance improvements on AMQP
This commit is contained in:
parent
ac7cafb210
commit
0bfb39bfb5
|
@ -65,7 +65,11 @@ public class ActiveMQChannelHandler extends ChannelDuplexHandler {
|
|||
public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception {
|
||||
ByteBuf buffer = (ByteBuf) msg;
|
||||
|
||||
try {
|
||||
handler.bufferReceived(channelId(ctx.channel()), new ChannelBufferWrapper(buffer));
|
||||
} finally {
|
||||
buffer.release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -53,17 +53,17 @@ public class PartialPooledByteBufAllocator implements ByteBufAllocator {
|
|||
|
||||
@Override
|
||||
public ByteBuf ioBuffer() {
|
||||
return UNPOOLED.heapBuffer();
|
||||
return POOLED.directBuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf ioBuffer(int initialCapacity) {
|
||||
return UNPOOLED.heapBuffer(initialCapacity);
|
||||
return POOLED.directBuffer(initialCapacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf ioBuffer(int initialCapacity, int maxCapacity) {
|
||||
return UNPOOLED.heapBuffer(initialCapacity, maxCapacity);
|
||||
return POOLED.directBuffer(initialCapacity, maxCapacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -63,7 +63,7 @@ public class AMQPMessage extends RefCountMessage {
|
|||
final long messageFormat;
|
||||
ByteBuf data;
|
||||
boolean bufferValid;
|
||||
boolean durable;
|
||||
Boolean durable;
|
||||
long messageID;
|
||||
String address;
|
||||
MessageImpl protonMessage;
|
||||
|
@ -491,11 +491,16 @@ public class AMQPMessage extends RefCountMessage {
|
|||
|
||||
@Override
|
||||
public boolean isDurable() {
|
||||
if (getHeader() != null && getHeader().getDurable() != null) {
|
||||
return getHeader().getDurable().booleanValue();
|
||||
} else {
|
||||
if (durable != null) {
|
||||
return durable;
|
||||
}
|
||||
|
||||
if (getHeader() != null && getHeader().getDurable() != null) {
|
||||
durable = getHeader().getDurable().booleanValue();
|
||||
return durable;
|
||||
} else {
|
||||
return durable != null ? durable : false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -481,11 +481,16 @@ public class ProtonServerSenderContext extends ProtonInitializable implements Pr
|
|||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Message message = ((MessageReference) delivery.getContext()).getMessage();
|
||||
|
||||
boolean preSettle = sender.getRemoteSenderSettleMode() == SenderSettleMode.SETTLED;
|
||||
|
||||
DeliveryState remoteState = delivery.getRemoteState();
|
||||
DeliveryState remoteState;
|
||||
|
||||
synchronized (connection.getLock()) {
|
||||
remoteState = delivery.getRemoteState();
|
||||
}
|
||||
|
||||
boolean settleImmediate = true;
|
||||
if (remoteState != null) {
|
||||
|
@ -503,8 +508,10 @@ public class ProtonServerSenderContext extends ProtonInitializable implements Pr
|
|||
TransactionalState txAccepted = new TransactionalState();
|
||||
txAccepted.setOutcome(Accepted.getInstance());
|
||||
txAccepted.setTxnId(txState.getTxnId());
|
||||
synchronized (connection.getLock()) {
|
||||
delivery.disposition(txAccepted);
|
||||
}
|
||||
}
|
||||
// we have to individual ack as we can't guarantee we will get the delivery
|
||||
// updates (including acks) in order
|
||||
// from dealer, a perf hit but a must
|
||||
|
@ -560,11 +567,15 @@ public class ProtonServerSenderContext extends ProtonInitializable implements Pr
|
|||
protonSession.replaceTag(delivery.getTag());
|
||||
}
|
||||
|
||||
if (settleImmediate) settle(delivery);
|
||||
if (settleImmediate)
|
||||
settle(delivery);
|
||||
|
||||
} else {
|
||||
// todo not sure if we need to do anything here
|
||||
}
|
||||
} finally {
|
||||
connection.flush();
|
||||
}
|
||||
}
|
||||
|
||||
public void settle(Delivery delivery) {
|
||||
|
|
|
@ -240,7 +240,7 @@ public class ProtonHandler extends ProtonInitializable {
|
|||
}
|
||||
|
||||
// For returning PooledBytes
|
||||
ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(size);
|
||||
ByteBuf buffer = PooledByteBufAllocator.DEFAULT.directBuffer(size);
|
||||
ByteBuffer head = transport.head();
|
||||
head.position(offset);
|
||||
head.limit(offset + size);
|
||||
|
|
|
@ -49,7 +49,7 @@ class HornetQProtocolManager extends CoreProtocolManager {
|
|||
buffer.getByte(5) == 'T' &&
|
||||
buffer.getByte(6) == 'Q') {
|
||||
//todo add some handshaking
|
||||
buffer.readBytes(7);
|
||||
buffer.skipBytes(7);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ public class CoreProtocolManager implements ProtocolManager<Interceptor> {
|
|||
public void handshake(NettyServerConnection connection, ActiveMQBuffer buffer) {
|
||||
//if we are not an old client then handshake
|
||||
if (isArtemis(buffer)) {
|
||||
buffer.readBytes(7);
|
||||
buffer.skipBytes(7);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue