Skip to content

Commit

Permalink
configurable disk IO size for writes
Browse files Browse the repository at this point in the history
  • Loading branch information
mckurt committed Nov 11, 2015
1 parent 30ce7d5 commit 7d41118
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/cc/libclient/KfsClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4518,7 +4518,7 @@ KfsClientImpl::StartProtocolWorker()
params.mMaxReadSize = (maxReadSize + kChecksumBlockSize - 1) /
kChecksumBlockSize * kChecksumBlockSize;
} else {
params.mMaxReadSize = mTargetDiskIoSize;
params.mMaxReadSize = max(4 << 20, mTargetDiskIoSize);
}
params.mUseClientPoolFlag = mConfig.getValue(
"client.connectionPool", params.mUseClientPoolFlag ? 1 : 0) != 0;
Expand Down
9 changes: 6 additions & 3 deletions src/cc/libclient/KfsProtocolWorker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,8 @@ class KfsProtocolWorker::Impl :
FileWriter(
Owner& inOwner,
Workers::iterator inWorkersIt,
const char* inLogPrefixPtr)
const char* inLogPrefixPtr,
int inMaxWriteSize)
: Worker(inOwner, inWorkersIt),
Writer::Completion(),
mWriter(
Expand All @@ -1109,7 +1110,8 @@ class KfsProtocolWorker::Impl :
inOwner.mTimeSecBetweenRetries,
inOwner.mOpTimeoutSec,
inOwner.mIdleTimeoutSec,
inOwner.mMaxWriteSize,
min(max(4 << 20, inOwner.mMaxWriteSize),
max(inOwner.mMaxWriteSize, inMaxWriteSize)),
inLogPrefixPtr,
inOwner.mChunkServerInitialSeqNum
),
Expand Down Expand Up @@ -1709,7 +1711,8 @@ class KfsProtocolWorker::Impl :
*this, inWorkersIt, theLogPrefix.c_str())) :
(IsWrite(inRequest) ?
static_cast<Worker*>(new FileWriter(
*this, inWorkersIt, theLogPrefix.c_str())) :
*this, inWorkersIt, theLogPrefix.c_str(),
inRequest.mParamsPtr->mDiskIoSize)) :
(IsRead(inRequest) ?
static_cast<Worker*>(new FileReader(
*this, inWorkersIt, theLogPrefix.c_str())) :
Expand Down
1 change: 1 addition & 0 deletions src/cc/libclient/KfsProtocolWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class KfsProtocolWorker
bool mSkipHolesFlag;
int mMsgLogId;
bool mFailShortReadsFlag;
int mDiskIoSize;
};
Request(
RequestType inOpType = kRequestTypeUnknown,
Expand Down
10 changes: 10 additions & 0 deletions src/cc/libclient/KfsWrite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ KfsClientImpl::Write(int fd, const char *buf, size_t numBytes,
openParams.mRecoveryStripeCount = entry.fattr.numRecoveryStripes;
openParams.mReplicaCount = entry.fattr.numReplicas;
openParams.mMsgLogId = fd;
if(entry.fattr.striperType == KFS_STRIPED_FILE_TYPE_NONE) {
openParams.mDiskIoSize = entry.ioBufferSize;
}
else {
const int kChecksumBlockSize = (int) CHECKSUM_BLOCKSIZE;
const int totalStripeCount =
entry.fattr.numStripes + entry.fattr.numRecoveryStripes;
openParams.mDiskIoSize = (entry.ioBufferSize / totalStripeCount
+ kChecksumBlockSize - 1) / kChecksumBlockSize * kChecksumBlockSize;
}
entry.usedProtocolWorkerFlag = true;
entry.pending += numBytes;
const KfsProtocolWorker::FileId fileId = entry.fattr.fileId;
Expand Down
2 changes: 1 addition & 1 deletion src/test-scripts/qfstest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ chunkServer.abortOnChecksumMismatchFlag = 1
chunkServer.msgLogWriter.logLevel = DEBUG
chunkServer.recAppender.closeEmptyWidStateSec = 5
chunkServer.ioBufferPool.partitionBufferCount = 8192
chunkServer.bufferManager.maxClientQuota = 2097152
chunkServer.bufferManager.maxClientQuota = 8388608
chunkServer.requireChunkHeaderChecksum = 1
chunkServer.storageTierPrefixes = kfschunk-tier0 2
chunkServer.exitDebugCheck = 1
Expand Down

0 comments on commit 7d41118

Please sign in to comment.