diff --git a/internal/server/aof.go b/internal/server/aof.go index 5b7bf7bf..afcb1f08 100644 --- a/internal/server/aof.go +++ b/internal/server/aof.go @@ -136,22 +136,10 @@ func (server *Server) flushAOF(sync bool) { } } -type writeAOFDetails struct { - appendBufferElapsed time.Duration - notifyLiveElapsed time.Duration - geofencesElapsed time.Duration -} - func (server *Server) writeAOF(args []string, d *commandDetails) error { - _, err := server.writeAOFDetails(args, d) - return err -} - -func (server *Server) writeAOFDetails(args []string, d *commandDetails) (details writeAOFDetails, err error) { - if d != nil && !d.updated { // just ignore writes if the command did not update - return details, nil + return nil } if server.shrinking { @@ -161,7 +149,6 @@ func (server *Server) writeAOFDetails(args []string, d *commandDetails) (details } if server.aof != nil { - start := time.Now() atomic.StoreInt32(&server.aofdirty, 1) // prewrite optimization flag n := len(server.aofbuf) server.aofbuf = redcon.AppendArray(server.aofbuf, len(args)) @@ -169,21 +156,14 @@ func (server *Server) writeAOFDetails(args []string, d *commandDetails) (details server.aofbuf = redcon.AppendBulkString(server.aofbuf, arg) } server.aofsz += len(server.aofbuf) - n - details.appendBufferElapsed = time.Since(start) } // notify aof live connections that we have new data - start := time.Now() server.fcond.L.Lock() server.fcond.Broadcast() server.fcond.L.Unlock() - details.notifyLiveElapsed = time.Since(start) // process geofences - start = time.Now() - defer func() { - details.geofencesElapsed = time.Since(start) - }() if d != nil { // webhook geofences if server.config.followHost() == "" { @@ -192,13 +172,13 @@ func (server *Server) writeAOFDetails(args []string, d *commandDetails) (details // queue children for _, d := range d.children { if err := server.queueHooks(d); err != nil { - return details, err + return err } } } else { // queue parent if err := server.queueHooks(d); err != nil { - return details, err + return err } } } @@ -219,7 +199,7 @@ func (server *Server) writeAOFDetails(args []string, d *commandDetails) (details } server.lcond.L.Unlock() } - return details, nil + return nil } func (server *Server) getQueueCandidates(d *commandDetails) []*Hook { diff --git a/internal/server/dev.go b/internal/server/dev.go index 06a57317..6c1c5982 100644 --- a/internal/server/dev.go +++ b/internal/server/dev.go @@ -75,30 +75,18 @@ func (c *Server) cmdMassInsert(msg *Message) (res resp.Value, err error) { return NOMessage, errInvalidArgument(snumPoints) } - type docmdDetails struct { - writeAOFDetails writeAOFDetails - cmdElapsed time.Duration - aofElapsed time.Duration - } - - docmd := func(args []string) (docmdDetails docmdDetails, err error) { + docmd := func(args []string) error { c.mu.Lock() defer c.mu.Unlock() var nmsg Message nmsg = *msg nmsg._command = "" nmsg.Args = args - var d commandDetails - start := time.Now() - _, d, err = c.command(&nmsg, nil) - docmdDetails.cmdElapsed = time.Since(start) + _, _, err := c.command(&nmsg, nil) if err != nil { - return docmdDetails, err + return err } - start = time.Now() - docmdDetails.writeAOFDetails, err = c.writeAOFDetails(nmsg.Args, &d) - docmdDetails.aofElapsed = time.Since(start) - return docmdDetails, err + return err } rand.Seed(time.Now().UnixNano()) @@ -141,27 +129,11 @@ func (c *Server) cmdMassInsert(msg *Message) (res resp.Value, err error) { strconv.FormatFloat(lon, 'f', -1, 64), ) } - start := time.Now() - docmdDetails, err := docmd(values) + err := docmd(values) if err != nil { log.Fatal(err) return } - elapsed := time.Since(start) - if elapsed > time.Millisecond*5 { - log.Infof("%d"+ - ", %6.1f cmd, %6.1f aof"+ - ", %6.1f buf, %6.1f not, %6.1f fence"+ - ", %6.1f tot", - len(values), - docmdDetails.cmdElapsed.Seconds()*1000, - docmdDetails.aofElapsed.Seconds()*1000, - docmdDetails.writeAOFDetails.appendBufferElapsed.Seconds()*1000, - docmdDetails.writeAOFDetails.notifyLiveElapsed.Seconds()*1000, - docmdDetails.writeAOFDetails.geofencesElapsed.Seconds()*1000, - elapsed.Seconds()*1000, - ) - } atomic.AddUint64(&k, 1) if j%1000 == 1000-1 { log.Debugf("mass: %s %d/%d",