Commit 8521d9fc authored by xiaoguang.xu's avatar xiaoguang.xu

batchSize

parent 43a9d969
......@@ -26,7 +26,8 @@ func MsgProcess(msg string) {
msgInfluxProcess(traceMsg)
}
var pointSlice = make([]*client.Point, 0, 1000)
var batchSize = 1000
var pointSlice = make([]*client.Point, 0, batchSize)
func msgInfluxProcess(traceMsgs []TraceMsg) {
......@@ -64,9 +65,9 @@ func msgInfluxProcess(traceMsgs []TraceMsg) {
unix := time.Unix(0, traceMsg.Timestamp*1000)
if len(pointSlice) == 1000 {
if len(pointSlice) == batchSize {
go batchWrite(pointSlice)
pointSlice = make([]*client.Point, 0)
pointSlice = make([]*client.Point, 0, batchSize)
}
point, _ := client.NewPoint("trace_info", tags, fields, unix)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment