Uploaded image for project: 'Apache IoTDB'
  1. Apache IoTDB
  2. IOTDB-1730

client-cpp, enhance session::insertTablet() etc's performance

    XMLWordPrintableJSON

Details

    Description

      1) session::insertTablet() and session::insertTablets() are main API  used by customer.

      2)  custeomer's client oftern inserts 5000~50000 rows per 1 tablet, 

      3)  Call stack example: session::insertTablet()  => Session::sortTablet() => Session::sortIndexByTimestamp()

      so these functions' efficiency is sensitive.  But current sortIndexByTimestamp() use insert sort Algorithm, which causes 100~3000 times efficiency lossing.

       

      On the other hande,  Session::insertTablets() has another useless code that reduces performance.

      void Session::insertTablets(map<string, Tablet *> &tablets, bool sorted) {
      TSInsertTabletsReq request;
      request.__set_sessionId(sessionId);

      for (const auto &item: tablets) {
      if (sorted) {
      if (!checkSorted(*(item.second))) {
      throw BatchExecutionException("Times in Tablet are not in ascending order");
      }
      } else {
      sortTablet(*(item.second));    //here, it is wastful to let map search again.
      {color:#de350b}}

      Attachments

        Issue Links

          Activity

            People

              jamber001 Bo Zhang
              jamber001 Bo Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: