tidb: tidb crashes when executing the query
Hi all. I am checking the availability and load capacity of TiDB with the following scenario: I have 8 workers:
- 4 workers execute transaction insert with
1000 record/transaction
. - 1 worker executes query statement:
SELECT count(*), SUM(amount) FROM test_translog.transLog GROUP BY userID
- 1 worker executes query statement:
SELECT SUM(amount) FROM test_translog.transLog GROUP BY appID
- 1 worker executes query statement:
SELECT MAX(amount) FROM test_translog.transLog201701 WHERE appTransID > ? AND appTransID < ?
- 1 worker executes query statement:
UPDATE test_translog.transLog201701 SET amount = ? WHERE transID = ?
I run all workers about 6 hours and workers connect the same TiDB. Then, there are some phenomena happening:
- Workers Insert and update still work. Worker execute query which do not work. I try test on workbench. And result is timeout (~30s).
- TiDB
crashed shortly after
. TiKV’s RAM increased from9GB to 15GB within 2 minutes
.
RAM TiKV
CPU TiKV
Image TiDB
I think that TiDB used lots of memory
when it execute sql that makes the TiDB crash. TiDB cache lots of data on memory. My idea that we should use stream to send result from TiKV to TiDB and from TiDB to Client. Because it help minimize the data saved on memory. And we do not wait all result from TiKV, then TiDB just send it to client.
I use TiDB version 3. And i deploy 3 node TiDB, 3 node TiKV, 3 node PD. And node has 32GB, CPU 16 core.
This is link project that I used to test.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 57 (26 by maintainers)
Yes, your query does contribute to Tikv’s memory. There are block cache to fill (which will not release the occupied memory after request is finished) and runtime memory (which will be freed after request).