add http test
This commit is contained in:
parent
50922427ff
commit
b22bc3fe62
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
static int32_t httpRefMgt = 0;
|
static int32_t httpRefMgt = 0;
|
||||||
static int64_t httpRef = -1;
|
static int64_t httpRef = -1;
|
||||||
|
static int32_t FAST_FAILURE_LIMIT = 120;
|
||||||
typedef struct SHttpModule {
|
typedef struct SHttpModule {
|
||||||
uv_loop_t* loop;
|
uv_loop_t* loop;
|
||||||
SAsyncPool* asyncPool;
|
SAsyncPool* asyncPool;
|
||||||
|
@ -198,11 +199,12 @@ static void httpAsyncCb(uv_async_t* handle) {
|
||||||
queue wq;
|
queue wq;
|
||||||
QUEUE_INIT(&wq);
|
QUEUE_INIT(&wq);
|
||||||
|
|
||||||
static int32_t BACTHSIZE = 5;
|
static int32_t BATCH_SIZE = 5;
|
||||||
int32_t count = 0;
|
int32_t count = 0;
|
||||||
|
|
||||||
taosThreadMutexLock(&item->mtx);
|
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* h = QUEUE_HEAD(&item->qmsg);
|
||||||
QUEUE_REMOVE(h);
|
QUEUE_REMOVE(h);
|
||||||
QUEUE_PUSH(&wq, h);
|
QUEUE_PUSH(&wq, h);
|
||||||
|
@ -376,11 +378,10 @@ static bool httpFailFastShoudIgnoreMsg(SHashObj* pTable, char* server, int16_t p
|
||||||
if (failedTime == NULL) {
|
if (failedTime == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int32_t now = taosGetTimestampSec();
|
|
||||||
|
|
||||||
tError("failed timestamp %d, curr timestamp:%d", *failedTime, now);
|
int32_t now = taosGetTimestampSec();
|
||||||
if (*failedTime > now - 60) {
|
if (*failedTime > now - FAST_FAILURE_LIMIT) {
|
||||||
tError("http-report succ to ignore msg,reason:connection timed out, dst:%s", buf);
|
tDebug("http-report succ to ignore msg,reason:connection timed out, dst:%s", buf);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -453,7 +454,7 @@ static void httpHandleReq(SHttpMsg* msg) {
|
||||||
uv_tcp_init(http->loop, &cli->tcp);
|
uv_tcp_init(http->loop, &cli->tcp);
|
||||||
|
|
||||||
// set up timeout to avoid stuck;
|
// set up timeout to avoid stuck;
|
||||||
int32_t fd = taosCreateSocketWithTimeout(3000);
|
int32_t fd = taosCreateSocketWithTimeout(5000);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
tError("http-report failed to open socket, dst:%s:%d", cli->addr, cli->port);
|
tError("http-report failed to open socket, dst:%s:%d", cli->addr, cli->port);
|
||||||
destroyHttpClient(cli);
|
destroyHttpClient(cli);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
void initLogEnv() {
|
void initLogEnv() {
|
||||||
const char * logDir = "/tmp/trans_cli";
|
const char * logDir = "/tmp/trans_cli";
|
||||||
const char * defaultLogFileNamePrefix = "taoslog";
|
const char * defaultLogFileNamePrefix = "taoslog";
|
||||||
const int32_t maxLogFileNum = 10000;
|
const int32_t maxLogFileNum = 1000000;
|
||||||
tsAsyncLog = 0;
|
tsAsyncLog = 0;
|
||||||
// rpcDebugflag = 143;
|
// rpcDebugflag = 143;
|
||||||
strcpy(tsLogDir, (char *)logDir);
|
strcpy(tsLogDir, (char *)logDir);
|
||||||
|
@ -53,7 +53,7 @@ void *proces(void *arg) {
|
||||||
}
|
}
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
initLogEnv();
|
initLogEnv();
|
||||||
int32_t numOfThreads = 3;
|
int32_t numOfThreads = 10;
|
||||||
TThread *thread = taosMemoryCalloc(1, sizeof(TThread) * numOfThreads);
|
TThread *thread = taosMemoryCalloc(1, sizeof(TThread) * numOfThreads);
|
||||||
|
|
||||||
for (int i = 0; i < numOfThreads; i++) {
|
for (int i = 0; i < numOfThreads; i++) {
|
||||||
|
|
Loading…
Reference in New Issue