add http test

This commit is contained in:
yihaoDeng 2023-11-23 15:19:48 +08:00
parent 50922427ff
commit b22bc3fe62
2 changed files with 10 additions and 9 deletions

View File

@ -28,6 +28,7 @@
static int32_t httpRefMgt = 0;
static int64_t httpRef = -1;
static int32_t FAST_FAILURE_LIMIT = 120;
typedef struct SHttpModule {
uv_loop_t* loop;
SAsyncPool* asyncPool;
@ -198,11 +199,12 @@ static void httpAsyncCb(uv_async_t* handle) {
queue wq;
QUEUE_INIT(&wq);
static int32_t BACTHSIZE = 5;
static int32_t BATCH_SIZE = 5;
int32_t count = 0;
taosThreadMutexLock(&item->mtx);
while (!QUEUE_IS_EMPTY(&item->qmsg) && count++ < BACTHSIZE) {
while (!QUEUE_IS_EMPTY(&item->qmsg) && count++ < BATCH_SIZE) {
queue* h = QUEUE_HEAD(&item->qmsg);
QUEUE_REMOVE(h);
QUEUE_PUSH(&wq, h);
@ -376,11 +378,10 @@ static bool httpFailFastShoudIgnoreMsg(SHashObj* pTable, char* server, int16_t p
if (failedTime == NULL) {
return false;
}
int32_t now = taosGetTimestampSec();
tError("failed timestamp %d, curr timestamp:%d", *failedTime, now);
if (*failedTime > now - 60) {
tError("http-report succ to ignore msg,reason:connection timed out, dst:%s", buf);
int32_t now = taosGetTimestampSec();
if (*failedTime > now - FAST_FAILURE_LIMIT) {
tDebug("http-report succ to ignore msg,reason:connection timed out, dst:%s", buf);
return true;
} else {
return false;
@ -453,7 +454,7 @@ static void httpHandleReq(SHttpMsg* msg) {
uv_tcp_init(http->loop, &cli->tcp);
// set up timeout to avoid stuck;
int32_t fd = taosCreateSocketWithTimeout(3000);
int32_t fd = taosCreateSocketWithTimeout(5000);
if (fd < 0) {
tError("http-report failed to open socket, dst:%s:%d", cli->addr, cli->port);
destroyHttpClient(cli);

View File

@ -24,7 +24,7 @@
void initLogEnv() {
const char * logDir = "/tmp/trans_cli";
const char * defaultLogFileNamePrefix = "taoslog";
const int32_t maxLogFileNum = 10000;
const int32_t maxLogFileNum = 1000000;
tsAsyncLog = 0;
// rpcDebugflag = 143;
strcpy(tsLogDir, (char *)logDir);
@ -53,7 +53,7 @@ void *proces(void *arg) {
}
int main(int argc, char *argv[]) {
initLogEnv();
int32_t numOfThreads = 3;
int32_t numOfThreads = 10;
TThread *thread = taosMemoryCalloc(1, sizeof(TThread) * numOfThreads);
for (int i = 0; i < numOfThreads; i++) {