{"id":1358,"date":"2018-09-12T16:30:06","date_gmt":"2018-09-12T14:30:06","guid":{"rendered":"https:\/\/www.tests-performance.fr\/?p=1358"},"modified":"2018-09-12T17:01:53","modified_gmt":"2018-09-12T15:01:53","slug":"scripting-vugen-12-57-datapool-mysql-pour-vugen","status":"publish","type":"post","link":"https:\/\/www.tests-performance.fr\/?p=1358","title":{"rendered":"Scripting Vugen 12.57 \u2013 Datapool MySQL pour Vugen"},"content":{"rendered":"<p>L\u2019utilisation d\u2019un moteur de base de donn\u00e9es comme Mysql pour g\u00e9rer le jeu de donn\u00e9es Vugen n\u2019est pas qu\u2019un exercice de style. En effet, dans des cas o\u00f9 le nombre d\u2019informations \u00e0 utiliser est tr\u00e8s important (sup\u00e9rieur \u00e0 500\u00a0000), Vugen pr\u00e9sente quelques probl\u00e8mes lors de l\u2019ex\u00e9cution d\u2019un Tir de performance. La proc\u00e9dure d\u00e9crite ci-dessous d\u00e9taille un exemple op\u00e9rationnel complet tout \u00e0 fait adaptable et r\u00e9alis\u00e9 dans un environnement r\u00e9el.<\/p>\n<p>Concernant la version de la biblioth\u00e8que de lien dynamique utilis\u00e9e du Connecteur C (libmysql.dll v6.1.9.0 et non la derni\u00e8re version disponible), il faut savoir que les d\u00e9veloppeurs y ont impl\u00e9ment\u00e9 depuis la version 6.1.10 le package Microsoft Visual C++. Cons\u00e9quence, les d\u00e9pendances de biblioth\u00e8ques sont plus importantes alors que ces m\u00eames biblioth\u00e8ques n\u2019ont aucune utilit\u00e9 dans le cas pr\u00e9sent.<\/p>\n<p>La m\u00e9thode employ\u00e9e ici consiste \u00e0 adapter les librairies .h de la version Mysql 8.0 pour \u00eatre utilisable avec le langage C et avec Vugen.<\/p>\n<p>L\u2019API compl\u00e8te des fonctions de Mysql 8.0 est disponible \u00e0\u00a0:<\/p>\n<p><a href=\"http:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/c-api-functions.html\">http:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/c-api-functions.html<\/a><\/p>\n<h1>1 \u2013 T\u00e9l\u00e9chargement<\/h1>\n<p>mysql-installer-community-8.0.12.0.msi :<\/p>\n<p>https:\/\/dev.mysql.com\/downloads\/installer\/<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1359\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql1.png\" alt=\"\" width=\"1146\" height=\"448\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql1.png 1146w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql1-300x117.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql1-768x300.png 768w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql1-1024x400.png 1024w\" sizes=\"auto, (max-width: 1146px) 100vw, 1146px\" \/><\/p>\n<p>MySQL Connector\/C (mysql-connector-c-6.1.11-winx64.zip) :<\/p>\n<p><a href=\"https:\/\/downloads.mysql.com\/archives\/c-c\/\">https:\/\/downloads.mysql.com\/archives\/c-c\/<\/a><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1360\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql2.png\" alt=\"\" width=\"1280\" height=\"768\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql2.png 1280w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql2-300x180.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql2-768x461.png 768w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql2-1024x614.png 1024w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql2-1167x700.png 1167w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/p>\n<h1>2 \u2013 Installer MySQL<\/h1>\n<p>N\u2019Installer que Mysql server 8.0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1361\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql3.png\" alt=\"\" width=\"786\" height=\"583\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql3.png 786w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql3-300x223.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql3-768x570.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1362\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql4.png\" alt=\"\" width=\"788\" height=\"583\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql4.png 788w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql4-300x222.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql4-768x568.png 768w\" sizes=\"auto, (max-width: 788px) 100vw, 788px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1363\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql5.png\" alt=\"\" width=\"786\" height=\"583\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql5.png 786w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql5-300x223.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql5-768x570.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1364\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql6.png\" alt=\"\" width=\"790\" height=\"581\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql6.png 790w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql6-300x221.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql6-768x565.png 768w\" sizes=\"auto, (max-width: 790px) 100vw, 790px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1365\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql7.png\" alt=\"\" width=\"787\" height=\"586\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql7.png 787w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql7-300x223.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql7-768x572.png 768w\" sizes=\"auto, (max-width: 787px) 100vw, 787px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1366\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql8.png\" alt=\"\" width=\"787\" height=\"584\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql8.png 787w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql8-300x223.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql8-768x570.png 768w\" sizes=\"auto, (max-width: 787px) 100vw, 787px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1367\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql9.png\" alt=\"\" width=\"786\" height=\"584\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql9.png 786w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql9-300x223.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql9-768x571.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/p>\n<h1>3 \u2013 Configuration Mysql<\/h1>\n<pre><u>Connexion \u00e0 Mysql :<\/u>\r\n\r\n<strong>C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin&gt;mysql -u root -p<\/strong>\r\n\r\n<strong>Enter password: *********<\/strong>\r\n\r\nWelcome to the MySQL monitor.\u00a0 Commands end with ; or \\g.\r\n\r\nYour MySQL connection id is 30\r\n\r\nServer version: 8.0.12 MySQL Community Server - GPL\r\n\r\nCopyright (c) 2000, 2018, Oracle and\/or its affiliates. All rights reserved.\r\n\r\nOracle is a registered trademark of Oracle Corporation and\/or its\r\n\r\naffiliates. Other names may be trademarks of their respective\r\n\r\nowners.\r\n\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n<\/pre>\n<p><u>Afin d\u2019autoriser l\u2019insertion des donn\u00e9es en base par un fichier externe (Authentication plugin &#8216;caching_sha2_password&#8217;) :<\/u><\/p>\n<pre><strong><em>mysql&gt; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '********';<\/em><\/strong>\r\n\r\nQuery OK, 0 rows affected (0.02 sec)\r\n\r\n<strong>\u00a0<\/strong><strong><em>mysql&gt; SET GLOBAL local_infile=1;<\/em><\/strong>\r\n\r\nQuery OK, 0 rows affected (0.00 sec)\r\n\r\n<strong><em>mysql&gt; show variables like 'local_infile';<\/em><\/strong>\r\n\r\n+---------------+-------+\r\n\r\n| Variable_name | Value |\r\n\r\n+---------------+-------+\r\n\r\n| local_infile\u00a0 | ON\u00a0\u00a0\u00a0 |\r\n\r\n+---------------+-------+\r\n\r\n1 row in set, 1 warning (0.00 sec)\r\n<\/pre>\n<h1>4 &#8211; Ex\u00e9cuter les commandes de cr\u00e9ation de la base<\/h1>\n<pre><strong><em>mysql&gt; create database loadrunner;<\/em><\/strong>\r\n\r\nQuery OK, 1 row affected (0.11 sec)\r\n\r\n<strong><em>mysql&gt; use loadrunner;<\/em><\/strong>\r\n\r\nDatabase changed\r\n\r\nmysql&gt;\r\n\r\n<strong><em>mysql&gt; CREATE TABLE LRdata (<\/em><\/strong>\r\n\r\n<strong><em>ID_valeur MEDIUMINT NOT NULL AUTO_INCREMENT,<\/em><\/strong>\r\n\r\n<strong><em>valeur varchar(255) NOT NULL,<\/em><\/strong>\r\n\r\n<strong><em>CREATION_TIMESTAMP varchar(29) NOT NULL,<\/em><\/strong>\r\n\r\n<strong><em>PRIMARY KEY (ID_valeur)<\/em><\/strong>\r\n\r\n<strong><em>) ENGINE=InnoDB;<\/em><\/strong>\r\n\r\nQuery OK, 0 rows affected (0.13 sec)\r\n\r\n<\/pre>\n<p><u>Visualiser la base :<\/u><\/p>\n<pre><strong><em>mysql&gt; show databases;<\/em><\/strong>\r\n\r\n+--------------------+\r\n\r\n| Database\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\r\n\r\n+--------------------+\r\n\r\n| information_schema |\r\n\r\n| loadrunner\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\r\n\r\n| mysql\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\r\n\r\n| performance_schema |\r\n\r\n| sys\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\r\n\r\n+--------------------+\r\n\r\n5 rows in set (0.01 sec)\r\n<\/pre>\n<p><u>Si\u00a0 besoin\u00a0: Supprimer la table:<\/u><\/p>\n<pre><strong><em>Mysql&gt;drop table LRdata;<\/em><\/strong>\r\n<\/pre>\n<h1>5 &#8211; Ajouter des enregistrements<\/h1>\n<p>Pour cr\u00e9er des enregistrements dans un fichier csv, utiliser le script vugen ci-dessous\u00a0:<\/p>\n<p><a href=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/GenDatas.zip\">GenDatas.zip<\/a><\/p>\n<pre>Sortir de Mysql et se reconnecter\u00a0:\r\n\r\n<strong><em>C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin&gt;mysql -u root -p --local-infile loadrunner<\/em><\/strong>\r\n\r\n<strong><em>mysql&gt; LOAD DATA LOCAL INFILE 'C:\\\\JDD\\\\import1.csv' INTO TABLE LRdata FIELDS terminated by ';' LINES TERMINATED BY '\\n' (valeur,CREATION_TIMESTAMP);<\/em><\/strong>\r\n\r\n<em>Query OK, 1000000 rows affected, 65535 warnings (25.35 sec)<\/em>\r\n\r\n<em>Records: 1000000\u00a0 Deleted: 0\u00a0 Skipped: 0\u00a0 Warnings: 899531<\/em>\r\n<\/pre>\n<h1>6 \u2013 Pr\u00e9paration des fichiers pour scripting Vugen<\/h1>\n<p><u>Copier les fichiers de Mysql dans un nouveau r\u00e9pertoire C:\\Mysql8Lib<\/u><\/p>\n<p>C:\\Program Files\\MySQL\\MySQL Server 8.0\\include\u00a0:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1369\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql10.png\" alt=\"\" width=\"995\" height=\"468\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql10.png 995w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql10-300x141.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql10-768x361.png 768w\" sizes=\"auto, (max-width: 995px) 100vw, 995px\" \/><\/p>\n<p>C:\\Mysql8Lib\u00a0:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1370\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql11.png\" alt=\"\" width=\"614\" height=\"484\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql11.png 614w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql11-300x236.png 300w\" sizes=\"auto, (max-width: 614px) 100vw, 614px\" \/><\/p>\n<p>Comme le type bool\u00e9en n\u2019existe pas en C, il faut changer toutes les d\u00e9clarations de variables bool en un nouveau type entier \u201cmy_bool\u201d (d\u00e9claration dans global.h du script Vugen, ci-dessous).<\/p>\n<p>Exemple :<\/p>\n<p>typedef struct UDF_INIT {<\/p>\n<p><strong>my_bool<\/strong> maybe_null;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\/** 1 if function can return NULL *\/<\/p>\n<p>&nbsp;<\/p>\n<p>Ce changement est \u00e0 faire pour les fichiers<\/p>\n<p style=\"padding-left: 30px;\">udf_registration_types.h<\/p>\n<p style=\"padding-left: 30px;\">mysql.h<\/p>\n<p style=\"padding-left: 30px;\">mysql_com.h<\/p>\n<p style=\"padding-left: 30px;\">mysql_time.h<\/p>\n<p>&nbsp;<\/p>\n<p>Remplacer dans les fichiers :<\/p>\n<p style=\"padding-left: 30px;\">mysql.h<\/p>\n<p style=\"padding-left: 30px;\">mysql_com.h<\/p>\n<p style=\"padding-left: 30px;\">udf_registration_types.h<\/p>\n<p>&nbsp;<\/p>\n<p style=\"padding-left: 30px;\">#include &lt;stdbool.h&gt;<\/p>\n<p>Par<\/p>\n<p style=\"padding-left: 30px;\">\/\/#include &lt;stdbool.h&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>Remplacer dans le fichier mysql.h<\/p>\n<p style=\"padding-left: 30px;\">#include &lt;sys\/types.h&gt;<\/p>\n<p style=\"padding-left: 30px;\">#include &#8220;mysql\/client_plugin.h&#8221;<\/p>\n<p style=\"padding-left: 30px;\">#include &#8220;errmsg.h&#8221;<\/p>\n<p>Par<\/p>\n<p style=\"padding-left: 30px;\">\/\/#include &lt;sys\/types.h&gt;<\/p>\n<p style=\"padding-left: 30px;\">#include &#8220;client_plugin.h&#8221;<\/p>\n<p style=\"padding-left: 30px;\">\/\/#include &#8220;errmsg.h&#8221;<\/p>\n<p>&nbsp;<\/p>\n<p>Remplacer dans le fichier mysql_com.h<\/p>\n<p style=\"padding-left: 30px;\">#include &lt;mysql\/udf_registration_types.h&gt;<\/p>\n<p>Par<\/p>\n<p style=\"padding-left: 30px;\">#include &lt;udf_registration_types.h&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>Remplacer toutes les r\u00e9f\u00e9rences aux autres fichiers .h en suffixant par le repertoire C:\\\\Mysql8Lib\\\\ dans les fichiers :<\/p>\n<p style=\"padding-left: 30px;\">client_plugin.h<\/p>\n<p style=\"padding-left: 30px;\">mysqlx_ername.h<\/p>\n<p style=\"padding-left: 30px;\">plugin_auth_common.h<\/p>\n<p style=\"padding-left: 30px;\">udf_registration_types.h<\/p>\n<p style=\"padding-left: 30px;\">mysql.h<\/p>\n<p>&nbsp;<\/p>\n<p>Exemple :<\/p>\n<p style=\"padding-left: 30px;\">#include &#8220;plugin_auth_common.h&#8221;<\/p>\n<p>Par<\/p>\n<p style=\"padding-left: 30px;\">#include &#8221; C:\\\\Mysql8Lib\\\\plugin_auth_common.h&#8221;<\/p>\n<p>&nbsp;<\/p>\n<p>Librairies modifi\u00e9es comme expliqu\u00e9 ci-dessus:<\/p>\n<p><a href=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql8Lib.zip\">Mysql8Lib.zip<\/a><\/p>\n<p>&nbsp;<\/p>\n<h1>7 &#8211; Script Mysql<\/h1>\n<p>R\u00e9cup\u00e9rer libmysql.dll de mysql-connector-c-6.1.9-win32\\lib<\/p>\n<p>Renommer libmysql.dll en libmysql-6.1.9.0.dll et l\u2019inclure dans les extra files d\u2019un nouveau script vugen Web http\/html<\/p>\n<p>&nbsp;<\/p>\n<pre><strong><u>Script MysqlV3:<\/u><\/strong>\r\n\r\n<strong>vuser_init<\/strong>()\r\n{\r\n\r\n\/\/ La documentation MySQL 8.0 C API est disponible \u00e0:\r\n\/\/ http:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/c-api-functions.html\r\n\r\nlr_load_dll(\"libmysql-6.1.9.0.dll\");\r\n\r\nlr_start_transaction(\"001_Init_Cnx\");\r\n\r\n\/\/initialise la connexion mySQL\r\nmySQL\u00a0=\u00a0<strong>mysql_init<\/strong>(NULL);\r\nif\u00a0(mySQL\u00a0==\u00a0NULL)\u00a0{\r\nlr_error_message(\"M\u00e9moire Insuffisante\");\r\nlr_abort();\r\n}\r\n\r\n\/\/ Connect to the database\r\nif\u00a0(!<strong>mysql_real_connect<\/strong>(mySQL,MySQLServer,\u00a0MySQLuser,\u00a0MySQLpassword,\u00a0MySQLdatabase,\u00a0MySQLport,NULL,0))\u00a0{\r\nlr_error_message(\"%s\",\u00a0<strong>mysql_error<\/strong>(mySQL));\r\n<strong>mysql_close<\/strong>(mySQL);\r\nlr_abort();\r\n}\r\n\r\n\/\/save SQL statement into variable into sqlQuery\r\n\/\/This stamentement returns result that matches UserName = {Vuser} parameter\r\nlr_param_sprintf(\"sqlQuery\",\u00a0\"SELECT %s FROM LRData\",\u00a0MySQLChamps);\r\n\r\n\/\/Execute SQL statement\r\nMyRC\u00a0=\u00a0<strong>mysql_query<\/strong>(mySQL,\u00a0lr_eval_string\u00a0(\"{sqlQuery}\"));\r\nif\u00a0(MyRC\u00a0!=\u00a00)\u00a0{\r\nlr_error_message(\"%s\",\u00a0<strong>mysql_error<\/strong>(mySQL));\r\n<strong>mysql_close<\/strong>(mySQL);\r\nlr_abort();\r\n}\r\n\r\n\/\/result of the sql statement is placed into MYSQL_RES result structure\r\nresult\u00a0=\u00a0<strong>mysql_use_result<\/strong>(mySQL);\r\nif\u00a0(result\u00a0==\u00a0NULL)\u00a0{\r\nlr_error_message(\"%s\",\u00a0<strong>mysql_error<\/strong>(mySQL));\r\n<strong>mysql_free_result<\/strong>(result);\r\n<strong>mysql_close<\/strong>(mySQL);\r\nlr_abort();\r\n}\r\n\r\nlr_end_transaction(\"001_Init_Cnx\",\u00a0<strong>LR_AUTO<\/strong>);\r\nreturn\u00a00;\r\n}\r\n\r\n\u00a0\r\n\r\n<strong>Action<\/strong>()\r\n{\r\n\r\ndouble\u00a0dRes;\r\nlr_start_transaction(\"002_make_Data\");\r\n\r\nrow=<strong>mysql_fetch_row<\/strong>(result);\r\n\r\n\/\/ Si plus de donn\u00e9es, on reviens au 1er enregistrement\r\nif(row==NULL)\r\n{\r\n<strong>mysql_data_seek<\/strong>(result,0);\r\nrow=<strong>mysql_fetch_row<\/strong>(result);\r\n}\r\n\r\nlr_output_message(\"res\u00a0=<strong>\u00a0%.3f<\/strong>\",\u00a0<strong>atof<\/strong>(row[0]));\r\ndRes=<strong>atof<\/strong>(row[0]);\r\nlr_user_data_point(\"valeur\",\u00a0dRes);\r\n\r\nlr_end_transaction(\"002_make_Data\",\u00a0<strong>LR_AUTO<\/strong>);\r\nlr_think_time(1);\r\n\r\nreturn\u00a00;\r\n}\r\n\r\n\u00a0\r\n\r\n<strong>vuser_end<\/strong>()\r\n{\r\nlr_start_transaction(\"003_decnx\");\r\n\r\n<strong>mysql_free_result<\/strong>(result);\r\n<strong>mysql_close<\/strong>(mySQL);\r\n\r\nlr_end_transaction(\"003_decnx\",\u00a0<strong>LR_AUTO<\/strong>);\r\nreturn\u00a00;\r\n}\r\n\r\n\u00a0\r\n\r\n<strong>Global.h :<\/strong>\r\n\r\n#ifndef\u00a0_GLOBALS_H\r\n#define\u00a0_GLOBALS_H\r\n\r\ntypedef\u00a0int\u00a0my_bool;\r\n\r\n\/\/--------------------------------------------------------------------\r\n\/\/ Include Files\r\n#include\u00a0\"lrun.h\"\r\n#include\u00a0\"web_api.h\"\r\n#include\u00a0\"lrw_custom_body.h\"\r\n\r\n#include\u00a0\"C:\\\\Mysql8Lib\\\\binary_log_types.h\"\r\n#include\u00a0\"C:\\\\Mysql8Lib\\\\client_plugin.h\"\r\n#include\u00a0\"C:\\\\Mysql8Lib\\\\my_command.h\"\r\n#include\u00a0\"C:\\\\Mysql8Lib\\\\my_list.h\"\r\n#include\u00a0\"C:\\\\Mysql8Lib\\\\mysql.h\"\r\n#include\u00a0\"C:\\\\Mysql8Lib\\\\mysql_com.h\"\r\n#include\u00a0\"C:\\\\Mysql8Lib\\\\mysql_time.h\"\r\n#include\u00a0\"C:\\\\Mysql8Lib\\\\mysql_version.h\"\r\n#include\u00a0\"C:\\\\Mysql8Lib\\\\mysqld_error.h\"\r\n#include\u00a0\"C:\\\\Mysql8Lib\\\\mysqlx_error.h\"\r\n#include\u00a0\"C:\\\\Mysql8Lib\\\\mysqlx_version.h\"\r\n#include\u00a0\"C:\\\\Mysql8Lib\\\\plugin_auth_common.h\"\r\n#include\u00a0\"C:\\\\Mysql8Lib\\\\udf_registration_types.h\"\r\n\r\n\/\/--------------------------------------------------------------------\r\n\/\/ Global Variables\r\n\r\nMYSQL\u00a0*mySQL;\r\nMYSQL_ROW row;\r\nMYSQL_RES\u00a0*result;\r\nint\u00a0i=0,\u00a0MyRC,\u00a0num_fields;\r\n\r\nchar\u00a0*MySQLServer\u00a0=\u00a0\"localhost\";\r\nchar\u00a0*MySQLuser\u00a0=\u00a0\"root\";\r\nchar\u00a0*MySQLpassword\u00a0=\u00a0\"********\";\r\nchar\u00a0*MySQLdatabase\u00a0=\u00a0\"loadrunner\";\r\nchar\u00a0*MySQLChamps\u00a0=\u00a0\"valeur\";\r\nint\u00a0MySQLport\u00a0=\u00a03306;\r\n\r\n#endif\u00a0\/\/ _GLOBALS_H\r\n<\/pre>\n<p>Script complet\u00a0:<\/p>\n<p><a href=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/MysqlV3.zip\">MysqlV3.zip<\/a><\/p>\n<h1>8 \u2013 R\u00e9sultat Log Vugen<\/h1>\n<p>Premi\u00e8re ex\u00e9cution du script:<\/p>\n<p>Si erreur suivante (car serveur Mysql distant):<\/p>\n<p>vuser_init.c(20): Error: Host &#8216;150.62.9.226&#8217; is not allowed to connect to this MySQL server<\/p>\n<p>&nbsp;<\/p>\n<p>Dans ce cas, lancer les 4 commandes ci-dessous :<\/p>\n<pre><strong>mysql&gt; use Loadrunner;<\/strong>\r\n\r\nDatabase changed\r\n\r\n<strong>mysql&gt; CREATE USER 'root'@'150.62.9.226' IDENTIFIED BY 'root';<\/strong>\r\n\r\nQuery OK, 0 rows affected (0.12 sec)\r\n\r\n<strong>mysql&gt; GRANT ALL PRIVILEGES ON *.* TO 'root'@'150.62.9.226' WITH GRANT OPTION;<\/strong>\r\n\r\nQuery OK, 0 rows affected (0.07 sec)\r\n\r\n<strong><em>mysql&gt; ALTER USER 'root'@'150.62.9.226' IDENTIFIED WITH mysql_native_password BY '********';<\/em><\/strong>\r\n\r\nQuery OK, 0 rows affected (0.02 sec)\r\n<\/pre>\n<p><strong>Log Vugen:<\/strong><\/p>\n<pre>Virtual User Script started at: 31\/08\/2018 15:29:06\r\n\r\nStarting action vuser_init.\r\n\r\nWeb Turbo Replay of LoadRunner 12.57.0 for Windows 7; build 281 (mai 06 2018 20:03:54)\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0 [MsgId: MMSG-26983]\r\n\r\nRun mode: HTML\u00a0 [MsgId: MMSG-26993]\r\n\r\nReplay user agent: Mozilla\/4.0 (compatible; MSIE 6.0; Windows NT)\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [MsgId: MMSG-26988]\r\n\r\nRuntime Settings file: \"D:\\DATA\\ESPDEV\\ScriptsVugen\\Datapool Mysql\\MysqlV3\\\\default.cfg\"\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [MsgId: MMSG-27141]\r\n\r\nvuser_init.c(9): Notify: Transaction \"001_Init_Cnx\" started.\r\n\r\nvuser_init.c(46): Notify: Transaction \"001_Init_Cnx\" ended with a \"Pass\" status (Duration: 4,1010).\r\n\r\nEnding action vuser_init.\r\n\r\nRunning Vuser...\r\n\r\nStarting iteration 1.\r\n\r\nStarting action Action.\r\n\r\nAction.c(5): Notify: Transaction \"002_make_Data\" started.\r\n\r\n<strong>Action.c(16): res = 0,700<\/strong>\r\n\r\nAction.c(18): Notify: Data Point \"valeur\" value = 0,7000.\r\n\r\nAction.c(20): Notify: Transaction \"002_make_Data\" ended with a \"Pass\" status (Duration: 0,1318).\r\n\r\nEnding action Action.\r\n\r\nEnding iteration 1.\r\n\r\nEnding Vuser...\r\n\r\nStarting action vuser_end.\r\n\r\nvuser_end.c(3): Notify: Transaction \"003_decnx\" started.\r\n\r\nvuser_end.c(8): Notify: Transaction \"003_decnx\" ended with a \"Pass\" status (Duration: 0,1171).\r\n\r\nEnding action vuser_end.\r\n\r\nVuser Terminated.\r\n<\/pre>\n<h1>9 &#8211; R\u00e9sultat Tir<\/h1>\n<p>Le million de lignes de la table LRdata a \u00e9t\u00e9 lu lors de ce tir.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1373\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql12.png\" alt=\"\" width=\"651\" height=\"404\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql12.png 651w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql12-300x186.png 300w\" sizes=\"auto, (max-width: 651px) 100vw, 651px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1374\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql13.png\" alt=\"\" width=\"1226\" height=\"279\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql13.png 1226w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql13-300x68.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql13-768x175.png 768w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql13-1024x233.png 1024w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql13-1170x266.png 1170w\" sizes=\"auto, (max-width: 1226px) 100vw, 1226px\" \/><\/p>\n<p>200 Vu en charge<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1375\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql14.png\" alt=\"\" width=\"1226\" height=\"279\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql14.png 1226w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql14-300x68.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql14-768x175.png 768w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql14-1024x233.png 1024w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql14-1170x266.png 1170w\" sizes=\"auto, (max-width: 1226px) 100vw, 1226px\" \/><\/p>\n<p>Valeurs des donn\u00e9es issues de Mysql<\/p>\n<p><u><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1376\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql15.png\" alt=\"\" width=\"1226\" height=\"311\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql15.png 1226w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql15-300x76.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql15-768x195.png 768w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql15-1024x260.png 1024w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql15-1170x297.png 1170w\" sizes=\"auto, (max-width: 1226px) 100vw, 1226px\" \/><\/u><\/p>\n<p>Consommation syst\u00e8me du serveur Mysql<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1377\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql16.png\" alt=\"\" width=\"1226\" height=\"311\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql16.png 1226w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql16-300x76.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql16-768x195.png 768w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql16-1024x260.png 1024w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql16-1170x297.png 1170w\" sizes=\"auto, (max-width: 1226px) 100vw, 1226px\" \/><\/p>\n<p>Temps de lecture tr\u00e8s faible via Mysql<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1378\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql17.png\" alt=\"\" width=\"1226\" height=\"311\" srcset=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql17.png 1226w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql17-300x76.png 300w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql17-768x195.png 768w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql17-1024x260.png 1024w, https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/09\/Mysql17-1170x297.png 1170w\" sizes=\"auto, (max-width: 1226px) 100vw, 1226px\" \/><\/p>\n<p>400 lectures\/s sans erreur<\/p>\n","protected":false},"excerpt":{"rendered":"<p>L\u2019utilisation d\u2019un moteur de base de donn\u00e9es comme Mysql pour g\u00e9rer le jeu de donn\u00e9es Vugen n\u2019est pas qu\u2019un exercice de style. En effet, dans des cas o\u00f9 le nombre d\u2019informations \u00e0 utiliser est tr\u00e8s important (sup\u00e9rieur \u00e0 500\u00a0000), Vugen pr\u00e9sente quelques probl\u00e8mes lors de l\u2019ex\u00e9cution d\u2019un Tir de performance. La proc\u00e9dure d\u00e9crite ci-dessous d\u00e9taille [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[21],"tags":[27],"class_list":["post-1358","post","type-post","status-publish","format-standard","hentry","category-vugen","tag-tests-de-performance"],"acf":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=\/wp\/v2\/posts\/1358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1358"}],"version-history":[{"count":8,"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=\/wp\/v2\/posts\/1358\/revisions"}],"predecessor-version":[{"id":1388,"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=\/wp\/v2\/posts\/1358\/revisions\/1388"}],"wp:attachment":[{"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}