-
Notifications
You must be signed in to change notification settings - Fork 810
Open
Labels
#g-security-complianceSecurity & Compliance product groupSecurity & Compliance product group:releaseReady to write code. Scheduled in a release. See "Making changes" in handbook.Ready to write code. Scheduled in a release. See "Making changes" in handbook.storyA user story defining an entire featureA user story defining an entire feature~assisting g-orchestrationThis is a #g-orchestration issue that another product group is assistingThis is a #g-orchestration issue that another product group is assisting~engineering-initiatedEngineering-initiated story, such as a bug, refactor, or contributor experience improvement.Engineering-initiated story, such as a bug, refactor, or contributor experience improvement.~postmortem-action-itemIssue is an action item resulting from an incident postmortem.Issue is an action item resulting from an incident postmortem.
Milestone
Description
Goal
| User story |
|---|
| As a Fleet server operator, |
| I want to eliminate redundant database calls during osquery detail query ingestion |
| so that I can reduce per-host check-in overhead and improve server scalability. |
Changes
Product
- UI changes: No changes
- CLI (fleetctl) usage changes: No changes
- YAML changes: No changes
- REST API changes: No changes
- Fleet's agent (fleetd) changes: No changes
- Fleet server configuration changes: No changes
- Exposed, public API endpoint changes: No changes
- fleetdm.com changes: No changes
- GitOps mode UI changes: No changes
- GitOps generation changes: No changes
- Activity changes: No changes
- Permissions changes: No changes
- Changes to paid features or tiers: No changes
- My device and fleetdm.com/better changes: No changes
- Usage statistics: No changes
- Other reference documentation changes: No changes
- First draft of test plan added
- Once shipped, requester has been notified
- Once shipped, dogfooding issue has been filed
Engineering
- Test plan is finalized
- Contributor API changes: No changes
- Feature guide changes: No changes
- Database schema migrations: No changes
- Load testing: Should verify reduced DB call volume per host check-in under load
- Pre-QA load test: Recommended - this change directly affects the hottest code path (
SubmitDistributedQueryResults) - Load testing/osquery-perf improvements: No changes
- This is a premium only feature: No
Summary of engineering changes
Introduce a hostDetailQueryConfig struct that pre-loads all configuration needed during detail query ingestion (AppConfig, HostFeatures, TeamMDMConfig, conditional access status) once per request instead of once per detail query result.
Key changes:
- New
hostDetailQueryConfigstruct holds pre-loaded configuration - New
loadHostDetailQueryConfig()method loads all four config values once SubmitDistributedQueryResultsloads config once before the results loopingestQueryResults,directIngestDetailQuery, andingestDetailQueryreceive the struct instead of re-loading from the database- The pre-loaded
AppConfigis reused for post-loop processing (label recording, policy webhooks, deferred host save) detailQueriesForHostalso uses the same loader for consistency
Impact for a host check-in with N detail query results:
| Metric | Before | After |
|---|---|---|
AppConfig lookups |
~2N + 2 | 1 |
HostFeatures / TeamFeatures lookups |
~2N | 1 |
TeamMDMConfig lookups |
~2N | 1 |
ConditionalAccessMicrosoftGet lookups (uncached) |
~2N | 1 |
GetDetailQueries rebuilds |
~2N | 0 (in ingestion path) |
Please read this issue carefully and understand it. Pay special attention to UI wireframes, especially "dev notes".
Risk assessment
- Requires load testing: User story has performance implications that require load testing.
- Risk level: Low
- Risk description: Change is internal refactoring of how configuration is loaded during query ingestion. No public API changes. All existing unit tests pass. The primary risk is a subtle behavioral difference if config changes mid-request, but this is actually desirable (consistent config within a single check-in).
Test plan
Core flow
- Verify that host detail query ingestion still works correctly after the change
API
- No public API changes; all changes are internal to
SubmitDistributedQueryResultsand its helpers
Permissions
- No permissions changes
Edge cases
- Host has no team assigned (nil
TeamIDpaths inloadHostDetailQueryConfig) - Conditional access is not configured (verify
conditionalAccessMicrosoftEnableddefaults tofalse)
Related issues
- #35467 - Audit codebase for expensive database calls in hot paths
- #40660 - numa postmortem action item: improving the inefficient API endpoint
- #40662 - Inspect our API endpoint for optimal performance
Confirmation
- Engineer: Added comment to user story confirming successful completion of test plan (include any special setup, test data, or configuration used during development/testing if applicable).
- QA: Added comment to user story confirming successful completion of test plan.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
#g-security-complianceSecurity & Compliance product groupSecurity & Compliance product group:releaseReady to write code. Scheduled in a release. See "Making changes" in handbook.Ready to write code. Scheduled in a release. See "Making changes" in handbook.storyA user story defining an entire featureA user story defining an entire feature~assisting g-orchestrationThis is a #g-orchestration issue that another product group is assistingThis is a #g-orchestration issue that another product group is assisting~engineering-initiatedEngineering-initiated story, such as a bug, refactor, or contributor experience improvement.Engineering-initiated story, such as a bug, refactor, or contributor experience improvement.~postmortem-action-itemIssue is an action item resulting from an incident postmortem.Issue is an action item resulting from an incident postmortem.
Type
Projects
Status
No status
Status
🦤 In review