From 145c4767ac3d576ce8fdc4bdef4a67c671061090 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 26 Jun 2014 04:34:12 +0000 Subject: QPID-5843: Producing to many queues locks I/O threads for new connections This patch changes where the duration is calculated in sys/posix/AsyncIO.cpp->readable(). This will prevent the loop from executing past the threadMaxIoTimeNs. Doing this decreased the connection delay observed by 19%. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1605664 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'qpid/cpp') diff --git a/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp b/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp index c609e1ed31..7418c93150 100644 --- a/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp +++ b/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp @@ -443,7 +443,6 @@ void AsynchIO::readable(DispatchHandle& h) { errno = 0; int readCount = buff->byteCount-buff->dataCount; int rc = socket.read(buff->bytes + buff->dataCount, readCount); - int64_t duration = Duration(readStartTime, AbsTime::now()); ++readCalls; if (rc > 0) { buff->dataCount += rc; @@ -451,6 +450,7 @@ void AsynchIO::readable(DispatchHandle& h) { total += rc; readCallback(*this, buff); + int64_t duration = Duration(readStartTime, AbsTime::now()); if (rc != readCount) { // If we didn't fill the read buffer then time to stop reading QPID_PROBE4(asynchio_read_finished_done, &h, duration, total, readCalls); @@ -468,7 +468,7 @@ void AsynchIO::readable(DispatchHandle& h) { bufferQueue.push_front(buff); assert(buff); - QPID_PROBE5(asynchio_read_finished_error, &h, duration, total, readCalls, errno); + QPID_PROBE5(asynchio_read_finished_error, &h, Duration(readStartTime, AbsTime::now()), total, readCalls, errno); // Eof or other side has gone away if (rc == 0 || errno == ECONNRESET) { eofCallback(*this); -- cgit v1.2.1