mirror of
https://github.com/ceph/ceph
synced 2024-12-17 08:57:28 +00:00
Merge pull request #10080 from xiexingguo/xxg-wip-add-compress-ratio
os/bluestore: improve required compression threshold Reviewed-by: Sage Weil <sage@
This commit is contained in:
commit
7cff281e7d
@ -965,6 +965,12 @@ OPTION(bluestore_compression, OPT_STR, "none") // force|aggressive|passive|none
|
||||
OPTION(bluestore_compression_algorithm, OPT_STR, "snappy")
|
||||
OPTION(bluestore_compression_min_blob_size, OPT_U32, 256*1024)
|
||||
OPTION(bluestore_compression_max_blob_size, OPT_U32, 4*1024*1024)
|
||||
/*
|
||||
* Require the net gain of compression at least to be at this ratio,
|
||||
* otherwise we don't compress.
|
||||
* And ask for compressing at least 12.5%(1/8) off, by default.
|
||||
*/
|
||||
OPTION(bluestore_compression_required_ratio, OPT_DOUBLE, .875)
|
||||
OPTION(bluestore_cache_type, OPT_STR, "2q") // lru, 2q
|
||||
OPTION(bluestore_onode_cache_size, OPT_U32, 16*1024)
|
||||
OPTION(bluestore_buffer_cache_size, OPT_U32, 512*1024*1024)
|
||||
|
@ -5943,8 +5943,12 @@ int BlueStore::_do_alloc_write(
|
||||
compressed_bl.claim_append(t);
|
||||
uint64_t rawlen = compressed_bl.length();
|
||||
uint64_t newlen = ROUND_UP_TO(rawlen, min_alloc_size);
|
||||
if (newlen < final_length) {
|
||||
// pad out to min_alloc_size
|
||||
uint64_t dstlen = final_length *
|
||||
g_conf->bluestore_compression_required_ratio;
|
||||
dstlen = ROUND_UP_TO(dstlen, min_alloc_size);
|
||||
if (newlen <= dstlen && newlen < final_length) {
|
||||
// Cool. We compressed at least as much as we were hoping to.
|
||||
// pad out to min_alloc_size
|
||||
compressed_bl.append_zero(newlen - rawlen);
|
||||
logger->inc(l_bluestore_write_pad_bytes, newlen - rawlen);
|
||||
dout(20) << __func__ << hex << " compressed 0x" << wi.blob_length
|
||||
@ -5962,9 +5966,10 @@ int BlueStore::_do_alloc_write(
|
||||
compressed = true;
|
||||
} else {
|
||||
dout(20) << __func__ << hex << " compressed 0x" << l->length()
|
||||
<< " -> 0x" << rawlen << " with " << chdr.type
|
||||
<< ", leaving uncompressed"
|
||||
<< dec << dendl;
|
||||
<< " -> 0x" << rawlen << " with " << chdr.type
|
||||
<< ", which is more than required 0x" << dstlen
|
||||
<< ", leaving uncompressed"
|
||||
<< dec << dendl;
|
||||
}
|
||||
}
|
||||
if (!compressed) {
|
||||
|
Loading…
Reference in New Issue
Block a user