Skip to content

Improve Interface API Endpoint speed. #12548

@jiuka

Description

@jiuka

NetBox version

v3.5.1

Feature type

Change to existing functionality

Proposed functionality

Adding l2vpn_terminations and vdcs to the prefetch_related in the InterfaceViewSet reduced amount of DB queries in our setup from 3185 down to 1183 for requesting 1000 Interfaces. And Reduces the request time from ~7s to ~4s.

Many of the remaining queries come from the link_peers and connected_endpoints field. If possible those fiels should be prefetched as well, however I could not find out how this can be achived. (To test the impact of those fields I removed them from the Serializer to test and gotthe queries to request the same 1000 interfaces down to 57)

Use case

The Ansible netbox.netbox.nb_inventory plugin needs to fetch all interfaces if interfaces informations should be included. This is relativly slow and by far the slowest part of the inventory fetching process.

Database changes

No response

External dependencies

No response

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions