commit
e83535ef40
|
@ -56,7 +56,7 @@ int32_t tsShellActivityTimer = 3; // second
|
|||
// queue & threads
|
||||
int32_t tsNumOfRpcThreads = 1;
|
||||
int32_t tsNumOfRpcSessions = 30000;
|
||||
int32_t tsShareConnLimit = 8;
|
||||
int32_t tsShareConnLimit = 10;
|
||||
int32_t tsReadTimeout = 900;
|
||||
int32_t tsTimeToGetAvailableConn = 500000;
|
||||
int32_t tsKeepAliveIdle = 60;
|
||||
|
|
|
@ -27,7 +27,7 @@ typedef struct {
|
|||
typedef struct SConnList {
|
||||
queue conns;
|
||||
int32_t size;
|
||||
int32_t totaSize;
|
||||
int32_t totalSize;
|
||||
} SConnList;
|
||||
|
||||
typedef struct {
|
||||
|
@ -855,10 +855,9 @@ static int32_t cliGetConnFromPool(SCliThrd* pThrd, const char* key, SCliConn** p
|
|||
}
|
||||
|
||||
if (QUEUE_IS_EMPTY(&plist->conns)) {
|
||||
if (plist->size >= pInst->connLimitNum) {
|
||||
if (plist->totalSize >= pInst->connLimitNum) {
|
||||
return TSDB_CODE_RPC_MAX_SESSIONS;
|
||||
}
|
||||
plist->totaSize += 1;
|
||||
return TSDB_CODE_RPC_NETWORK_BUSY;
|
||||
}
|
||||
|
||||
|
@ -1046,7 +1045,7 @@ static int32_t cliCreateConn(SCliThrd* pThrd, SCliConn** pCliConn, char* ip, int
|
|||
conn->hostThrd = pThrd;
|
||||
conn->seq = 0;
|
||||
|
||||
conn->pQTable = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
|
||||
conn->pQTable = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
|
||||
if (conn->pQTable == NULL) {
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _failed);
|
||||
}
|
||||
|
@ -1249,7 +1248,7 @@ static void cliHandleException(SCliConn* conn) {
|
|||
cliDestroyAllQidFromThrd(conn);
|
||||
QUEUE_REMOVE(&conn->q);
|
||||
if (conn->list) {
|
||||
conn->list->totaSize -= 1;
|
||||
conn->list->totalSize -= 1;
|
||||
conn->list = NULL;
|
||||
}
|
||||
|
||||
|
@ -1548,10 +1547,15 @@ static int32_t cliDoConn(SCliThrd* pThrd, SCliConn* conn) {
|
|||
}
|
||||
|
||||
transRefCliHandle(conn);
|
||||
|
||||
conn->list = taosHashGet((SHashObj*)pThrd->pool, conn->dstAddr, strlen(conn->dstAddr));
|
||||
if (conn->list != NULL) {
|
||||
conn->list->totalSize += 1;
|
||||
}
|
||||
|
||||
ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb);
|
||||
if (ret != 0) {
|
||||
tError("failed connect to %s since %s", conn->dstAddr, uv_err_name(ret));
|
||||
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, &lino, _exception1);
|
||||
}
|
||||
|
||||
|
@ -2363,7 +2367,7 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
|
|||
}
|
||||
}
|
||||
|
||||
pThrd->pool = createConnPool(4);
|
||||
pThrd->pool = createConnPool(128);
|
||||
if (pThrd->pool == NULL) {
|
||||
code = terrno;
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||
|
@ -2382,22 +2386,22 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
|
|||
|
||||
pThrd->destroyAhandleFp = pInst->destroyFp;
|
||||
|
||||
pThrd->fqdn2ipCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
pThrd->fqdn2ipCache = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
if (pThrd->fqdn2ipCache == NULL) {
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||
}
|
||||
|
||||
pThrd->batchCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
pThrd->batchCache = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
if (pThrd->batchCache == NULL) {
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _end);
|
||||
}
|
||||
|
||||
pThrd->connHeapCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
pThrd->connHeapCache = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
if (pThrd->connHeapCache == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
|
||||
}
|
||||
|
||||
pThrd->pIdConnTable = taosHashInit(512, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
pThrd->pIdConnTable = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
if (pThrd->connHeapCache == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
|
||||
}
|
||||
|
@ -3739,7 +3743,7 @@ static FORCE_INLINE int8_t shouldSWitchToOtherConn(SCliConn* pConn, char* key) {
|
|||
tTrace("conn %p get list %p from pool for key:%s", pConn, pConn->list, key);
|
||||
}
|
||||
}
|
||||
if (pConn->list && pConn->list->totaSize >= pInst->connLimitNum / 4) {
|
||||
if (pConn->list && pConn->list->totalSize >= pInst->connLimitNum / 4) {
|
||||
tWarn("%s conn %p try to remove timeout msg since too many conn created", transLabel(pInst), pConn);
|
||||
|
||||
if (cliConnRemoveTimeoutMsg(pConn)) {
|
||||
|
|
|
@ -239,7 +239,7 @@ SIpWhiteListTab* uvWhiteListCreate() {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
pWhiteList->pList = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), 0, HASH_NO_LOCK);
|
||||
pWhiteList->pList = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), 0, HASH_NO_LOCK);
|
||||
if (pWhiteList->pList == NULL) {
|
||||
taosMemoryFree(pWhiteList);
|
||||
return NULL;
|
||||
|
@ -1333,7 +1333,7 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) {
|
|||
QUEUE_INIT(&exh->q);
|
||||
tTrace("%s handle %p, conn %p created, refId:%" PRId64, transLabel(pInst), exh, pConn, pConn->refId);
|
||||
|
||||
pConn->pQTable = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
|
||||
pConn->pQTable = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
|
||||
if (pConn->pQTable == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _end);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue