[ 
https://issues.apache.org/jira/browse/PROTON-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16608274#comment-16608274
 ] 

Alan Conway commented on PROTON-1910:
-------------------------------------

Possible fix:
 # Re-implement amqp.Message to hold all message data in a Go struct. No C 
calls required for any of the message property getters/setters.
 # Implement C functions goEncode to copy all the Go data to a C message and 
encode it in a single C function, likewise goDecode.
 # Keep a single pn_message_t C object associated associated with each Link. 
Send/receive is serialized per link, so a single message is sufficient for all 
encoding/decoding.

This will avoid multiple message ctor/dtor calls by automatically re-using a C 
message  (this is a known performance win in plain C code) and will move all 
message-related C calls into the proton goroutine. There will be fewer C calls 
overall and all will be serialized in a single goroutine which hopefully will 
reduce the CGO overhead - which is due mainly to the need to schedule C calls 
on a native thread.

> 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]

Reply via email to