-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Environment
- Python version: 3.7
- NetBox version: 2.7.10
Proposed Functionality
As discussed in Slack, it may be beneficial to cache the generated/merged config context in the database to reduce load times on bulk device list API requests.
Use Case
Fetching 1000 devices with config context returned takes ~60s. Without config context, the response takes ~5 seconds. This large overhead was determined to be from the generation & merging of the config contexts that exist on devices / virtual machines. This context is regenerated on every request. For performance, it would be practical and very performant to pre-cache this generated data in the database.
Database Changes
This would require adding a computed_config_context to the ConfigContextModel that would contain the computed config context. The naming of this field can be up for debate if something better is thought of.
It would contain the pre-cached computed config context, and it would be rebuilt whenever an associated ConfigContext is updated or during the save()/post_save method of a ConfigContextModel.
External Dependencies
NA