-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Labels
severity: lowDoes not significantly disrupt application functionality, or a workaround is availableDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Milestone
Description
Deployment Type
Self-hosted
Triage priority
N/A
NetBox Version
v3.7, v4.2
Python Version
3.11
Steps to Reproduce
- Fill enough data for devices with cables and connections.
- Do API requests to load device, interfaces, ip-addresses like
http://localhost:8000/api/dcim/interfaces/?device_id=3971&limit=100&offset=0
Expected Behavior
Data is loaded quite fast, <0.5 seconds. Number of db queries pretty small up to 10-20 per HTTP-request
Observed Behavior
Some requests are pretty slow. Up to 3 seconds.
130 sql queries are produced on 3.7 and 160 db queries on 4.2
CabledObjectModel.link_peers has N+1 problem: https://github.com/netbox-community/netbox/blob/v3.7.8/netbox/dcim/models/device_components.py#L192
CablePath._get_path has N+1 problem as well: https://github.com/netbox-community/netbox/blob/v3.7.8/netbox/dcim/models/cables.py#L746
I tried to comment out these methods and got only 20 db queries on the same http request
Additional info: n+1 problem should be eliminated
Jay-T, spatecon, keithcroxford, Etibru, chirizxc and 6 more
Metadata
Metadata
Assignees
Labels
severity: lowDoes not significantly disrupt application functionality, or a workaround is availableDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application