How to configure the number of workers started when deploying a standalone NodeJS proxy?

Not applicable

We are trying to deploy a standalone NodeJS application. For very specific reasons, the application is using NodeJS based in-memory DB (https://www.npmjs.com/package/node-json-db).

Problem

  • This particular module has issues working in cluster/worker model.
  • When we deploy the code on Apigee, the logs show for workers get initiated by default.

Question:

  • Is there a way, for a particular NodeJS deployment, we can configure the number of workers?
  • We would like to set (only for this proxy), in a single worker model.

I have attached a screencap of the NodeJS logs for reference

5616-logs.png

Thank You.

1 1 237
1 REPLY 1

No, you cannot specify that. The number of workers running nodejs is set by the degree of parallelism in the message processors, and that is not something that is exposed to you as an API Proxy designer.

If you'd prefer to have control over the number of nodes, then I suggest using something to host nodejs directly, like Google App Engine with the flex engine.

A second advantage of going with GAE is that you get to specify the version of node, up to v6 or even 8 if you like. Whereas with nodejs you get trireme and node v0.10.32 .

There are of course other nodejs hosting options out there.

In the future, Apigee will look to expand and enhance the capabilities around bundling logic (like nodejs logic) into API Proxy definitions, and deploying the lot as one unit. Nothing to announce right now, but stay tuned.