Cbq-engine for memory and cpu question

40-rc
n1ql

#1

when I use N1QL, cbq-engine process use RAM is increasing,but when I disconnect client, the cbq-engine use RAM is always high, and the cpu will periodically up to 100%,how can I solve?


#2

Which version are you using?
Memory allocations behavior comes from garbage collection that happens over time and is not immediate. Query execution engine also has background threads manage these operations like garbage collection. I expect that you may see cpu utilization even when queries aren’t running due to these background activities.
thanks
-cihan


#3

I try to modify the code in https://github.com/couchbase/query/blob/master/server/http/service_response.go.
In function ‘Execute’ and end of the function,I use this.stopAndClose(state) to replace this.Close() , the RAM can decrease for over a period of time,I guess when some server error state, the request not close,the memory always not to GC.Is this possible?
thanks


#4

for my test picture, this server just have query service.


this is n1ql request,

and the cpu picture,
but some time cpu up to 100%,I use top to look process is cbq-engine

and last the RAM picture:

the process can GC,but RAM always is high. before another test, the RAM use keep 70%.
thanks


#5

for my solution:
cancel two function:

  1. Do not listen the request to disconnect

code link
delete

closeNotify := resp.(http.CloseNotifier).CloseNotify()
closeNotifier := func() {
select {
case <-closeNotify:
rv.Expire()
return
case <-rv.requestNotify:
return
}
}
go closeNotifier()

the requests/s increase 20 times In my system environment,for my environment the request normal can’t disconnect.

  1. cancel request log

code link
delete

accounting.LogRequest(acctstore, request_time, service_time, request.resultCount,
request.resultSize, request.errorCount, request.warningCount, request.Statement(),
request.SortCount(), request.Prepared(), request.Id().String())