So I made such test:
send in one COM_MULTI 50 following group of 3 statement:
insert into t1 values (1)
|
insert into t1 values (2)
|
delete from t1
|
then read response
and do it 10000 times
I run 5 times test with my patch then 5 times without and then 3 times with and without (just to be sure that result is stable):
With the patch (s):
26.956
|
26.743
|
26.659
|
26.708
|
26.597
|
|
26.671
|
26.213
|
26.501
|
------
|
26.631
|
without the patch (s):
38.014
|
39.698
|
38.269
|
39.738
|
39.620
|
|
39.558
|
39.310
|
39.779
|
------
|
39.24825
|
so it is 32% gain on 127.0.0.1 tcp connection.
Server and test was compiled without debug info (for server all 4 times, client was compiled only once).
Server started via ./mysql-test-run --start
client:
time ./unittest/libmariadb/features-10_2 -u root -d test -h 127.0.0.1 -P 16000
the test function is:
#define repeat1 50
|
#define repeat2 10000
|
|
|
static int com_multi_2(MYSQL *mysql)
|
{
|
int rc;
|
enum mariadb_com_multi status;
|
|
|
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
|
check_mysql_rc(rc, mysql);
|
rc= mysql_query(mysql, "create table t1 (a int)");
|
check_mysql_rc(rc, mysql);
|
|
/* TEST COM_MULTI */
|
|
for (uint i= 0; i < repeat2; i++)
|
{
|
status= MARIADB_COM_MULTI_BEGIN;
|
if (mysql_options(mysql, MARIADB_OPT_COM_MULTI, &status))
|
{
|
diag("COM_MULT not supported");
|
have_com_multi= 0;
|
return SKIP;
|
}
|
|
for (uint j= 0; j < repeat1; j++)
|
{
|
rc= mysql_query(mysql, "insert into t1 values (1)");
|
rc= mysql_query(mysql, "insert into t1 values (2)");
|
rc= mysql_query(mysql, "delete from t1;");
|
}
|
|
status= MARIADB_COM_MULTI_END;
|
rc= mysql_options(mysql, MARIADB_OPT_COM_MULTI, &status);
|
|
for (uint j= 0; j < repeat1; j++)
|
{
|
/* 1 INSERT */
|
check_mysql_rc(rc, mysql);
|
/* 2 INSERT */
|
rc= mysql_next_result(mysql);
|
check_mysql_rc(rc, mysql);
|
/* 3 DELETE */
|
rc= mysql_next_result(mysql);
|
check_mysql_rc(rc, mysql);
|
|
rc= mysql_next_result(mysql);
|
//printf("%u\n", (i+1)*repeat1 + j+1);
|
}
|
//putchar('.');
|
|
rc= mysql_next_result(mysql);
|
FAIL_UNLESS(rc == -1, "more then 3*repeat1 results");
|
}
|
|
/* TEST a simple query after COM_MULTI */
|
|
rc= mysql_query(mysql, "drop table t1");
|
|
/* question: how will result sets look like ? */
|
diag("error: %s", mysql_error(mysql));
|
|
return OK;
|
}
|
revision-id: 7e70658d1e88b4a255e3c28426f8259e5e596a85 (mariadb-10.2.0-20-g7e70658)
parent(s): c0a59b46be5be341bd6ffc9fe188a236ced46522
committer: Oleksandr Byelkin
timestamp: 2016-05-09 15:26:18 +0200
message:
MDEV-9947: COM_MULTI united response—