Methods NsxtEdgeGateway.GetAllUnusedExternalIPAddresses and NsxtEdgeGateway.GetUnusedExternalIPAddresses perform computations based on netip.Addr package.
The internal function ipSliceDifference is used to allocate a new slice to hold the final results. However, the operations become quite expensive memory wise having big subnets in Edge Gateway. Optimizing this function reduced memory consumption twice (see example below)
Example information
One example was allocation /8IPv4 subnet (16777213 IPs)
Before optimization 2 operations consumed such an amount of memory (getAllUnusedExternalIPAddresses - 7703.94MB)
After optimization 2 operations of getAllUnusedExternalIPAddresses consume such amount (after 3853.80MB vs before 7703.94MB):
Methods
NsxtEdgeGateway.GetAllUnusedExternalIPAddresses
andNsxtEdgeGateway.GetUnusedExternalIPAddresses
perform computations based onnetip.Addr
package.The internal function
ipSliceDifference
is used to allocate a new slice to hold the final results. However, the operations become quite expensive memory wise having big subnets in Edge Gateway. Optimizing this function reduced memory consumption twice (see example below)Example information
One example was allocation
/8
IPv4
subnet (16777213
IPs)Before optimization 2 operations consumed such an amount of memory (
getAllUnusedExternalIPAddresses
- 7703.94MB)After optimization 2 operations of
getAllUnusedExternalIPAddresses
consume such amount (after 3853.80MB vs before 7703.94MB):