[jboss-jira] [JBoss JIRA] (JGRP-2475) RpcDispatcher: use ObjectMessage
Bela Ban (Jira)
issues at jboss.org
Thu May 14 08:17:30 EDT 2020
[ https://issues.redhat.com/browse/JGRP-2475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14097436#comment-14097436 ]
Bela Ban edited comment on JGRP-2475 at 5/14/20 8:16 AM:
---------------------------------------------------------
Actually, even better: when we receive a message, in the 4.x code, we'd parse the {{Message}} from the network buffer (including the byte array), and later the application would extract an object from the message's byte array.
In 5.0, if we use {{ObjectMessage}}, we construct the object _directly from the network buffer_ at receive time. This eliminates an additional memory allocation. So we're *saving 4 memory allocations on a sync RPC* (round trip) when using {{ObjectMessage}}!
was (Author: belaban):
Actually, even better: when we receive a message, in the 4.x code, we'd parse the {{Message}} from the network buffer (including the byte array), and later the application would extract an object from the message's byte array.
In 5.0, if we use {{ObjectMessage}}, we construct the object _directly from the network buffer_ at receive time. This eliminates an additional memory allocation. So we're *saving 4 memory allocations on a sync RPC *(round trip) when using {{ObjectMessage}}!
> RpcDispatcher: use ObjectMessage
> --------------------------------
>
> Key: JGRP-2475
> URL: https://issues.redhat.com/browse/JGRP-2475
> Project: JGroups
> Issue Type: Enhancement
> Reporter: Bela Ban
> Assignee: Bela Ban
> Priority: Major
> Fix For: 5.0.0.Beta2
>
>
> When invoking RPCs, {{RpcDispatcher}} converts the {{MethodCall}} used into a byte array and passes that to a {{BytesMessage}} that's then sent down to the transport.
> This is inefficient, as an unneeded byte array allocation is done, both when an RPC request is sent and when the response is sent.
> Instead of doing eager marshalling of {{MethodCall}} into a byte array, pass the {{MethodCall}} to an {{ObjectMessage}}, which marshalls the latter directly to the output stream of the transport at send time.
> This eliminates 2 memory allocations per RPC round-trip (on a sync RPC).
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list