apache / openwhisk-deploy-kube

The Apache OpenWhisk Kubernetes Deployment repository supports deploying the Apache OpenWhisk system on Kubernetes and OpenShift clusters.
https://openwhisk.apache.org/
Apache License 2.0
296 stars 228 forks source link

How to correctly configure the concurrency of a single function in K8s deploy? #763

Open QWQyyy opened 1 year ago

QWQyyy commented 1 year ago

@dgrove-oss Hello boss, I am currently facing the problem of configuring the concurrency of Action. I set up the NodeJS runtime environment and configured it in value.yaml according to the concurrency configuration given in the OpenWhisk project documentation, but the result is still very unsatisfactory. My hardware environment is 3 nodes with 32GB, two of which are configured with Invoker stains, I configure the container pool to be 48GB, and the scheduler, Invoker, and controller are all configured with 4GB JVM. Still, the concurrency I'm currently achieving is poor. I created a simple nodejs:16 Action that reads the redis cluster, configured memory usage as 64MB, and preheated 100 containers. I only have one invoke, controller, and scheduler. I used the K6 stress testing tool to test web Actions, and the results showed that when the concurrency was configured as 128 and 64, the concurrency of 64 achieved better results, and a maximum of 200 actions were executed per second, which seemed to be concurrent Action does not bring stronger TPS indicators.

values.yaml config: image image image

My nodejs Action code and config:

const Redis = require('ioredis');
const redis = new Redis.Cluster([
  {
    host: '192.168.1.21',
    port: 6001
  },
  {
    host: '192.168.1.22',
    port: 6001
  },
  {
    host: '192.168.1.23',
    port: 6001
  }
]);

function readfunc(params) {
    key = params.key;
    // redis.set('key', key);
    for(var  i = 1 ; i <= 100; ++i){
        redis.get(key, (err, value) => {
            if (err) throw err;
            console.log(value);
        });
    }

    return {msg: 'ok'}
}

exports.main = readfunc;
wsk -i action update wsk-read wsk-read.zip --kind nodejs:16 --web true -c 32

We can share you ours test result: image

Could you give ours some suggestion to improve function concurrency? Thank you!