Todd Lipcon has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/15800 )

Change subject: KUDU-2844 (1/3): make BlockHandle ref-counted
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/15800/2/src/kudu/cfile/block_handle.h
File src/kudu/cfile/block_handle.h:

http://gerrit.cloudera.org:8080/#/c/15800/2/src/kudu/cfile/block_handle.h@94
PS2, Line 94:   boost::variant<BlockCacheHandle, std::shared_ptr<BlockHandle>> 
ref_;
> Given how many block handlers we expect there to be in the lifespan of a se
Since we use std::make_shared I think it ends up with the same 
single-allocation single-cacheline effect anyway. We should update the 
contribution guide. From a bit of reading, it seems like there is some memory 
footprint downside to shared_ptr instead of scoped_refptr:

https://www.nextptr.com/tutorial/ta1358374985/shared_ptr-basics-and-internals-with-examples

It seems the enable_shared_from_this<T> adds 16 bytes (a weak ptr) to the 
footprint of BlockHandle, and a shared_ptr control block is at least 16 bytes. 
The above doc claims it's 24 or 32 but at least with libstdcxx I'm only seeing 
16 when I try it out. So, the total overhead is 32 bytes per BlockHandle, 
whereas with scoped_refptr it's only 8 bytes.

What do you think, is it worth going back to scoped_refptr instead of 
std::shared_ptr? I guess we have one BlockHandle per initialized dictionary 
block, right? The rest should be transient.



--
To view, visit http://gerrit.cloudera.org:8080/15800
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I1077fcc841ca31a2cb523769fffeed2d27782bc1
Gerrit-Change-Number: 15800
Gerrit-PatchSet: 2
Gerrit-Owner: Todd Lipcon <t...@apache.org>
Gerrit-Reviewer: Alexey Serbin <aser...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <andrew.w...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <aw...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Todd Lipcon <t...@apache.org>
Gerrit-Reviewer: Volodymyr Verovkin <verjov...@cloudera.com>
Gerrit-Comment-Date: Thu, 13 Aug 2020 20:28:48 +0000
Gerrit-HasComments: Yes

Reply via email to