[ 
https://issues.apache.org/jira/browse/HDFS-918?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12834252#action_12834252
 ] 

Jay Booth commented on HDFS-918:
--------------------------------

Yeah, I'll do my best to get benchmarks by the end of the weekend, kind of a 
crazy week this week and I moved this past weekend, so I don't have a ton of 
time.  Todd, if you feel like blasting a couple stream-of-consciousness 
comments to me via email, go right ahead, otherwise I'll run the benchmarks 
this weekend and wait for the well-written version :).  

Zlatin, I originally had a similar architecture to what you're describing, 
using a BlockingQueue to funnel the actual work to a threadpool, but I had some 
issues with being able to get the locking quite right, either I wasn't getting 
things into the queue as fast as possible, or I was burning a lot of empty 
cycles in the selector thread.  Specifically, I can't cancel a SelectionKey and 
then re-register with the same selector afterwards, it leads to exceptions, so 
my Selector thread was spinning in a tight loop verifying that, yes, all of 
these writable SelectionKeys are currently enqueued for work, whenever anything 
was being processed.  But that was a couple iterations ago, maybe I'll have 
better luck trying it now.  What we really need is a libevent-like framework, 
I'll spend a little time reviewing the outward facing API for that and 
scratching my noggin.

Ultimately, only so much I/O can actually happen at a time before the disk is 
swamped, so it might be that a set of, say, 32 selector threads gets the same 
performance as 1024 threads.  In that case, we'd be taking up fewer resources 
for the same performance.  At any rate, I need to benchmark before speculating 
further.



> Use single Selector and small thread pool to replace many instances of 
> BlockSender for reads
> --------------------------------------------------------------------------------------------
>
>                 Key: HDFS-918
>                 URL: https://issues.apache.org/jira/browse/HDFS-918
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: data-node
>            Reporter: Jay Booth
>             Fix For: 0.22.0
>
>         Attachments: hdfs-918-20100201.patch, hdfs-918-20100203.patch, 
> hdfs-918-20100211.patch, hdfs-multiplex.patch
>
>
> Currently, on read requests, the DataXCeiver server allocates a new thread 
> per request, which must allocate its own buffers and leads to 
> higher-than-optimal CPU and memory usage by the sending threads.  If we had a 
> single selector and a small threadpool to multiplex request packets, we could 
> theoretically achieve higher performance while taking up fewer resources and 
> leaving more CPU on datanodes available for mapred, hbase or whatever.  This 
> can be done without changing any wire protocols.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to