????loadrunner??mysql???????
???????????? ???????[ 2015/5/22 14:11:45 ] ??????????????????
????????????????loadrunner??????????????????????y?????в??????????linux???????????????????????????
????????loadrunnerд???????????????????????????????????????????????????????????????
????????????????
???????????У?????????????????10?????????????????80%??????????????20???μ??????????????
?????????趨?????????11???????1????????8??????30%???????????????70%??????
???????????????????????973505????????????????????????
??????????Щ????????mysql??c api??д??????:
????????????my_mysql_insert()?????????????????????????????????????????????????loadrunner??????????????????????bug??
??????????????????????????????????????????????????5G??С???????????????????????????????????dz??????裬??php+mysql?????????????????????????????http?????μ?loadrunner????
????globals.h
????#ifndef_GLOBALS_H
????#define_GLOBALS_H
????#include"lrun.h"
????#include"web_api.h"
????#include"lrw_custom_body.h"
????#include"modal_dialog_callbacks.h"
????#define random(x)(rand()%x)
????#include
????#include
????#include
????#include
????#include
????#include
????#include
????#endif//_GLOBALS_H
????vuser_init.c
????MYSQL*db;
????MYSQL_ROW record;
????vuser_init()
????{
????char sql[128];
????MYSQL_RES*results1;
????lr_load_dll("libmysql.dll");
????db=mysql_init(NULL);
????mysql_real_connect(db??"192.168.8.32"??"root"??"123456"??"sunboyu_test"??3311??"/tmp/mysql3311.sock"??1);
????sprintf(sql??"show tables");
????mysql_query(db??sql);
????results1=mysql_store_result(db);
????while((record=mysql_fetch_row(results1)))
????{
????lr_log_message("table=%s"??record[0]);
????}
????mysql_free_result(results1);
????return 0;
????}
????vuser_end.c
????vuser_end()
????{
????mysql_close(db);
????mysql_server_end();
????return 0;
????}
????Action.c
????Action()
????{
????int r1=0;
????char sql[128];
????r1=random(11);//10???????8????????????????????
????lr_log_message("%d"??r1);
????if(r1==11)
????{
????my_mysql_insert();
????}
????else
????{
????my_mysql_query(r1);
????}
????return 0;
????}
????int my_mysql_query(int randid)
????{
????int r2=0;
????int j=0;
????int count=0;
????int page=0;
????char sql[128];
????MYSQL_RES*results2;
????if(randid<2)//???????С????20%
????{
????r2=random(700000);
????sprintf(sql??"SELECT COUNT(*)AS count FROM posts_jx3 WHERE tid=%d;"??r2);
????lr_log_message("%s"??sql);
????mysql_query(db??sql);
????results2=mysql_store_result(db);
????while((record=mysql_fetch_row(results2)))
????{
????lr_log_message("count=%d"??record[0]);
????}
????mysql_free_result(results2);
????page=count/10;
????lr_log_message("page=%d"??page);
????for(j=0;j<=page;j++)
????{
????sprintf(sql??"SELECT*FROM posts_jx3 WHERE tid=%d LIMIT%d??10;"??r2??j);
????mysql_query(db??sql);
????lr_log_message("%s"??sql);
????if(j>0){
????results2=mysql_store_result(db);
????while((record=mysql_fetch_row(results2)))
????{
????lr_log_message("pid=%d"??record[0]);
????}
????mysql_free_result(results2);
????}
????}
????}
????else//???????????80%
????{
????r2=random(273505);
????r2=r2+700000;
????sprintf(sql??"SELECT COUNT(*)AS count FROM posts_jx3 WHERE tid=%d;"??r2);
????lr_log_message("%s"??sql);
????mysql_query(db??sql);
????results2=mysql_store_result(db);
????while((record=mysql_fetch_row(results2)))
????{
????lr_log_message("count=%d"??record[0]);
????}
????mysql_free_result(results2);
????page=count/10;
????lr_log_message("page=%d"??page);
????for(j=0;j<=page;j++)
????{
????sprintf(sql??"SELECT*FROM posts_jx3 WHERE tid=%d LIMIT%d??10;"??r2??j);
????lr_log_message("%s"??sql);
????mysql_query(db??sql);
????if(j>0){
????results2=mysql_store_result(db);
????while((record=mysql_fetch_row(results2)))
????{
????lr_log_message("pid=%d"??record[0]);
????}
????mysql_free_result(results2);
????}
????}
????}
????mysql_free_result(results2);
????return 0;
????}
????int my_mysql_insert()
????{
????int t;
????char sql[500];
????MYSQL_RES*results3;
????sprintf(sql??"%s"??"INSERT INTO posts_jx3(fid??tid??first??author??authorid??subject??dateline??message??useip??invisible??anonymous??usesig??htmlon??bbcodeoff??smileyoff??parseurloff??attachment??rate??ratetimes??status)VALUES(12345??215053??0??'fdsafsdfsd'??2265065??''??1240535917??'fdsfsdfdsfd'??'118.239.49.229'??0??0??0??0??-1??-1??0??0??0??0??0);");
????lr_log_message("%s"??sql);
????t=mysql_query(db??sql);
????if(t)
????{
????lr_log_message("%s"??mysql_error(db));
????}
????else
????{
????lr_log_message("%s"??"suc");
????}
????}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11