From 66cd305337c44b84589fb91e95d3d9662f8e6c5e Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Thu, 14 Sep 2017 14:59:05 +0200 Subject: Limit the number of task s in flight to 2x number of threads in the pool. --- searchlib/src/vespa/searchlib/docstore/filechunk.cpp | 13 ++++++------- searchlib/src/vespa/searchlib/docstore/filechunk.h | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'searchlib') diff --git a/searchlib/src/vespa/searchlib/docstore/filechunk.cpp b/searchlib/src/vespa/searchlib/docstore/filechunk.cpp index c823bacb10c..4fac42c1421 100644 --- a/searchlib/src/vespa/searchlib/docstore/filechunk.cpp +++ b/searchlib/src/vespa/searchlib/docstore/filechunk.cpp @@ -4,16 +4,16 @@ #include "data_store_file_chunk_stats.h" #include "summaryexceptions.h" #include "randreaders.h" +#include +#include #include #include #include +#include +#include #include #include -#include -#include -#include #include -#include #include #include @@ -333,16 +333,15 @@ appendChunks(FixedParams * args, Chunk::UP chunk) } - void -FileChunk::appendTo(vespalib::Executor & executor, const IGetLid & db, IWriteData & dest, +FileChunk::appendTo(vespalib::ThreadExecutor & executor, const IGetLid & db, IWriteData & dest, uint32_t numChunks, IFileChunkVisitorProgress *visitorProgress) { assert(frozen() || visitorProgress); vespalib::GenerationHandler::Guard lidReadGuard(db.getLidReadGuard()); assert(numChunks <= getNumChunks()); FixedParams fixedParams = {db, dest, lidReadGuard, getFileId().getId(), visitorProgress}; - vespalib::ThreadStackExecutor singleExecutor(1, 64*1024); + vespalib::BlockingThreadStackExecutor singleExecutor(1, 64*1024, executor.getNumThreads()*2); for (size_t chunkId(0); chunkId < numChunks; chunkId++) { std::promise promisedChunk; std::future futureChunk = promisedChunk.get_future(); diff --git a/searchlib/src/vespa/searchlib/docstore/filechunk.h b/searchlib/src/vespa/searchlib/docstore/filechunk.h index a7b6556a0a3..87dc2e018eb 100644 --- a/searchlib/src/vespa/searchlib/docstore/filechunk.h +++ b/searchlib/src/vespa/searchlib/docstore/filechunk.h @@ -18,7 +18,7 @@ class FastOS_FileInterface; namespace vespalib { class DataBuffer; class GenericHeader; - class Executor; + class ThreadExecutor; } namespace search { @@ -162,7 +162,7 @@ public: virtual bool frozen() const { return true; } const vespalib::string & getName() const { return _name; } void compact(const IGetLid & iGetLid); - void appendTo(vespalib::Executor & executor, const IGetLid & db, IWriteData & dest, + void appendTo(vespalib::ThreadExecutor & executor, const IGetLid & db, IWriteData & dest, uint32_t numChunks, IFileChunkVisitorProgress *visitorProgress); /** * Must be called after chunk has been created to allow correct -- cgit v1.2.3