Skip to content

Commit

Permalink
ts: Adjust QueryWorkerMax for TS Server
Browse files Browse the repository at this point in the history
Adjusts time series QueryWorkerMax, the maximum number of
simultaneous workers, down to 8 from 64.

Also adjusts the estimatedSourceCount for individual queries to match
the source count for queries which provide a specific list of sources.

Resolves cockroachdb#24018

Release note (Admin UI): Fixed a bug where graphs would not display on
clusters with large numbers of nodes.
  • Loading branch information
Matt Tracy committed Mar 19, 2018
1 parent 07219f6 commit 2bfbc4c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/ts/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
URLPrefix = "/ts/"
// queryWorkerMax is the default maximum number of worker goroutines that
// the time series server can use to service incoming queries.
queryWorkerMax = 64
queryWorkerMax = 8
// queryMemoryMax is a soft limit for the amount of total memory used by
// time series queries. This is not currently enforced, but is used for
// monitoring purposes.
Expand Down Expand Up @@ -231,6 +231,16 @@ func (s *Server) Query(
func(ctx context.Context) {
// Create a memory account for the results of this query.
resultAccounts[queryIdx] = s.resultMemMonitor.MakeBoundAccount()

// Estimated source count is either the count of requested sources
// *or* the estimated cluster node count if no sources are specified.
var estimatedSourceCount int64
if len(query.Sources) > 0 {
estimatedSourceCount = int64(len(query.Sources))
} else {
estimatedSourceCount = estimatedClusterNodeCount
}

datapoints, sources, err := s.db.QueryMemoryConstrained(
ctx,
query,
Expand All @@ -244,7 +254,7 @@ func (s *Server) Query(
// The worker is allotted an even share of the total worker memory
// budget for the server.
s.queryMemoryMax/int64(s.queryWorkerMax),
estimatedClusterNodeCount,
estimatedSourceCount,
)
if err == nil {
response.Results[queryIdx] = tspb.TimeSeriesQueryResponse_Result{
Expand Down

0 comments on commit 2bfbc4c

Please sign in to comment.