fleet/changes/35799-software-titles
Victor Lyuboslavsky 7107b1fa14
Optimized api/latest/fleet/software/titles endpoint (#40458)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #35799 

Loadtest results for 100K hosts and 300K software titles.

```
=== Performance Test Results: No team_id (all teams) ===

Description                     Average  Worst    Results
-----------                     -------  -----    -------
Page 0, hosts_count DESC        229ms    241ms    20 items
Page 0, hosts_count ASC         203ms    211ms    20 items
Page 1, hosts_count DESC        339ms    423ms    20 items
Page 1000, hosts_count DESC     202ms    219ms    20 items
100 per_page, hosts_count DESC  620ms    708ms    100 items
Default sort (no order params)  229ms    245ms    20 items
Order by name ASC, page 0       4.642s   4.785s   20 items
Order by name ASC, page 1000    6.418s   6.771s   20 items
Vulnerable only                 3.431s   3.496s   20 items
Search 'chrome'                 9.6s     10.111s  20 items
Known exploit filter            9.792s   10.102s  20 items
Min CVSS score 7.0              12.368s  12.665s  20 items
CVSS range 7.0-9.0              12.221s  12.523s  20 items
Available for install           87ms     93ms     NO RESULTS
Self-service only               4.46s    4.757s   20 items

=== Performance Test Results: team_id=0 (no team / unassigned) ===

Description                     Average  Worst    Results
-----------                     -------  -----    -------
Page 0, hosts_count DESC        378ms    404ms    20 items
Page 0, hosts_count ASC         339ms    345ms    20 items
Page 1, hosts_count DESC        478ms    513ms    20 items
Page 1000, hosts_count DESC     398ms    417ms    20 items
100 per_page, hosts_count DESC  864ms    1.025s   100 items
Default sort (no order params)  399ms    411ms    20 items
Order by name ASC, page 0       5.346s   5.41s    20 items
Order by name ASC, page 1000    7.444s   7.615s   20 items
Search 'chrome'                 9.051s   9.245s   20 items
Known exploit filter            10.511s  10.884s  20 items
Min CVSS score 7.0              16.589s  16.701s  20 items
CVSS range 7.0-9.0              15.878s  15.999s  20 items
Available for install           1.394s   1.429s   1 items
Self-service only               1.4s     1.456s   1 items
```

Documented in the issue:
The fix includes a small behavior change. The default primary sort of
/software/titles remains host_counts, but the secondary sort is now
software_title_id and not name. This was necessary to optimize the
endpoint. This means that if you have 1 host in your fleet, the software
page will not show the software titles ordered by name anymore. For
large fleets, this does not matter since all titles generally have
different host counts.

# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.

## Testing

- [x] Added/updated automated tests
- [x] QA'd all new/changed functionality manually

## Database migrations

- [x] Checked schema for all modified table for columns that will
auto-update timestamps during migration.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Optimized the software titles endpoint for improved query performance
and faster data retrieval.
* Enhanced database efficiency when retrieving software information,
resulting in better overall system responsiveness and reduced query
times.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-27 14:30:05 -06:00

1 line
55 B
Text

* Optimized api/latest/fleet/software/titles endpoint.