When I use tikv-client to put some data, where is the data stored?

I used the python-client api to put the data as the demo described in thin link

where is the data store? How can I show the data?

Hi @wang,

I think in the article it already show you to get the data by get or scan API. The data is stored in TiKV.

Could you elaborate your question? I cannot get the point.

I apologize for it . I want to know the data stored in which database/table in TiKV.
Because I use the Put API which the parameters don’t include the database/table.
For example, I put the data like this : client.put(b"k1", b"Hello") .
I want to show the data with SQL. Thanks!

TiKV does not have the concept of database and table. Therefore, the keys and values are just stored as-is.

TiDB will translate the row to something like database_table_primarykey and store them as key-value pairs in TiKV. On the TiKV side, it doesn’t know anything about schema and table.

It is not recommended use TiKV client to put keys and then read them from TiDB. Either use a TiKV cluster for TiKV client, or use that cluster for TiDB.

I just have a test for the API and have the doubt. Thank you very much!

it’s better to use client-go and client-java since the Python client is under development.

I will use client-go in test. The performance of the put/get api is not good in my test, only 6 times in one minute.I don’t know whether it is related to python-api or the network.

could you provide the following information to help us further understand your use cases:

  1. the cluster topology, including how the client is connected to the cluster
  2. the TiKV and client version
  3. the benchmark you run

it would be helpful if you can provide a reproducible testing script.

@zz-jason
1)the cluster topology 1 TidB 、1 PD and 3 TiKV
(1 TiDB、1 PD are in one server, each TiKV in one server, total 4 servers)
2)the versions all are v5.1.0
I dont use client, only use the python-api with (tikv_client import RawClient) like the demo in the link
TiKV | TiKV in 5 Minutes
the program is following:(only 1 thread)
client = RawClient.connect(“10.201.0.122:2379”)
testnumber = 100
start_time = time.time()
for i in range (1,testnumber):
client.put(b"T%d"%i, b"%d"%i)
end_time = time.time()
print(“put exec %f seconds, %f times per sec”%((end_time - start_time), testnumber/(end_time - start_time)))

start_time = time.time()
for i in range (1,testnumber):
client.get(b"T%d"%i)
end_time = time.time()
print(“get exec %f seconds, %f times per sec”%((end_time - start_time), testnumber/(end_time - start_time)))

start_time = time.time()
for i in range (1,testnumber):
client.delete(b"T%d"%i)
end_time = time.time()
print(“delete exec %f seconds, %f times per sec”%((end_time - start_time), testnumber/(end_time - start_time)))

the result is:
put exec 12.266240 seconds, 8.152457 times per sec
get exec 12.558198 seconds, 7.962926 times per sec
delete exec 12.301056 seconds, 8.129384 times per sec

Here is my result:

put exec 2.258474 seconds, 44.277683 times per sec
get exec 2.074776 seconds, 48.197981 times per sec
delete exec 2.259892 seconds, 44.249902 times per sec

The test script is the same as yours:

from tikv_client import RawClient
import time

client = RawClient.connect("172.16.4.75:22210")
testnumber = 100

start_time = time.time()
for i in range (1,testnumber):
    client.put(b"T%d"%i, b"%d"%i)
end_time = time.time()
print("put exec %f seconds, %f times per sec"%((end_time - start_time), testnumber/(end_time - start_time)))

start_time = time.time()
for i in range (1,testnumber):
    client.get(b"T%d"%i)
end_time = time.time()
print("get exec %f seconds, %f times per sec"%((end_time - start_time), testnumber/(end_time - start_time)))

start_time = time.time()
for i in range (1,testnumber):
    client.delete(b"T%d"%i)
end_time = time.time()
print("delete exec %f seconds, %f times per sec"%((end_time - start_time), testnumber/(end_time - start_time)))

oh…maybe something wrong with my environment which is
complex running other application.