Github user vanzin commented on the pull request:

    https://github.com/apache/spark/pull/5234#issuecomment-87155672
  
    Adding a lock is always a little bit scary, but I wouldn't expect a lot of 
overhead from this code, given that netty itself has to do context switching to 
actually write the data to the socket. An easy optimization would be to avoid 
the lock when the input list has a single element, since in that case we don't 
care about the ordering.
    
    One question I have is: does netty have some interface/method that I can 
implement to make any object directly writable to a socket? e.g. the 
`transferTo` method you mention; can I just implement that and netty will 
handle it? I couldn't find anything in the javadocs.
    
    If there is something like that, then we can avoid the lock by wrapping the 
two messages created by `ChunkFetchSuccess` in an object that implements that 
interface. Still zero copy, and just requires allocating one extra small object.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to