Skip to content

Cache the Config Context in the Database #4544

@dstarner

Description

@dstarner

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: revisions neededThis issue requires additional information to be actionable

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions