Il traffico in uscita tra Apigee e un backend di destinazione con un indirizzo IP pubblico utilizza Cloud NAT
per convertire l'indirizzo IP privato della tua istanza Apigee in un indirizzo IP pubblico. Se il backend di destinazione richiede l'inserimento nella lista consentita di indirizzi IP, puoi prenotare e attivare indirizzi IP NAT statici per il traffico in uscita.
Questo argomento descrive come calcolare il numero minimo di indirizzi IP NAT statici necessari per supportare il traffico previsto.
Prima di iniziare
Se scegli di utilizzare l'allocazione IP NAT statica per supportare l'inserimento nella lista consentita, dovrai calcolare
il numero minimo di IP statici necessari per supportare il traffico previsto. Per questo calcolo, avrai bisogno delle seguenti informazioni:
Tempo massimo per transazione: il tempo massimo, in secondi, necessario per una transazione, dall'inizio della richiesta alla fine della risposta.
Numero massimo di transazioni al secondo (TPS): il numero massimo di transazioni al secondo che l'istanza Apigee può supportare.
TPS massimo per un singolo backend univoco: il numero massimo di transazioni al secondo che un singolo backend può supportare.
Numero massimo di ambienti: il numero massimo di ambienti in questa istanza Apigee.
Calcola il numero di IP statici necessari
Puoi utilizzare le seguenti formule per calcolare il numero minimo di indirizzi IP NAT che devono essere assegnati staticamente:
Calcola il numero massimo di porte di origine NAT richieste per backend come $ S $.
$$ S = \lceil (150 + T) \times B \rceil $$
Dove:
$ T $ è il tempo massimo per transazione, in secondi.
$ B $ è il TPS massimo per qualsiasi singolo backend univoco.
$ \lceil \rceil $ è la funzione di arrotondamento per eccesso (intero più piccolo), ovvero arrotonda per eccesso all'intero successivo
Calcola il numero minimo di porte utilizzate dall'istanza Apigee come $ N $.
$$ N = max(4096 \times E, \lceil {512 \over 75} \times R \rceil) + 6144 $$
Dove:
$ E $ è il numero di ambienti Apigee.
$ R $ è il TPS massimo per l'istanza Apigee.
$ \lceil \rceil $ è la funzione di arrotondamento per eccesso (intero più piccolo), ovvero arrotonda per eccesso all'intero successivo
La funzione $ \mathit{max}() $ prende il massimo dei due valori.
Prendi il numero massimo di porte richieste come $ P $.
$$ P = max(S, N) $$
Dove:
$ S $ è il numero massimo di porte di origine NAT richieste, come calcolato nel passaggio 1.
$ N $ è il numero minimo di porte utilizzate dall'istanza Apigee, come calcolato nel passaggio 2.
La funzione $ \mathit{max}() $ prende il massimo dei due valori.
Calcola il numero minimo di IP NAT richiesti come $ I $.
$$ I = \lceil P / 64512 \rceil $$
Dove:
$ P $ è il numero massimo di porte richieste, calcolato nel passaggio 3.
$ \lceil \rceil $ è la funzione di arrotondamento per eccesso (intero più piccolo), ovvero arrotonda per eccesso all'intero successivo
Esempi
Esempio 1
In questo esempio, prevediamo un massimo di 10.000 TPS in un ambiente. Le transazioni sono tutte richieste HTTP GET e la durata della transazione al 99° percentile è di 50 millisecondi (ms). Queste richieste vengono gestite in modo non uniforme da un pool di server dietro tre backend del bilanciatore del carico, con un bilanciatore del carico che gestisce 5000 TPS, un altro che gestisce 3000 TPS e l'ultimo che gestisce 2000 TPS.
Per questo esempio, i valori chiave sono i seguenti:
Tempo massimo per transazione: 50 ms
TPS massimo per l'istanza Apigee: 10.000
TPS massimo per un singolo backend: 5000
Numero di ambienti Apigee: 1
Utilizzando le formule descritte in precedenza, possiamo calcolare il numero di IP NAT richiesti:
Il numero minimo di IP NAT richiesti per supportare un massimo di 10.000 TPS di 50 ms ciascuno (o
meno), con una singola coppia di IP e porta di backend che supporta un massimo di 5000 TPS, è
12.
Esempio 2
In questo esempio, prevediamo un massimo di 1000 TPS in 20 ambienti Apigee. La durata
del 99° percentile di queste transazioni è di 5 secondi. Queste richieste verranno gestite da 8
backend di destinazione, con il traffico normalmente distribuito in modo uniforme tra tutti. Tenendo conto
di manutenzione e interruzioni, un singolo backend non dovrebbe mai gestire più di 250 TPS.
Per questo esempio, i valori chiave sono i seguenti:
Tempo massimo per transazione: 5 secondi
Numero massimo di transazioni al secondo (TPS): 1000
TPS massimo per un singolo backend: 250
Numero di ambienti Apigee: 20
Utilizzando le formule descritte in precedenza, possiamo calcolare il numero di IP NAT richiesti:
Il numero minimo di IP NAT richiesti per supportare un massimo di 1000 TPS di 5 secondi ciascuno (o meno),
con una singola coppia di IP e porta di backend che supporta un massimo di 250 TPS, è 2.
Esempio 3
In questo esempio, vogliamo calcolare il TPS massimo ottenibile con due IP NAT per un singolo backend di destinazione. Il tempo massimo per transazione è stimato in 100 ms.
Per questo esempio, i valori chiave sono i seguenti:
Tempo massimo per transazione: 100 ms
Numero di IP NAT: 2
In questo caso, possiamo utilizzare le formule del passaggio 4 e del passaggio 1 per calcolare il numero massimo di
porte di origine NAT fornite e il numero di TPS che queste porte di origine possono supportare:
$$ 2 = \lceil P / 64512 \rceil $$
$$ 129024 = P $$
Il numero massimo di porte di origine NAT fornite è 129.024.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eThis document explains how to calculate the minimum number of static NAT IPs needed for Apigee to support outbound traffic to target backends that require IP allow-listing.\u003c/p\u003e\n"],["\u003cp\u003eThe calculation requires knowing the maximum time per transaction, maximum transactions per second (TPS) for both the Apigee instance and a single backend, and the number of Apigee environments.\u003c/p\u003e\n"],["\u003cp\u003eThe provided formulas determine the maximum number of NAT source ports required, which is then used to find the minimum number of NAT IPs needed, using a "worst-case" scenario that does not consider connection reuse.\u003c/p\u003e\n"],["\u003cp\u003eExamples are included to demonstrate how to apply these formulas in scenarios with different transaction rates, durations, and backend configurations to calculate required static NAT IPs.\u003c/p\u003e\n"],["\u003cp\u003eThe document is applicable to Apigee and not to Apigee hybrid.\u003c/p\u003e\n"]]],[],null,["# Calculating static NAT IP requirements\n\n*This page\napplies to **Apigee** , but not to **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\nSouthbound traffic between Apigee and a target backend with a public IP address uses [Cloud NAT](https://cloud.google.com/nat/docs/overview)\nto translate the private IP address of your Apigee instance into a public IP address. If your target backend requires IP allow-listing, you can reserve and activate static NAT IPs for egress traffic.\nThis topic describes how to calculate the minimum number of static NAT IPs required to support anticipated traffic.\n\nBefore you begin\n----------------\n\nIf you choose to use static NAT IP allocation to support allow-listing, you will need to calculate\nthe minimum number of static IPs required to support anticipated traffic. For this calculation, you will need the following information:\n\n- **Maximum time per transaction**: This is the maximum time, in seconds, that a transaction will take, from the start of the request until the end of the response.\n- **Maximum transactions per second (TPS)**: This is the maximum number of transactions per second the Apigee instance can possibly support.\n- **Maximum TPS for a single unique backend**: This is the maximum number of transactions per second that any single backend can possibly support.\n- **Maximum number of environments**: The maximum number of environments on this Apigee instance.\n\n| **Note**: The maximums detailed above are a part of capacity planning for NAT, and must include consideration of possible traffic spikes, TPS increases for backends due to a maintenance or outage, and future environment additions. It is recommended to add some buffer to the projected numbers in order to handle unforeseen traffic increases, and to redo the NAT calculations when projections change.\n\nCalculate the number of static IPs required\n-------------------------------------------\n\nYou can use the following formulas to calculate the minimum number of NAT IPs that need to be statically assigned:\n\n1. Calculate the maximum number of NAT source ports required per backend as $ S $. \n $$ S = \\\\lceil (150 + T) \\\\times B \\\\rceil $$\n\n Where:\n - $ T $ is the maximum time per transaction, in seconds.\n - $ B $ is the maximum TPS for any single unique backend.\n - $ \\\\lceil \\\\rceil $ is the ceiling (least integer) function, meaning round up to the next integer\n2. Calculate the minimum ports used by the Apigee instance as $ N $. \n $$ N = max(4096 \\\\times E, \\\\lceil {512 \\\\over 75} \\\\times R \\\\rceil) + 6144 $$\n\n Where:\n - $ E $ is the number of Apigee environments.\n - $ R $ is the maximum TPS for the Apigee instance.\n - $ \\\\lceil \\\\rceil $ is the ceiling (least integer) function, meaning round up to the next integer\n - The $ \\\\mathit{max}() $ function takes the maximum of the two values.\n3. Take the maximum number of ports required as $ P $. \n $$ P = max(S, N) $$\n\n Where:\n - $ S $ is the maximum number of NAT source ports required, as calculated in Step 1.\n - $ N $ is the minimum number of ports used by the Apigee instance, as calculated in Step 2.\n - The $ \\\\mathit{max}() $ function takes the maximum of the two values.\n4. Calculate the minimum number of NAT IPs required as $ I $. \n $$ I = \\\\lceil P / 64512 \\\\rceil $$\n\n Where:\n - $ P $ is the maximum number of ports required, calculated in Step 3.\n - $ \\\\lceil \\\\rceil $ is the ceiling (least integer) function, meaning round up to the next integer\n\n| **Note** : These formulas do not account for connection reuse, and instead calculate a \"worst-case\" scenario where no connections are reused. Actual connection reuse may vary. See [Connection Reuse](/apigee/docs/api-platform/security/nat-performance#connection-reuse) for the factors that contribute to an Apigee instance reusing an existing connection or opening a new one.\n\nExamples\n--------\n\n### Example 1\n\nIn this example, we expect a maximum of 10,000 TPS across 1 environment. The transactions are all `HTTP GET` requests\nand the 99th percentile transaction duration is 50 milliseconds (ms). These requests are unevenly served by a pool of\nservers behind 3 load balancer backends, with one of the load balancers taking 5,000 TPS, another taking 3,000 TPS, and the last\nload balancer taking 2,000 TPS.\n\nFor this example, the key values are as follows:\n\n- Maximum time per transaction: **50 ms**\n- Maximum TPS for the Apigee instance: **10,000**\n- Maximum TPS for a single backend: **5,000**\n- Number of Apigee environments: **1**\n\nUsing the formulas outlined earlier, we can calculate the number of NAT IPs required:\n\n1. $$ \\\\lceil (150 + 0.050) \\\\times 5000 \\\\rceil = \\\\lceil 150.050 \\\\times 5000 \\\\rceil = \\\\lceil 750250 \\\\rceil = 750250 $$\n\n The maximum number of NAT source ports required per backend, assuming no connection reuse, is **750,250**.\n 2. $$ max(4096 \\\\times 1, \\\\lceil {512 \\\\over 75} \\\\times 10000 \\\\rceil) + 6144 $$ \n $$ max(4096, \\\\lceil 6.827 \\\\times 10000 \\\\rceil) + 6144 $$ \n $$ max(4096, \\\\lceil 68270 \\\\rceil) + 6144 $$ \n $$ 68270 + 6144 = 74414 $$\n\n The minimum number of NAT source ports used by the Apigee runtime is **74,414**.\n3. $$ max(750250, 74414) = 750250 $$\n\n The maximum number of NAT source ports required per instance is **750,250**.\n4. $$ \\\\lceil 750250 / 64512 \\\\rceil = \\\\lceil 11.630 \\\\rceil = 12 $$\n\n The minimum number of NAT IPs required to support a maximum of 10,000 TPS of 50 ms each (or\n less), with a single backend IP and port pair supporting a maximum of 5,000 TPS, is\n **12**.\n\n### Example 2\n\nIn this example, we expect a maximum of 1,000 TPS across 20 Apigee environments. The\n99th percentile duration of these transactions is 5 seconds. These requests will be served by 8\ntarget backends, with traffic normally evenly distributed across all of them. With consideration\nfor maintenance and outages, a single backend is never expected to serve more than 250 TPS.\n\nFor this example, the key values are as follows:\n\n- Maximum time per transaction: **5s**\n- Maximum transactions per second (TPS): **1,000**\n- Maximum TPS for a single backend: **250**\n- Number of Apigee environments: **20**\n\nUsing the formulas outlined earlier, we can calculate the number of NAT IPs required:\n\n1. $$ \\\\lceil (150 + 5) \\\\times 250 \\\\rceil = \\\\lceil 155 \\\\times 250 \\\\rceil = \\\\lceil 38750 \\\\rceil = 38750 $$\n\n The maximum number of NAT source ports required per backend, assuming no connection reuse, is **38,750**.\n 2. $$ max(4096 \\\\times 20, \\\\lceil {512 \\\\over 75} \\\\times 1000 \\\\rceil) + 6144 $$ \n $$ max(81920, \\\\lceil 6.827 \\\\times 1000 \\\\rceil) + 6144 $$ \n $$ max(81920, \\\\lceil 6827 \\\\rceil) + 6144 $$ \n $$ 81920 + 6144 = 88064 $$\n\n The minimum number of NAT source ports used by the Apigee runtime is **88,064**.\n3. $$ max(38750, 88064) = 88064 $$\n\n The maximum number of NAT source ports required per instance is **88,064**.\n4. $$ \\\\lceil 88064 / 64512 \\\\rceil= \\\\lceil 1.365 \\\\rceil= 2 $$\n\n The minimum number of NAT IPs required to support a maximum of 1,000 TPS of 5 seconds each (or less),\n with a single backend IP and port pair supporting a maximum of 250 TPS, is **2**.\n\n### Example 3\n\nIn this example, we want to calculate the maximum TPS achievable with 2 NAT IPs to a single\ntarget backend. The maximum time per transaction is estimated to be 100 ms.\n\nFor this example, the key values are as follows:\n\n- **Maximum time per transaction**: 100ms\n- **Number of NAT IPs**: 2\n\nIn this case, we can use the formulas in Step 4 and Step 1 to calculate the maximum number of\nNAT source ports provided and the number of TPS those source ports can support:\n\n 1. $$ 2 = \\\\lceil P / 64512 \\\\rceil $$ \n $$ 129024 = P $$\n\n The maximum number of NAT source ports provided is **129,024**.\n 2. $$ 129024 = \\\\lceil (150 + 0.100) \\\\times B \\\\rceil $$ \n $$ 129024 = \\\\lceil 150.1 \\\\times B \\\\rceil $$ \n $$ \\\\lfloor 129024 / 150.1 \\\\rfloor = B $$ \n $$ \\\\lfloor 859.587 \\\\rfloor = B $$ \n $$ 859 = B $$\n\n The max TPS is **859** with 2 NAT IPs to a single backend, assuming no connection reuse."]]