Skip to content

Swap querier /api/search and remaining endpoints to proto#3944

Merged
mdisibio merged 3 commits intografana:mainfrom
mdisibio:search-proto
Aug 7, 2024
Merged

Swap querier /api/search and remaining endpoints to proto#3944
mdisibio merged 3 commits intografana:mainfrom
mdisibio:search-proto

Conversation

@mdisibio
Copy link
Copy Markdown
Contributor

@mdisibio mdisibio commented Aug 6, 2024

What this PR does:
Follow up to #3745 and #3731 . Swaps /api/search and almost all remaining endpoints (except metrics summary api), to use proto between the frontend and queriers. Improves latency, cpu, and memory. Now that this is universal for all communication between frontend and queriers, did the next step of cleanup and centralized in prepareRequestForQueriers.

For a bit more context - this started out as troubleshooting performance and resource usage for some searches. When limit and spans per spanset are high, it reached a point where the json encoding/decoding was the bottleneck. For example limit=1000 and spss=100, means up to 100K spans per job. This could easily lead to 100MB+ json response sizes.

Which issue(s) this PR fixes:
Fixes n/a

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

…ng from json to proto internally between frontend and queriers
Copy link
Copy Markdown
Contributor

@javiermolinar javiermolinar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, should we keep this?

default:

If none of these endpoints are going to return a json response maybe we can delete it

Copy link
Copy Markdown
Collaborator

@joe-elliott joe-elliott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice cleanup and perf improvement

// All communication with the queriers should be proto for efficiency
// NOTE - This isn't strict and queriers may still return json if we missed
// an endpoint. But cache and response unmarshalling still work.
req.Header.Set(api.HeaderAccept, api.HeaderAcceptProtobuf)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 putting this here

@joe-elliott
Copy link
Copy Markdown
Collaborator

If none of these endpoints are going to return a json response maybe we can delete it

i'd like to keep it so that curling the queriers directly will return json. there may be other good/bad reasons for it to be around

@mdisibio
Copy link
Copy Markdown
Contributor Author

mdisibio commented Aug 7, 2024

i'd like to keep it so that curling the queriers directly will return json. there may be other good/bad reasons for it to be around

+1 Agree good for troubleshooting. Occasionally I use it to replay a single job shard against a querier.

@mdisibio mdisibio merged commit c5504bd into grafana:main Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants