Page MenuHomePhabricator

Make DNS generation faster
Open, MediumPublic

Description

DNS Generation is very slow even with changes to the caching layer.

I have spent some time porting the collect family of functions from generate_dns_snippets.py to the internal API of Netbox, and discovered that with few optimizations the entire step takes something around 30s targeting these APIs including serialization (as opposed to several minutes using the external API). I propose to take this work and create a CustomScript which would produce a JSON output matching what collect normally creates and replace the external API calls with a call to this script. There are numerous places in collect that could be further sped up to decrease the amount of data transferred and the amount of marshalling and unmarshalling that has to happen.

Related Objects

StatusSubtypeAssignedTask
OpenNone
Resolvedayounsi
Resolvedayounsi

Event Timeline

crusnov triaged this task as Medium priority.Jan 8 2021, 7:31 PM
crusnov created this task.

I agree that the APIs are slow and we should improve the DNS generation time. I think though that a custom script will be a hacky way to solve the issue, I think we should go further and make a custom plugin that exposes a proper API endpoint that can be called by the dns generation script.
In parallel with this I think we should also have a conversation with upstream and their plans to improve or debug performance issues with their APIs. There is no evident reason why they are so slow given that the same data can always be retrieved with the internal Netbox API that are always very quick.

That seems like a reasonable approach. The outcome should be the same (although I don't know if there's in fact an issue at the layer(s) that the API operates through, so while internally the data gathering is not that slow, marshalling through the API layer might be the slow part; the plumbing which I've spent some time with is labyrinthine and difficult to follow for me).