-
1. Re: message size
clebert.suconic Aug 24, 2010 4:43 PM (in response to oferiko)We have a test where we allocate references and messages.. and calculate the offset of each message
We have calculated that each message reference will take 48 bytes if 64 bits or 32 bytes if 32 bits
static{// This is an estimate of how much memory a ServerMessageImpl takes up, exclusing body and properties// Note, it is only an estimate, it's not possible to be entirely sure with Java// This figure is calculated using the test utilities in org.hornetq.tests.unit.util.sizeof// The value is somewhat higher on 64 bit architectures, probably due to different alignmentif (MemorySize.is64bitArch()){memoryOffset = 48;}else{memoryOffset = 32;}}As for the message body itself, the calculation is done at ServreMessageImpl::getMemoryEstimate()
public int getMemoryEstimate()
{
if (memoryEstimate == -1)
{
memoryEstimate = ServerMessageImpl.memoryOffset + buffer.capacity() + properties.getMemoryOffset();
}
return memoryEstimate;
}
While memoryOffset for the message:static{// This is an estimate of how much memory a ServerMessageImpl takes up, exclusing body and properties// Note, it is only an estimate, it's not possible to be entirely sure with Java// This figure is calculated using the test utilities in org.hornetq.tests.unit.util.sizeof// The value is somewhat higher on 64 bit architectures, probably due to different alignmentif (MemorySize.is64bitArch()){memoryOffset = 352;}else{memoryOffset = 232;}}We also calculate the offset of properties:
We basically get the encodeSize of the properties and add a factor:
size + 2 * DataConstants.SIZE_INT * properties.size()
So, the size of the message is spread between the message itself + message references + properties size.
This is of course an estimate.. .and we always welcome better estimates when someone finds them.
-
2. Re: message size
clebert.suconic Aug 24, 2010 4:44 PM (in response to clebert.suconic)Also, there's currently a bug that messages are using twice the size of their bodies on the server. I will see if I can fix it by 2.1.4. (2.1.3 will be a minor release with 1 or 2 fixes only)
-
3. Re: message size
oferiko Aug 24, 2010 6:21 PM (in response to clebert.suconic)i'll try to run the MemorySizeTest on my messages to get an estimation,
thanks
-
4. Re: message size
clebert.suconic Aug 24, 2010 7:26 PM (in response to oferiko)you should get approximate figures for Messages...
you may want to find out other objects.. like Consumers, Sessions... etc..