Skip to content

Commit 821f31d

Browse files
mkogan1pritha-srivastava
authored andcommitted
rgw/d4n: write to the cache with O_SYNC flag by default
add conf to allow modifying cache write 'man 2 open' flags with O_SYNC enabled by default. performance impact measurment - workload is PUT of 100K 5KB objects - with O_SYNC flag: 3890 OP/s, iostat IO util% range while workload is running: ~45%-49% - without O_SYNC flag: 4511 OP/s, iostat IO util% range while workload is running: ~10%-25% Signed-off-by: Mark Kogan <[email protected]>
1 parent e4daef7 commit 821f31d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/common/options/rgw.yaml.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3819,6 +3819,18 @@ options:
38193819
services:
38203820
- rgw
38213821
with_legacy: true
3822+
- name: rgw_d4n_l1_write_open_flags
3823+
type: uint
3824+
level: advanced
3825+
desc: cache files write 'man 2 open' 'file status flags' modifiers
3826+
long_desc: For example, to configure synchronized I/O, fcntl-linux.h defines (converted from octal)
3827+
O_SYNC = 1052672
3828+
O_DSYNC = 4096
3829+
(0 for no modification of the flags)
3830+
default: 1052672
3831+
services:
3832+
- rgw
3833+
with_legacy: true
38223834
- name: rgw_d4n_libaio_aio_threads
38233835
type: int
38243836
level: advanced

src/rgw/rgw_ssd_driver.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ int SSDDriver::AsyncWriteRequest::prepare_libaio_write_op(const DoutPrefixProvid
671671
cb.reset(new struct aiocb);
672672
memset(cb.get(), 0, sizeof(struct aiocb));
673673
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
674-
r = fd = TEMP_FAILURE_RETRY(::open(file_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, mode));
674+
r = fd = TEMP_FAILURE_RETRY(::open(file_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC | dpp->get_cct()->_conf->rgw_d4n_l1_write_open_flags, mode));
675675
if (fd < 0) {
676676
//directories might have been deleted by a parallel delete of the last version of an object
677677
if (errno == ENOENT) {
@@ -683,7 +683,7 @@ int SSDDriver::AsyncWriteRequest::prepare_libaio_write_op(const DoutPrefixProvid
683683
}
684684
ldpp_dout(dpp, 20) << "INFO: AsyncWriteRequest::prepare_libaio_write_op: dir_path for creating directories=" << dir_path << dendl;
685685
create_directories(dpp, dir_path);
686-
r = fd = TEMP_FAILURE_RETRY(::open(file_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, mode));
686+
r = fd = TEMP_FAILURE_RETRY(::open(file_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC | dpp->get_cct()->_conf->rgw_d4n_l1_write_open_flags, mode));
687687
if (fd < 0) {
688688
ldpp_dout(dpp, 0) << "ERROR: AsyncWriteRequest::prepare_libaio_write_op: open file failed, errno=" << errno << ", location='" << file_path.c_str() << "'" << dendl;
689689
return r;

0 commit comments

Comments
 (0)