[
https://issues.apache.org/jira/browse/PROTON-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16571841#comment-16571841
]
Alan Conway commented on PROTON-1910:
-------------------------------------
First tip - creating/freeing messages is relatively expensive in C, if you can
create a single Message and re-use it that will help quite a bit. That's an
issue that needs fixing in the C library. The Go library could perhaps have a
caching scheme to keep some pn_message objects around but I'd rather avoid that.
The Go library could be made more efficient by caching message data in a Go
data structure and making a single C call to read/write all the data in the
pn_message (which could be created on demand). That would collapse the
pn_message, put_binary, and encode into a single C call.
Sadly I wasn't aware of the CGO overheads when I designed all this, so it'll
take some work to improve the situation. Currently the Go proton package is a
direct function-by-function wrapper around the C library and electron uses
that. It might be time to throw away the proton package and rework electron to
use CGO more efficiently.
> Profiling indicates that cgo becomes a bottleneck during scale testing of
> electron
> ----------------------------------------------------------------------------------
>
> Key: PROTON-1910
> URL: https://issues.apache.org/jira/browse/PROTON-1910
> Project: Qpid Proton
> Issue Type: Bug
> Components: go-binding
> Affects Versions: proton-c-0.24.0
> Reporter: Aaron Smith
> Assignee: Alan Conway
> Priority: Major
>
> While performing scale testing, detailed profiling of Go test clients showed
> that >95% of the execution time can be devoted to the cgo call. The issues
> seems to be related on sends to the NewMessage() call. For receives, the
> bottleneck is both NewMessage() and the call to actually receive the message.
>
>
> This behavior is not unexpected as CGO is a well-known bottleneck. Would it
> be possible to have a NewMessage() call that return multiple messages and a
> recv call that took an "At most" argument. i.e. recv(10) would receive 10 or
> fewer messages that might be waiting in the queue. Also, it would be nice to
> be able to trade latency for throughput in that the callback wasn't triggered
> until N messages were recieved (with timeout)....
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]