Java vs JS (JavaScript) vs NodeJS

yassertaeima
Participant III

If there is a specific logic to be executed and requires to be custom written (For Example, Random Number Generator).

What should be the proper place to write this logic from a performance point of view.

Java jar using JavaCallout

Javascript using JSCallout

NodeJS and calling the NodeJS proxy using a ServiceCallout

?

or at least what factors should be taken into consideration when choosing which type of Callout to implement the custom logic in.

of course this assumes that the logic and supporting libs are available in all three. taking the Random number generator example. it can be done in all three. if that's the case which one should we use if it will be used heavily?

Solved Solved
1 3 1,274
1 ACCEPTED SOLUTION

Not applicable

Please refer to this document:

https://docs.apigee.com/api-services/content/best-practices-api-proxy-design-and-development#policya...


Policy >> JavaScript callout >> Java callout >> Python callout


This section does not explicitly mention nodejs because it's not meant to implement simple callouts but more complex proxies.

https://docs.apigee.com/api-services/content/overview-nodejs-apigee-edge

View solution in original post

3 REPLIES 3

Not applicable

Please refer to this document:

https://docs.apigee.com/api-services/content/best-practices-api-proxy-design-and-development#policya...


Policy >> JavaScript callout >> Java callout >> Python callout


This section does not explicitly mention nodejs because it's not meant to implement simple callouts but more complex proxies.

https://docs.apigee.com/api-services/content/overview-nodejs-apigee-edge

Thanks @Mauricio Navarro Miranda

The document referenced is not relevent to the question. The document sets best practices once the decision is made on which one to use.

I am asking on what factors should be considered to make the decision to use Java vs JS vs NodeJS.

@Yasser Taeima I disagree. The document goes through their order, too. It mentions what @Mauricio Navarro Miranda answered. In the document, they specify to choose JS first and foremost (presumably due to readability), then java, then python.

If you're talking about performance, however, always use Java first (this would be because the jar can just be attached to the JVM at runtime and has the least impact). Then choose JS, then python last.

As Mauricio said, node is pretty slow due to having to start the server every time, you wouldn't use it for simple functionality vs the others.

Look at https://docs.apigee.com/api-platform/fundamentals/best-practices-api-proxy-design-and-development#po...