1
0
Fork 0

Measure time a request takes to get executed by the scheduler (#9224)

This commit is contained in:
Tobias Gödderz 2019-06-18 17:34:33 +02:00 committed by Michael Hackstein
parent c854d04864
commit da6e9da820
3 changed files with 6 additions and 3 deletions

View File

@ -455,10 +455,13 @@ bool GeneralCommTask::handleRequestSync(std::shared_ptr<RestHandler> handler) {
return false; return false;
} }
RequestStatistics::SET_QUEUE_START(handler->statistics(), SchedulerFeature::SCHEDULER->queueStatistics()._queued);
// queue the operation in the scheduler, and make it eligible for direct execution // queue the operation in the scheduler, and make it eligible for direct execution
// only if the current CommTask type allows it (HttpCommTask: yes, VstCommTask: no) // only if the current CommTask type allows it (HttpCommTask: yes, VstCommTask: no)
// and there is currently only a single client handled by the IoContext // and there is currently only a single client handled by the IoContext
bool ok = SchedulerFeature::SCHEDULER->queue(handler->getRequestLane(), [self = shared_from_this(), handler]() { bool ok = SchedulerFeature::SCHEDULER->queue(handler->getRequestLane(), [self = shared_from_this(), handler]() {
RequestStatistics::SET_QUEUE_END(handler->statistics());
auto thisPtr = static_cast<GeneralCommTask*>(self.get()); auto thisPtr = static_cast<GeneralCommTask*>(self.get());
thisPtr->handleRequestDirectly(basics::ConditionalLocking::DoLock, handler); thisPtr->handleRequestDirectly(basics::ConditionalLocking::DoLock, handler);
}, allowDirectHandling() && _peer->clients() == 1); }, allowDirectHandling() && _peer->clients() == 1);
@ -473,7 +476,7 @@ bool GeneralCommTask::handleRequestSync(std::shared_ptr<RestHandler> handler) {
} }
// Just run the handler, could have been called in a different thread // Just run the handler, could have been called in a different thread
void GeneralCommTask::handleRequestDirectly(bool doLock, std::shared_ptr<RestHandler> handler) { void GeneralCommTask::handleRequestDirectly(bool doLock, std::shared_ptr<RestHandler> const& handler) {
TRI_ASSERT(doLock || _peer->runningInThisThread()); TRI_ASSERT(doLock || _peer->runningInThisThread());
if (application_features::ApplicationServer::isStopping()) { if (application_features::ApplicationServer::isStopping()) {

View File

@ -156,7 +156,7 @@ class GeneralCommTask : public SocketTask {
private: private:
bool handleRequestSync(std::shared_ptr<RestHandler>); bool handleRequestSync(std::shared_ptr<RestHandler>);
void handleRequestDirectly(bool doLock, std::shared_ptr<RestHandler>); void handleRequestDirectly(bool doLock, std::shared_ptr<RestHandler> const&);
bool handleRequestAsync(std::shared_ptr<RestHandler>, uint64_t* jobId = nullptr); bool handleRequestAsync(std::shared_ptr<RestHandler>, uint64_t* jobId = nullptr);
}; };
} // namespace rest } // namespace rest

View File

@ -156,7 +156,7 @@ for aid in `seq 0 $(( $NRAGENTS - 1 ))`; do
--server.endpoint $TRANSPORT://$ENDPOINT:$PORT \ --server.endpoint $TRANSPORT://$ENDPOINT:$PORT \
--server.statistics false \ --server.statistics false \
--log.file cluster/$PORT.log \ --log.file cluster/$PORT.log \
--log.force-direct true \ --log.force-direct true \
--log.level $LOG_LEVEL_AGENCY \ --log.level $LOG_LEVEL_AGENCY \
--javascript.allow-admin-execute true \ --javascript.allow-admin-execute true \
$STORAGE_ENGINE \ $STORAGE_ENGINE \