Leaving unused NodeJS API Proxies deployed

One of the unique and useful features of Apigee Edge is the ability to wrap a NodeJS application in an API Proxy. This allows developers to create event-driven server-side applications using Edge.

Antipattern

Deployment of API Proxies is the process of making them available to serve API requests. Each of the deployed API Proxies is loaded into Message Processor’s runtime memory to be able to serve the API requests for the specific API Proxy. Therefore, the runtime memory usage increases with the increase in the number of deployed API Proxies. Leaving any unused API Proxies deployed can cause unnecessary use of runtime memory.

In the case of NodeJS API Proxies, there is a further implication.

The platform launches a “Node app” for every deployed NodeJS API Proxy. A Node app is akin to a standalone node server instance on the Message Processor JVM process.

In effect, for every deployed NodeJS API Proxy, Edge launches a node server each, to process requests for the corresponding proxies. If the same NodeJS API Proxy is deployed in multiple environments, then a corresponding node app is launched for each environment. In situations where there are a lot of deployed but unused NodeJS API Proxies, multiple Node apps are launched. Unused NodeJS proxies translate to idle Node apps which consume memory and affect start up times of the application process.

Used Proxies Unused Proxies
# Proxies # Deployed Environments # nodeapps Launched # Proxies # Deployed Environments # Node apps Launched
10 dev, test, prod (3) 10x3=30 12 dev, test, prod (3) 12x3=36

In the illustration above, 36 unused nodeapps are launched, which uses up system memory and has an adverse effect on start up times of the process.

Impact

  • High memory usage and cascading effect on application’s ability to process further requests
  • Likely performance impact on the API Proxies that are actually serving traffic

Best practice

  • Undeploy any unused API Proxies
  • Use the Analytics Proxy Performance dashboard to determine which proxies are not serving traffic; undeploy the ones you don't need

Further reading