You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bb...@apache.org on 2019/06/06 17:13:32 UTC
[geode-native] branch develop updated: GEODE-6576: Improvements in
cleanStaleConnections method (#477)
This is an automated email from the ASF dual-hosted git repository.
bbender pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git
The following commit(s) were added to refs/heads/develop by this push:
new 5210670 GEODE-6576: Improvements in cleanStaleConnections method (#477)
5210670 is described below
commit 5210670ca891729da78ead36dc1b63f49eced653
Author: mivanac <48...@users.noreply.github.com>
AuthorDate: Thu Jun 6 19:13:27 2019 +0200
GEODE-6576: Improvements in cleanStaleConnections method (#477)
Improvements in cleanStaleConnections method:
- introduce phasing
- return connections to pool as soon as possible
This fault can be reproduced with geode-native-examples - putgetremove. For reproduction test:
- set min and max connections to 800.
- set LoadConditioningInterval to 60 secs
- run continues get operation, and measure duration of get operation.
- Every 60 seconds you will see peaks with time duration over 100ms.And this is the problem.
---
cppcache/src/ThinClientPoolDM.cpp | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/cppcache/src/ThinClientPoolDM.cpp b/cppcache/src/ThinClientPoolDM.cpp
index c89bebc..f2d4385 100644
--- a/cppcache/src/ThinClientPoolDM.cpp
+++ b/cppcache/src/ThinClientPoolDM.cpp
@@ -18,6 +18,7 @@
#include "ThinClientPoolDM.hpp"
#include <algorithm>
+#include <thread>
#include <ace/INET_Addr.h>
@@ -430,6 +431,14 @@ void ThinClientPoolDM::cleanStaleConnections(std::atomic<bool>& isRunning) {
size_t replaceCount =
m_attrs->getMinConnections() - static_cast<int>(savelist.size());
+ LOGDEBUG("Preserving %d connections", savelist.size());
+
+ for (auto savedconn : savelist) {
+ put(savedconn, false);
+ }
+ savelist.clear();
+ int count = 0;
+
for (std::vector<TcrConnection*>::const_iterator iter = replacelist.begin();
iter != replacelist.end(); ++iter) {
TcrConnection* conn = *iter;
@@ -451,7 +460,7 @@ void ThinClientPoolDM::cleanStaleConnections(std::atomic<bool>& isRunning) {
if (nextIdle > std::chrono::seconds::zero() && nextIdle < _nextIdle) {
_nextIdle = nextIdle;
}
- savelist.push_back(newConn);
+ put(newConn, false);
if (newConn != conn) {
GF_SAFE_DELETE_CON(conn);
removeEPConnections(1, false);
@@ -474,20 +483,19 @@ void ThinClientPoolDM::cleanStaleConnections(std::atomic<bool>& isRunning) {
nextIdle < _nextIdle) {
_nextIdle = nextIdle;
}
- savelist.push_back(conn);
+ put(conn, false);
}
}
}
replaceCount--;
+ count++;
+ if (count % 10 == 0) {
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
+ }
}
-
- LOGDEBUG("Preserving %d connections", savelist.size());
-
- for (std::vector<TcrConnection*>::const_iterator iter = savelist.begin();
- iter != savelist.end(); ++iter) {
- put(*iter, false);
- }
+ replacelist.clear();
}
+
if (m_connManageTaskId >= 0 && isRunning &&
m_connManager.getCacheImpl()->getExpiryTaskManager().resetTask(
m_connManageTaskId, _nextIdle)) {