Replies: 2 comments 3 replies
-
|
I'm curious about your setup as you mentioned that your app is already using in-mem cache but you say that doesn't really help. Can you improve that part of your setup? I'm having similar situation where the cloud-hosted NetBox is about 10 ms away, and I don't want to hammer it with single requests (if avoidable). For now I've had good enough solution where the app logic fetches more than one object at a time (for example, all prefixes of a single tenant, or pre-fetches a longer list of interfaces instead of requesting interfaces one-by-one) and keep that data in memory. My performance-sensitive apps are generally batch runs, so they can build their own in-memory tables during their runs, and use that data if already fetched from NetBox. The runs are also short enough so that I don't have to care about the NetBox data possibly changing during the runs. |
Beta Was this translation helpful? Give feedback.
-
|
I think Postgres-level replication is the way to go here, even if it means manually shipping the WALs, or finding some postgres tool which can upload the WALs into an S3 bucket or suchlike. (Googling turns up wal-e, which describes itself as 'obsolete' but links to other more modern tools) Netbox's circular dependencies make it very hard to replicate any other way. For example, a Device points to two IP address objects for primary_ip4 and primary_ip6, but each IP address references an Interface, and the Interface references the Device. The REST API does not provide a way to create all these objects simultaneously within one transaction, so it's necessary to create them partially and then patch them up afterwards. More importantly, the REST API doesn't let you choose the ID of a new object - it's always allocated from a sequence - which forces you to do SQL-level replication, as there is no other unique ID for every object. An alternative approach would be to work out what data you want to query, do some periodic queries in the cloud (e.g. CSV or JSON exports) which cover the required fields, download those files and use them. But then you can't query it in the same way as you do the live instance. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I host Netbox in a public cloud and query it to pull out tenant data associated with specific prefixes to encrich log data in our SIEM. Even with a local in mem key=value cache this creates a lot of requests to my cloud hosted netbox install. I though about having a local copy of netbox that is a copy of my cloud version to query against instead. This would get rid of the WAN network latency per request and keep me from using all my burst credits in AWS.
The problems comes with keeping the local copy in sync with the cloud copy. I initially thought replicate the DB but I would have to make a large amount of network changes to get this to work. Then I though maybe I can use pynetbox to sync the two across each instances api.
My thought process is query the cloud version to get.all() per endpoint and run it through dict() and somehow load that data into a bulk create or update against the local copy. I am probably overlooking so much but I want to see if the is a recommended approach before I start spinning by wheels or if someone generally just has a suggestion on how to accomplish this.
Beta Was this translation helpful? Give feedback.
All reactions