Open markjenny opened 3 years ago
running the tiup playground on my laptop. 1 TiKV, 1 TiDB and 1 PD.
using sysbench to create one database consist of 32 tables. There're 10000 records in each table.
sysbench oltp_update_non_index --config-file=config --threads=32 --tables=32 --table-size=10000 prepare
generate the profile using the method below
curl http://{TiDBIP}:10080/debug/zip?seconds=60 --output debug.zip
the heap profile is here The most memory cost is in the fuction buildValueListOfInsert, So try to find the memory optimization.
buildValueListOfInsert
In the file planbuilder.go, the variable insertPlan.Lists is zero value. We can init the Lists as below:
planbuilder.go
insertPlan.Lists
insertPlan.Lists = make([][]expression.Expression, 0, len(insert.Lists)) // my modify insertPlan.AllAssignmentsAreConstant = true totalTableCols := insertPlan.Table.Cols() for i, valuesItem := range insert.Lists { //... insertPlan.Lists = append(insertPlan.Lists, exprList) }
Can I init the insertPlan to avoid the reallocation of the slice grow?
/label sig/planner
@ZenoTan Yes, you can take a try.
topology
running the tiup playground on my laptop. 1 TiKV, 1 TiDB and 1 PD.
workload
using sysbench to create one database consist of 32 tables. There're 10000 records in each table.
profile
generate the profile using the method below
the heap profile is here The most memory cost is in the fuction
buildValueListOfInsert
, So try to find the memory optimization.In the file
planbuilder.go
, the variableinsertPlan.Lists
is zero value. We can init the Lists as below:Can I init the insertPlan to avoid the reallocation of the slice grow?