Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-804

improve performance : sending binary data

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      benchmarking different driver, this shows some part that might be improved :

                                                            |--------------|--------------|--------------|
                                                            | c            | c            | rust         |
                                                            | mysql        | mariadb      | mysql        |
      ------------------------------------------------------|--------------|--------------|--------------|
      do 1000 parameters             - BINARY EXECUTE ONLY  | 29954 | 100% | 26881 |  90% | 29946 | 100% |
      ------------------------------------------------------|--------------|--------------|--------------|
      

      code for c is :

       
      static void BM_DO_1000_PARAMS_BINARY(benchmark::State& state) {
        MYSQL *conn = connect("");
        MYSQL_STMT *stmt = mysql_stmt_init(conn);
        
        // Build query with 1000 placeholders: "DO ?,?,?..."
        std::string query = "DO ?";
        for (int i = 1; i < 1000; i++) {
          query += ",?";
        }
        
        int rc;
        rc = mysql_stmt_prepare(stmt, query.c_str(), (unsigned long)query.size());
        check_conn_rc(rc, conn);
       
        int int_data[1000];
        MYSQL_BIND my_bind[1000];
        memset(my_bind, 0, sizeof(my_bind));
       
        for (int i = 0; i < 1000; i++) {
          int_data[i] = i + 1;
          my_bind[i].buffer_type = MYSQL_TYPE_LONG;
          my_bind[i].buffer = (char *) &int_data[i];
          my_bind[i].is_null = 0;
        }
       
        int numOperation = 0;
        for (auto _ : state) {
          do_1000_params_binary(state, conn, stmt, my_bind);
          numOperation++;
        }
        state.counters[OPERATION_PER_SECOND_LABEL] = benchmark::Counter(numOperation, benchmark::Counter::kIsRate);
        mysql_stmt_close(stmt);
        mysql_close(conn);
      }
      

      Attachments

        Activity

          People

            georg Georg Richter
            diego dupin Diego Dupin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.