Commit df708c4e authored by John Esmet's avatar John Esmet Committed by Yoni Fogel

refs #5710 add FT_MSG_KEYVAL_BYTES_IN to measure the amount of key/value...

refs #5710 add FT_MSG_KEYVAL_BYTES_IN to measure the amount of key/value userdata ingested at the root. this value does not count message/xid overhead so it is a good denominator when calculating write amplification


git-svn-id: file:///svn/toku/tokudb@50404 c7de825b-a66e-492c-adef-691d508d4ae1
parent 60854dac
...@@ -973,6 +973,7 @@ typedef enum { ...@@ -973,6 +973,7 @@ typedef enum {
FT_CREATE_NONLEAF, // number of nonleaf nodes created FT_CREATE_NONLEAF, // number of nonleaf nodes created
FT_DESTROY_LEAF, // number of leaf nodes destroyed FT_DESTROY_LEAF, // number of leaf nodes destroyed
FT_DESTROY_NONLEAF, // number of nonleaf nodes destroyed FT_DESTROY_NONLEAF, // number of nonleaf nodes destroyed
FT_MSG_KEYVAL_BYTES_IN, // how many bytes of keyval data ingested by the tree (all tree, no overhead counted)
FT_MSG_BYTES_IN, // how many bytes of messages injected at root (for all trees) FT_MSG_BYTES_IN, // how many bytes of messages injected at root (for all trees)
FT_MSG_BYTES_OUT, // how many bytes of messages flushed from h1 nodes to leaves FT_MSG_BYTES_OUT, // how many bytes of messages flushed from h1 nodes to leaves
FT_MSG_BYTES_CURR, // how many bytes of messages currently in trees (estimate) FT_MSG_BYTES_CURR, // how many bytes of messages currently in trees (estimate)
......
...@@ -187,6 +187,7 @@ status_init(void) ...@@ -187,6 +187,7 @@ status_init(void)
STATUS_INIT(FT_CREATE_NONLEAF, PARCOUNT, "nonleaf nodes created"); STATUS_INIT(FT_CREATE_NONLEAF, PARCOUNT, "nonleaf nodes created");
STATUS_INIT(FT_DESTROY_LEAF, PARCOUNT, "leaf nodes destroyed"); STATUS_INIT(FT_DESTROY_LEAF, PARCOUNT, "leaf nodes destroyed");
STATUS_INIT(FT_DESTROY_NONLEAF, PARCOUNT, "nonleaf nodes destroyed"); STATUS_INIT(FT_DESTROY_NONLEAF, PARCOUNT, "nonleaf nodes destroyed");
STATUS_INIT(FT_MSG_KEYVAL_BYTES_IN, PARCOUNT, "bytes of keys/values injected at root (all trees, no message overhead)");
STATUS_INIT(FT_MSG_BYTES_IN, PARCOUNT, "bytes of messages injected at root (all trees)"); STATUS_INIT(FT_MSG_BYTES_IN, PARCOUNT, "bytes of messages injected at root (all trees)");
STATUS_INIT(FT_MSG_BYTES_OUT, PARCOUNT, "bytes of messages flushed from h1 nodes to leaves"); STATUS_INIT(FT_MSG_BYTES_OUT, PARCOUNT, "bytes of messages flushed from h1 nodes to leaves");
STATUS_INIT(FT_MSG_BYTES_CURR, PARCOUNT, "bytes of messages currently in trees (estimate)"); STATUS_INIT(FT_MSG_BYTES_CURR, PARCOUNT, "bytes of messages currently in trees (estimate)");
...@@ -2006,18 +2007,22 @@ toku_ftnode_hot_next_child(FTNODE node, ...@@ -2006,18 +2007,22 @@ toku_ftnode_hot_next_child(FTNODE node,
return low; return low;
} }
static uint64_t
ft_msg_keyval_size(FT_MSG msg) {
size_t keylen = msg->u.id.key->size;
size_t vallen = msg->u.id.val->size;
return keylen + vallen;
}
// TODO Use this function to clean up other places where bits of messages are passed around // TODO Use this function to clean up other places where bits of messages are passed around
// such as toku_bnc_insert_msg() and the call stack above it. // such as toku_bnc_insert_msg() and the call stack above it.
static size_t static uint64_t
ft_msg_size(FT_MSG msg) { ft_msg_size(FT_MSG msg) {
size_t keylen = msg->u.id.key->size; size_t keyval_size = ft_msg_keyval_size(msg);
size_t vallen = msg->u.id.val->size;
size_t xids_size = xids_get_serialize_size(msg->xids); size_t xids_size = xids_get_serialize_size(msg->xids);
size_t rval = keylen + vallen + KEY_VALUE_OVERHEAD + FT_CMD_OVERHEAD + xids_size; return keyval_size + KEY_VALUE_OVERHEAD + FT_CMD_OVERHEAD + xids_size;
return rval;
} }
static void static void
ft_nonleaf_cmd_all (ft_compare_func compare_fun, DESCRIPTOR desc, FTNODE node, FT_MSG cmd, bool is_fresh, size_t flow_deltas[]) ft_nonleaf_cmd_all (ft_compare_func compare_fun, DESCRIPTOR desc, FTNODE node, FT_MSG cmd, bool is_fresh, size_t flow_deltas[])
// Effect: Put the cmd into a nonleaf node. We put it into all children, possibly causing the children to become reactive. // Effect: Put the cmd into a nonleaf node. We put it into all children, possibly causing the children to become reactive.
...@@ -2444,6 +2449,7 @@ static void inject_message_in_locked_node(FT ft, FTNODE node, int childnum, FT_M ...@@ -2444,6 +2449,7 @@ static void inject_message_in_locked_node(FT ft, FTNODE node, int childnum, FT_M
// //
paranoid_invariant(node->dirty != 0); paranoid_invariant(node->dirty != 0);
// TODO: Why not at height 0?
// update some status variables // update some status variables
if (node->height != 0) { if (node->height != 0) {
uint64_t msgsize = ft_msg_size(cmd); uint64_t msgsize = ft_msg_size(cmd);
...@@ -2454,6 +2460,8 @@ static void inject_message_in_locked_node(FT ft, FTNODE node, int childnum, FT_M ...@@ -2454,6 +2460,8 @@ static void inject_message_in_locked_node(FT ft, FTNODE node, int childnum, FT_M
STATUS_INC(FT_MSG_NUM_BROADCAST, 1); STATUS_INC(FT_MSG_NUM_BROADCAST, 1);
} }
} }
uint64_t keyval_size = ft_msg_keyval_size(cmd);
STATUS_INC(FT_MSG_KEYVAL_BYTES_IN, keyval_size);
// verify that msn of latest message was captured in root node // verify that msn of latest message was captured in root node
paranoid_invariant(cmd->msn.msn == node->max_msn_applied_to_node_on_disk.msn); paranoid_invariant(cmd->msn.msn == node->max_msn_applied_to_node_on_disk.msn);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment