Hi,

It sounds strange and unusual, but in some case it is useful... Considering
the following POC codes:

```
long begin = System.currentTime();
while () {
  String json = getDataFromPLC();
  double[] data = parseJson();
  iotdbClient.insert(data);
}
long timeCost = System.currentTime() - begin;
```
After a user runs the codes, he may complains: "Why IoTDB has such a poor
performance??? Don't you say that IoTDB have an outstanding performance???
r u kidding me?"

Is that really IoTDB's performance problem?  Maybe or not.
If the user asks us for help, we can simply modify the codes like:

```
long total = 0;
while() {
  String json = getDataFromPLC();
  double[] data = parseJson();
  long begin = System.currentTime();
  iotdbClient.insert(data);
  total += System.currentTime() - begin;
}
```

In this way, we just count the time cost of IoTDB, and omit the time cost
that locally data process.

First, it needs change source codes a lot. Normal users may do not want to
modify their codes so many.

Second, if you show the result to users, "The original time cost is 400s,
but IoTDB just uses 10s", they may be not satisfied, because it looks like
passing the buck. If you want to tell them that "it is your local process
that runs slow", you'd better show that directly: "The original time cost
is 400s, and your local cost is 390s." It gives users a better feeling.
(Negotiaton skills).

Notice that IoTDB is an open source software and users may do not ask our
help. So, the easier way to modify the code to get the result is:
```
long begin = System.currentTime();
while () {
  String json = getDataFromPLC();
  double[] data = parseJson();
  // iotdbClient.insert(data);
}
long timeCost = System.currentTime() - begin;
```
However, if so, we can not guarantee that whether the modern compiler
optimize the codes and skip `parseJson()` function. So the result may
mislead us.

Therefore, if we have a testInsert() method, which just sends request to
IoTDB, and IoTDB returns directly. You can just tell users: if you want to
judge the performance problem, just replace `insert()` with `testInsert()`,
then you will know using your client hardware and the network environment,
what the performance limit is.

```
long begin = System.currentTime();
while () {
  String json = getDataFromPLC();
  double[] data = parseJson();
  iotdbClient.testinsert(data);
}
long timeCost = System.currentTime() - begin;
```

Best,
-----------------------------------
Xiangdong Huang
School of Software, Tsinghua University

 黄向东
清华大学 软件学院


Jialin Qiao <[email protected]> 于2019年12月5日周四 下午6:41写道:

> Hi,
>
> I wonder is it necessary to open a testMethod in our client API…
> It only passes the parameters but does nothing in the server side.
>
> Thanks,
> Jialin Qiao
>
> 南京大学软件学院薛恺丰 <[email protected]> 于2019年12月5日周四 上午10:22写道:
>
> > Hi~
> > I'm working on this issue. Pleases feel free to discuss with me.
> >
> >
> >
> >
> > ------------------&nbsp;原始邮件&nbsp;------------------
> > 发件人:&nbsp;"Yuan Tian (Jira)"<[email protected]&gt;;
> > 发送时间:&nbsp;2019年12月5日(星期四) 上午10:20
> > 收件人:&nbsp;"dev"<[email protected]&gt;;
> >
> > 主题:&nbsp;[jira] [Created] (IOTDB-343) Test method in session to help user
> > to analyze time cost
> >
> >
> >
> > Kaifeng Xue created IOTDB-343:
> > ---------------------------------
> >
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > Summary: Test method in session to help user to analyze time cost
> >
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > Key: IOTDB-343
> >
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > URL: https://issues.apache.org/jira/browse/IOTDB-343
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
> > <
> https://issues.apache.org/jira/browse/IOTDB-343&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
> >;
> > Project: Apache IoTDB
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Issue Type: New
> > Feature
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > Reporter: Kaifeng Xue
> >
> >
> > In our users' scenery, them often preprocess raw data into insert request
> > and then insert to IOTDB. We should support them to analyze the
> > preprocessing time and our database's executing time. So we should add
> test
> > method in session. In these test method, server just return success
> without
> > handling requests.
> >
> >
> >
> > --
> > This message was sent by Atlassian Jira
> > (v8.3.4#803005)
>
>
>
> --
> —————————————————
> Jialin Qiao
> School of Software, Tsinghua University
>
> 乔嘉林
> 清华大学 软件学院
>

Reply via email to