openwhisk icon indicating copy to clipboard operation
openwhisk copied to clipboard

normal nodejs response time/concurrency for hello world? [specifically for openwhisk standalone]

Open coderofsalvation opened this issue 4 years ago • 7 comments

First of all, thanks for this awesome project.

Environment details:

  • local deployment (standalone docker img: openwhisk/standalone:nightly)
  • docker 18.09.8-ce, alpine linux 3.10 on WSL, Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz

Steps to reproduce the issue:

IMAGE="${1:-openwhisk/standalone:nightly}"
$ docker run --rm -d \
  -h openwhisk --name openwhisk \
  -p 3233:3233 -p 3232:3232 \
  -v /var/run/docker.sock:/var/run/docker.sock \
 "$IMAGE" "$@"
$ docker exec openwhisk waitready
$ AUTH=$(docker exec openwhisk wsk property get --auth | awk '{ print $3 }' )
$ wsk property set --auth $AUTH --apihost http://localhost:3233

$ echo 'function main(args) {
        const name = args && args.name || "stranger";
        return { greeting: `Hello ${name}!` };
      }' > hello.js

$ wsk action create helloJS hello.js --concurrency 10
error: Unable to create action 'helloJS': The request content was malformed:
requirement failed: concurrency 10 exceeds allowed threshold of 1 (code oUwMJCOQ4NCcatFSX49kTCwaFYtxhX7D)
Run 'wsk --help' for usage.

$ wsk action create helloJS hello.js
ok: created action helloJS

$ time curl -H 'Content-Type: application/json' -X POST -u "$AUTH" http://localhost:3233/api/v1/namespaces/guest/actions/helloJS?blocking=true
{....,"response":{"result":{"greeting":"Hello ${name}!"}...}
real    0m1.031s
user    0m0.005s
sys     0m0.001s

$ time curl -H 'Content-Type: application/json' -X POST -u "$AUTH" http://localhost:3233/api/v1/namespaces/guest/actions/helloJS?blocking=true
{....,"response":{"result":{"greeting":"Hello ${name}!"}...}
real    0m0.501s
user    0m0.004s
sys     0m0.001s

Provide the expected results and outputs:

I expected the second curl response-time to be much smaller/faster.

Provide the actual results and outputs:

  • Why is concurrency limited 1 for to nodejs:10? Documentation states otherwise.
  • It seems that, the more time is in between the curl calls..the smaller/faster the responsetime is.

Given a fair amount of activations, I would expect any recurring call to be superfast:

$ wsk activation list | grep helloJS | grep warm | wc -l
27

coderofsalvation avatar Mar 19 '21 08:03 coderofsalvation

Why is concurrency limited 1 for to nodejs:10

The default is 1. You can change this for your deployment.

rabbah avatar Mar 20 '21 14:03 rabbah

The default is 1. You can change this for your deployment.

Right, so above you can see im trying to change it. How would one do that given the above standalone installation?

On Sat, Mar 20, 2021, 3:59 PM rodric rabbah @.***> wrote:

Why is concurrency limited 1 for to nodejs:10

The default is 1. You can change this for your deployment.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/apache/openwhisk/issues/5094#issuecomment-803370642, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABL6ZADLUB22G4DQ67TDFTTESZ6PANCNFSM4ZOLIQJQ .

coderofsalvation avatar Mar 20 '21 15:03 coderofsalvation

I'm also interested in a guide on how to change concurrency limits. Is this a limit on the deployment on the action? https://github.com/apache/openwhisk/blob/master/docs/concurrency.md says nothing about this. Even googling for this error leads to nowhere. I'm using a custom https://github.com/apache/openwhisk-devtools Makefile to deploy 1.0.0 openwhisk locally.

@rabbah can you share some insight please?

davidfrickert avatar Apr 03 '21 22:04 davidfrickert

@tysonnorris might be better at answering this. I can look into it otherwise.

rabbah avatar Apr 11 '21 14:04 rabbah

This should be closed as a duplicate of https://github.com/apache/openwhisk/issues/4811.

rabbah avatar Apr 11 '21 14:04 rabbah

I've modified the title to emphasize the initial spirit of my question (how to achieve this with the provided standalone docker-image). Here a bit more background:

REASON: the standalone image makes it deadsimple to try/develop openwhisk locally across teams. However, tweaking a docker-image to make it support nodejs's default concurrent behaviour is not deadsimple. So maybe in this spirit, this can also be seen as a request for a docker-flag or default nodejs concurrency for the standalone image to boost the adoption from the nodejs-community / newcomers. Otherwise it's very hard to convince nodejs-developers to choose something like OpenWhisk over OpenFaaS, when nodejs-concurrency is practically disabled by default.

coderofsalvation avatar Apr 12 '21 08:04 coderofsalvation

Thanks for clarifying the issue further 👍

rabbah avatar Apr 12 '21 11:04 rabbah