diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-09-14 14:59:05 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-09-14 14:59:05 +0200 |
commit | 66cd305337c44b84589fb91e95d3d9662f8e6c5e (patch) | |
tree | 0ee43a40ab1d8a0b2b6e1ba837c97a6bfa011834 /searchlib | |
parent | beb641c2a972af3c992ce46407297e87c3d8e193 (diff) |
Limit the number of task s in flight to 2x number of threads in the pool.
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/vespa/searchlib/docstore/filechunk.cpp | 13 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/docstore/filechunk.h | 4 |
2 files changed, 8 insertions, 9 deletions
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 <vespa/searchlib/util/filekit.h> +#include <vespa/searchlib/common/lambdatask.h> #include <vespa/vespalib/data/fileheader.h> #include <vespa/vespalib/data/databuffer.h> #include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/vespalib/util/blockingthreadstackexecutor.h> +#include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/array.hpp> #include <vespa/vespalib/stllike/hash_map.hpp> -#include <vespa/searchlib/util/filekit.h> -#include <vespa/searchlib/common/lambdatask.h> -#include <vespa/vespalib/objects/nbostream.h> #include <vespa/fastos/file.h> -#include <vespa/vespalib/util/threadstackexecutor.h> #include <future> #include <vespa/log/log.h> @@ -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<Chunk::UP> promisedChunk; std::future<Chunk::UP> 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 |