Using Lib Library to implement LoadRunner test MySQL performance

Source: Internet
Author: User

Since the project initial test plan did not involve the performance test of MySQL, but only for the front end and load performance testing, and then on the line after the emergence of a variety of MySQL deadlock and other issues. Just after the project 1, there are empty files, you can study the performance test about MySQL. This issue also only records the steps of MySQL connection and SQL transaction submission through the LoadRunner official library, and the real performance test has not yet started. (In fact, is not the beginning, novice to the database performance test is still very vacant AH ~ ~ ~)

1. LoadRunner's Mysqllib library

  : http://down.51cto.com/data/403722

Installation steps: Unzip the file and overwrite the bin and include files to the LoadRunner root directory;

library function files: ptt_mysql.h file;

Calling function: Lr_mysql_connect (); Lr_mysql_query (); Lr_mysql_disconnect ();

2. Code Implementation

  Vuser_init:

#define MySQLServer "*******"//mysql server Ip#define mysqlusername "* * * *"        //mysql user name # define MYSQLPASSWORD "* * * *"          //mysql Password # mysqldb "******"//mysql database name # define MYSQLPORT "* * *"//mysql port # include "ptt_mysql.h"// Import library file Vuser_init () {return 0;}    

Action:

{char chquery[128];int resultvalue; MYSQL *mconn;lr_load_dll ("Libmysql.dll"); Mconn = Lr_mysql_connect (Mysqlserver,mysqlusername,mysqlpassword,mysqldb,atoi (Mysqlport)); strcpy (ChQuery, "INSERT Into ' Netbarapppolicys '. ' Dbsyncinfo ' (syncversion) VALUES (' 112 '); "); Lr_start_transaction ("Insert"); resultvalue = Lr_mysql_query (Mconn, chquery);   Execute the SQL statement if (Resultvalue! = 0) {lr_end_transaction ("Insert", Lr_fail);} else {lr_end_transaction ("Insert", Lr_pass);} Lr_mysql_disconnect (mconn); return 0;}

3. Note

  Let your MySQL allow other PCs to connect as root. Command: grant all on * * to ' root ' @ ' IP ' identified by ' password ';

Using Lib Library to implement LoadRunner test MySQL performance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.