diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-11-12 09:26:11 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-11-12 09:26:11 +0000 |
commit | 434fca0b458910329f63da49b9b1c84de232bf3f (patch) | |
tree | 6060535c3c2b13e40b37867b21230fdbdc7c80ec /searchcore | |
parent | de23b574462e6931e6afd0906257f0bd7673f1f8 (diff) |
Name the threads so it is easier to see who is doing what.
Diffstat (limited to 'searchcore')
11 files changed, 50 insertions, 22 deletions
diff --git a/searchcore/src/tests/proton/attribute/exclusive_attribute_read_accessor/exclusive_attribute_read_accessor_test.cpp b/searchcore/src/tests/proton/attribute/exclusive_attribute_read_accessor/exclusive_attribute_read_accessor_test.cpp index 19af6a699c4..e284f5ed1d9 100644 --- a/searchcore/src/tests/proton/attribute/exclusive_attribute_read_accessor/exclusive_attribute_read_accessor_test.cpp +++ b/searchcore/src/tests/proton/attribute/exclusive_attribute_read_accessor/exclusive_attribute_read_accessor_test.cpp @@ -13,6 +13,7 @@ using namespace search; using namespace vespalib; using ReadGuard = ExclusiveAttributeReadAccessor::Guard; +VESPA_THREAD_STACK_TAG(test_executor) AttributeVector::SP createAttribute() @@ -29,7 +30,7 @@ struct Fixture Fixture() : attribute(createAttribute()), - writer(SequencedTaskExecutor::create(1)), + writer(SequencedTaskExecutor::create(test_executor, 1)), accessor(attribute, *writer) {} }; diff --git a/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp b/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp index 7af9d8d816c..74a2a14dbd6 100644 --- a/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp +++ b/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp @@ -143,14 +143,16 @@ void Test::testSearch(Searchable &source, EXPECT_TRUE(search_iterator->isAtEnd()); } +VESPA_THREAD_STACK_TAG(invert_executor) +VESPA_THREAD_STACK_TAG(write_executor) // Creates a memory index, inserts documents, performs a few // searches, dumps the index to disk, and performs the searches // again. void Test::requireThatMemoryIndexCanBeDumpedAndSearched() { Schema schema = getSchema(); vespalib::ThreadStackExecutor sharedExecutor(2, 0x10000); - auto indexFieldInverter = vespalib::SequencedTaskExecutor::create(2); - auto indexFieldWriter = vespalib::SequencedTaskExecutor::create(2); + auto indexFieldInverter = vespalib::SequencedTaskExecutor::create(invert_executor, 2); + auto indexFieldWriter = vespalib::SequencedTaskExecutor::create(write_executor, 2); MemoryIndex memory_index(schema, MockFieldLengthInspector(), *indexFieldInverter, *indexFieldWriter); DocBuilder doc_builder(schema); diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp index 3f088a497aa..89594821803 100644 --- a/searchcore/src/tests/proton/index/indexmanager_test.cpp +++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp @@ -374,12 +374,15 @@ TEST_F(IndexManagerTest, require_that_source_selector_is_flushed) ASSERT_TRUE(file.OpenReadOnlyExisting()); } +VESPA_THREAD_STACK_TAG(invert_executor) +VESPA_THREAD_STACK_TAG(push_executor) + TEST_F(IndexManagerTest, require_that_flush_stats_are_calculated) { Schema schema(getSchema()); FieldIndexCollection fic(schema, MockFieldLengthInspector()); - auto invertThreads = SequencedTaskExecutor::create(2); - auto pushThreads = SequencedTaskExecutor::create(2); + auto invertThreads = SequencedTaskExecutor::create(invert_executor, 2); + auto pushThreads = SequencedTaskExecutor::create(push_executor, 2); search::memoryindex::DocumentInverter inverter(schema, *invertThreads, *pushThreads, fic); uint64_t fixed_index_size = fic.getMemoryUsage().allocatedBytes(); diff --git a/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp b/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp index bacdd85dcc5..6e0efc9188d 100644 --- a/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp +++ b/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp @@ -188,6 +188,8 @@ asImportedAttribute(const IAttributeVector &attr) return *result; } +VESPA_THREAD_STACK_TAG(attribute_executor) + struct Fixture { MyGidToLidMapperFactory::SP factory; MonitoredRefCount _gidToLidChangeListenerRefCount; @@ -204,7 +206,7 @@ struct Fixture { Fixture() : factory(std::make_shared<MyGidToLidMapperFactory>()), _gidToLidChangeListenerRefCount(), - _attributeFieldWriter(SequencedTaskExecutor::create(1)), + _attributeFieldWriter(SequencedTaskExecutor::create(attribute_executor, 1)), _parentGidToLidChangeHandler(std::make_shared<MockGidToLidChangeHandler>()), _parentGidToLidChangeHandler2(std::make_shared<MockGidToLidChangeHandler>()), parentReference(std::make_shared<MyDocumentDBReference>(factory, _parentGidToLidChangeHandler)), diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp index 3d8cb30eaa0..126a1ead89c 100644 --- a/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp +++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp @@ -33,6 +33,7 @@ GlobalId toGid(vespalib::stringref docId) { vespalib::string doc1("id:test:music::1"); vespalib::string doc2("id:test:music::2"); vespalib::string doc3("id:test:music::3"); +VESPA_THREAD_STACK_TAG(test_executor) struct MyGidToLidMapperFactory : public MockGidToLidMapperFactory { @@ -55,7 +56,7 @@ struct Fixture Fixture() : _attr(std::make_shared<ReferenceAttribute>("test", Config(BasicType::REFERENCE))), - _writer(vespalib::SequencedTaskExecutor::create(1)), + _writer(vespalib::SequencedTaskExecutor::create(test_executor, 1)), _refCount(), _listener() { diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp index 2a0b767a87c..a177aa608e7 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp @@ -49,6 +49,8 @@ logTarget(const char * text, const FlushContext & ctx) { ctx.getHandler()->getCurrentSerialNumber()); } +VESPA_THREAD_STACK_TAG(flush_engine_executor) + } FlushEngine::FlushMeta::FlushMeta(const vespalib::string & name, uint32_t id) @@ -82,7 +84,7 @@ FlushEngine::FlushEngine(std::shared_ptr<flushengine::ITlsStatsFactory> tlsStats _threadPool(128 * 1024), _strategy(std::move(strategy)), _priorityStrategy(), - _executor(numThreads, 128 * 1024), + _executor(numThreads, 128 * 1024, flush_engine_executor), _lock(), _cond(), _handlers(), diff --git a/searchcore/src/vespa/searchcore/proton/initializer/task_runner.cpp b/searchcore/src/vespa/searchcore/proton/initializer/task_runner.cpp index 16348dbace6..06d875151cc 100644 --- a/searchcore/src/vespa/searchcore/proton/initializer/task_runner.cpp +++ b/searchcore/src/vespa/searchcore/proton/initializer/task_runner.cpp @@ -9,6 +9,10 @@ using vespalib::makeLambdaTask; namespace proton::initializer { +namespace { + VESPA_THREAD_STACK_TAG(task_runner) +} + TaskRunner::TaskRunner(vespalib::Executor &executor) : _executor(executor), _runningTasks(0u) @@ -89,7 +93,7 @@ TaskRunner::internalRunTasks(const TaskList &taskList, Context::SP context) void TaskRunner::runTask(InitializerTask::SP task) { - vespalib::ThreadStackExecutor executor(1, 128 * 1024); + vespalib::ThreadStackExecutor executor(1, 128 * 1024, task_runner); std::promise<void> promise; auto future = promise.get_future(); runTask(task, executor, makeLambdaTask([&]() { promise.set_value(); })); diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp index ad47fb98232..91ef4b51a40 100644 --- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp @@ -34,6 +34,7 @@ public: } }; +VESPA_THREAD_STACK_TAG(match_engine_executor) } // namespace anon @@ -46,7 +47,7 @@ MatchEngine::MatchEngine(size_t numThreads, size_t threadsPerSearch, uint32_t di _distributionKey(distributionKey), _closed(false), _handlers(), - _executor(std::max(size_t(1), numThreads / threadsPerSearch), 256 * 1024), + _executor(std::max(size_t(1), numThreads / threadsPerSearch), 256 * 1024, match_engine_executor), _threadBundlePool(std::max(size_t(1), threadsPerSearch)), _nodeUp(false) { diff --git a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp index 0559ac2afba..80c1288903e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp @@ -19,14 +19,22 @@ namespace proton { namespace { std::unique_ptr<SyncableThreadExecutor> -createExecutorWithOneThread(uint32_t stackSize, uint32_t taskLimit, OptimizeFor optimize) { +createExecutorWithOneThread(uint32_t stackSize, uint32_t taskLimit, OptimizeFor optimize, + vespalib::Runnable::init_fun_t init_function) { if (optimize == OptimizeFor::THROUGHPUT) { - return std::make_unique<SingleExecutor>(taskLimit); + return std::make_unique<SingleExecutor>(std::move(init_function), taskLimit); } else { - return std::make_unique<BlockingThreadStackExecutor>(1, stackSize, taskLimit); + return std::make_unique<BlockingThreadStackExecutor>(1, stackSize, taskLimit, std::move(init_function)); } } +VESPA_THREAD_STACK_TAG(master_executor) +VESPA_THREAD_STACK_TAG(index_executor) +VESPA_THREAD_STACK_TAG(summary_executor) +VESPA_THREAD_STACK_TAG(field_inverter_executor) +VESPA_THREAD_STACK_TAG(field_writer_executor) +VESPA_THREAD_STACK_TAG(attribute_executor) + } ExecutorThreadingService::ExecutorThreadingService(vespalib::SyncableThreadExecutor &sharedExecutor, uint32_t num_treads) @@ -37,16 +45,16 @@ ExecutorThreadingService::ExecutorThreadingService(vespalib::SyncableThreadExecu const ThreadingServiceConfig & cfg, uint32_t stackSize) : _sharedExecutor(sharedExecutor), - _masterExecutor(1, stackSize), - _indexExecutor(createExecutorWithOneThread(stackSize, cfg.defaultTaskLimit(), cfg.optimize())), - _summaryExecutor(createExecutorWithOneThread(stackSize, cfg.defaultTaskLimit(), cfg.optimize())), + _masterExecutor(1, stackSize, master_executor), + _indexExecutor(createExecutorWithOneThread(stackSize, cfg.defaultTaskLimit(), cfg.optimize(), index_executor)), + _summaryExecutor(createExecutorWithOneThread(stackSize, cfg.defaultTaskLimit(), cfg.optimize(), summary_executor)), _masterService(_masterExecutor), _indexService(*_indexExecutor), _summaryService(*_summaryExecutor), - _indexFieldInverter(SequencedTaskExecutor::create(cfg.indexingThreads(), cfg.defaultTaskLimit())), - _indexFieldWriter(SequencedTaskExecutor::create(cfg.indexingThreads(), cfg.defaultTaskLimit())), - _attributeFieldWriter(SequencedTaskExecutor::create(cfg.indexingThreads(), cfg.defaultTaskLimit(), cfg.optimize(), - cfg.kindOfwatermark(), cfg.reactionTime())) + _indexFieldInverter(SequencedTaskExecutor::create(field_inverter_executor, cfg.indexingThreads(), cfg.defaultTaskLimit())), + _indexFieldWriter(SequencedTaskExecutor::create(field_writer_executor, cfg.indexingThreads(), cfg.defaultTaskLimit())), + _attributeFieldWriter(SequencedTaskExecutor::create(attribute_executor, cfg.indexingThreads(), cfg.defaultTaskLimit(), + cfg.optimize(), cfg.kindOfwatermark(), cfg.reactionTime())) { } diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp index 428aba1a6b5..b5efea1de91 100644 --- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp @@ -29,6 +29,8 @@ struct Pair { Pair::~Pair() = default; +VESPA_THREAD_STACK_TAG(proton_rpc_executor) + } namespace proton { @@ -203,7 +205,7 @@ RPCHooksBase::RPCHooksBase(Params ¶ms) _regAPI(*_orb, slobrok::ConfiguratorFactory(params.slobrok_config)), _stateLock(), _stateCond(), - _executor(48, 128 * 1024) + _executor(48, 128 * 1024, proton_rpc_executor) { } void diff --git a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp index 1189e8a550c..df9dbf99728 100644 --- a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp @@ -42,6 +42,8 @@ uint32_t getNumDocs(const DocsumReply &reply) { } } +VESPA_THREAD_STACK_TAG(suammry_engine_executor) + } // namespace anonymous namespace proton { @@ -60,7 +62,7 @@ SummaryEngine::SummaryEngine(size_t numThreads) : _lock(), _closed(false), _handlers(), - _executor(numThreads, 128 * 1024), + _executor(numThreads, 128 * 1024, suammry_engine_executor), _metrics(std::make_unique<DocsumMetrics>()) { } |