[MDEV-9947] COM_MULTI united response Created: 2016-04-19  Updated: 2016-05-19  Resolved: 2016-05-17

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Fix Version/s: 10.2.1

Type: Task Priority: Major
Reporter: Oleksandr Byelkin Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-10084 SQL batch united response Closed
relates to MDEV-9058 protocol: COM_MULTI command Closed
Sprint: 10.2.1-1, 10.2.1-2

 Description   

Put all OK packets in one physical packet.



 Comments   
Comment by Oleksandr Byelkin [ 2016-05-09 ]

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

Comment by Oleksandr Byelkin [ 2016-05-11 ]

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;
}

Comment by Oleksandr Byelkin [ 2016-05-11 ]

there is problem in above test in case repeat1 = 100 (fixed in the connector by Georg)

Comment by Oleksandr Byelkin [ 2016-05-14 ]

revision-id: 8022548d2dd3ea4beef58a0613cc0f6a9d9e70be (mariadb-10.2.0-20-g8022548)
parent(s): c0a59b46be5be341bd6ffc9fe188a236ced46522
committer: Oleksandr Byelkin
timestamp: 2016-05-14 14:04:08 +0200
message:

MDEV-9947: COM_MULTI united response

Comment by Sergei Golubchik [ 2016-05-17 ]

ok to push

Generated at Thu Feb 08 07:38:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.