You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@iotdb.apache.org by "Bo Zhang (Jira)" <ji...@apache.org> on 2021/09/24 06:33:00 UTC
[jira] [Created] (IOTDB-1730) client-cpp, enhance
session::insertTablet() etc's performance
Bo Zhang created IOTDB-1730:
-------------------------------
Summary: client-cpp, enhance session::insertTablet() etc's performance
Key: IOTDB-1730
URL: https://issues.apache.org/jira/browse/IOTDB-1730
Project: Apache IoTDB
Issue Type: Improvement
Components: Client/Others
Reporter: Bo Zhang
Fix For: 0.13.0
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.
{color:#de350b}void Session::insertTablets(map<string, Tablet *> &tablets, bool sorted) {{color}
{color:#de350b} TSInsertTabletsReq request;{color}
{color:#de350b} request.__set_sessionId(sessionId);{color}
{color:#de350b}for (const auto &item: tablets) {{color}
{color:#de350b} if (sorted) {{color}
{color:#de350b} if (!checkSorted(*(item.second))) {{color}
{color:#de350b} throw BatchExecutionException("Times in Tablet are not in ascending order");{color}
{color:#de350b} }{color}
{color:#de350b} } else {{color}
{color:#de350b}sortTablet(*(item.second)); {color} {color:#4c9aff}//here, it is wastful to let map search again.{color}
{color:#de350b}}{color}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)