打磨性能测试用例。

This commit is contained in:
zhengchao
2020-06-19 20:49:54 +08:00
parent 73d27d983c
commit 58ff7ddc16
4 changed files with 18 additions and 9 deletions

View File

@@ -723,6 +723,8 @@ FULL_UPDATE:
}
*list=s_rule_array;
*update_type=CM_UPDATE_TYPE_FULL;
MESA_handle_runtime_log(logger, RLOG_LV_INFO, maat_redis_monitor,
"Full update %d keys of version %lldd.", rule_num, new_version);
return rule_num ;
}

View File

@@ -34,7 +34,7 @@
#include "stream_fuzzy_hash.h"
#include "gram_index_engine.h"
int MAAT_FRAME_VERSION_2_9_20200622=1;
int MAAT_FRAME_VERSION_3_0_20200619=1;
int is_valid_table_name(const char* str)
{

View File

@@ -3,7 +3,7 @@
#include "Maat_garbage_collection.h"
#include "alignment_int64.h"
#include <time.h>
#include <MESA/field_stat.h>
#include <MESA/field_stat2.h>
enum MAAT_FS_STATUS{
STATUS_VERSION=0,
STATUS_THRED_NUM,

View File

@@ -55,6 +55,7 @@ int test_add_ip_command(struct Maat_command_batch* batch, const char* region_tab
struct Maat_cmd_region region;
memset(&region, 0, sizeof(region));
region.region_id=config_id;
region.region_type=REGION_IP;
region.table_name=region_table;
region.ip_rule.addr_type=ADDR_TYPE_IPv4;
@@ -144,7 +145,7 @@ protected:
const char* foregin_dir="./foreign_files/";
Maat_set_feather_opt(_shared_feather, MAAT_OPT_FOREIGN_CONT_DIR, foregin_dir, strlen(foregin_dir)+1);
Maat_cmd_flushDB(_shared_feather);
// Maat_cmd_flushDB(_shared_feather);
Maat_initiate_feather(_shared_feather);
}
static void TearDownTestCase()
@@ -164,11 +165,12 @@ void* MaatCMDPerfTest::logger;
//Following tests must be coded/tested at last, for they stalled the maat update thread and interrupt other tests.
TEST_F(MaatCMDPerfTest, SetExpr200K)
{
const int CMD_EXPR_NUM=1*1000*1000;
const int CMD_IP_NUM=1*1000*1000;
const int CMD_EXPR_NUM=2*1000*1000;
const int CMD_IP_NUM=2*1000*1000;
const char* expr_table_name="HTTP_URL";
const char* ip_table_name="IP_CONFIG";
int srand_keyword=171, srand_ip=73;
char keyword_buf[128];
char src_ip_buff[32], dst_ip_buff[32];
@@ -178,23 +180,27 @@ TEST_F(MaatCMDPerfTest, SetExpr200K)
ret=Maat_read_state(feather, MAAT_STATE_VERSION, &version_before, sizeof(version_before));
config_id=(int)Maat_cmd_incrby(feather, "TEST_SEQ", CMD_EXPR_NUM+CMD_IP_NUM);
config_id-=CMD_EXPR_NUM+CMD_IP_NUM;
int i=0;
/*
struct Maat_command_batch* batch=NULL;
batch=Maat_command_batch_new(feather);
srand(srand_keyword);
for(i=0; i<CMD_EXPR_NUM;i++)
{
random_keyword_generate(keyword_buf, sizeof(keyword_buf));
test_add_expr_command_copy(batch, expr_table_name, config_id-i, keyword_buf);
test_add_expr_command_copy(batch, expr_table_name, config_id+i, keyword_buf);
}
srand(srand_ip);
for(i=0; i<CMD_IP_NUM; i++)
{
random_ipv4_addr_generate(src_ip_buff, sizeof(src_ip_buff));
random_ipv4_addr_generate(dst_ip_buff, sizeof(dst_ip_buff));
test_add_ip_command(batch, ip_table_name, src_ip_buff, dst_ip_buff, config_id-CMD_EXPR_NUM-i);
test_add_ip_command(batch, ip_table_name, src_ip_buff, dst_ip_buff, config_id+CMD_EXPR_NUM+i);
}
Maat_command_batch_commit(batch);
wait_for_cmd_effective_copy(feather, version_before);
*/
struct Maat_rule_t result;
scan_status_t mid=NULL;
@@ -202,6 +208,7 @@ TEST_F(MaatCMDPerfTest, SetExpr200K)
table_id=Maat_table_register(feather, expr_table_name);
ASSERT_GT(table_id, 0);
memset(&result, 0, sizeof(result));
ret=Maat_full_scan_string(feather, table_id, CHARSET_GBK, keyword_buf, strlen(keyword_buf),
&result, NULL, 1,
&mid, 0);