apache / openwhisk-wskdeploy

Apache OpenWhisk utility for deploying and managing OpenWhisk projects and packages
https://openwhisk.apache.org/
Apache License 2.0
77 stars 74 forks source link

Each sequance invocation is suffer from cold start #1143

Closed GitHubDiom closed 3 years ago

GitHubDiom commented 3 years ago

Hi there,

I am trying to develop an application by using wskdeploy.

I created a sequence invocation following the example in the project, functions in the sequence invocation are run in custom run-time (that is, python-io:3, modified by original run-time python:3).

When I invoke the sequence repeatedly, I found that the sub-functions are suffered from a cold start.

This affects the execution time of the sequence.

For example, the duration of the sequence is about 3s, but each sub-function does everything at the millisecond level (75ms, 91ms, and etc.).

Why do sequentially run functions suffer from cold starts?

Datetime            Activation ID                    Kind        Start Duration   Status  Entity
2021-08-29 16:47:49 3d16b547bc4e4f0a96b547bc4eaf0a7c python-io:3 cold  75ms       success guest/generate_pagraph:0.0.2
2021-08-29 16:47:49 e581a60959ef417e81a60959ef317ebd python-io:3 cold  91ms       success guest/generate_sentence:0.0.2
2021-08-29 16:47:48 f177744c6b8b4c29b7744c6b8b0c2963 python-io:3 cold  90ms       success guest/generate_word:0.0.2
2021-08-29 16:47:47 25e234c3da144a68a234c3da14ba685d sequence    warm  2.835s     success guest/concat_pagraph:0.0.2
2021-08-29 16:47:42 e4093fa1db5e4e6b893fa1db5e1e6b7a python-io:3 cold  77ms       success guest/generate_pagraph:0.0.2
2021-08-29 16:47:41 5a0b5a05243246558b5a052432c655a4 python-io:3 cold  75ms       success guest/generate_sentence:0.0.2
2021-08-29 16:47:40 b7fe5ad559744a54be5ad55974da5410 python-io:3 cold  92ms       success guest/generate_word:0.0.2
2021-08-29 16:47:39 d646342a55264de886342a55263de86e sequence    warm  3.059s     success guest/concat_pagraph:0.0.2

Thank you

mrutkows commented 3 years ago

Hi there,

I am trying to develop an application by using wskdeploy.

I created a sequence invocation following the example in the project, functions in the sequence invocation are run in custom run-time (that is, python-io:3, modified by original run-time python:3).

When I invoke the sequence repeatedly, I found that the sub-functions are suffered from a cold start.

This affects the execution time of the sequence.

For example, the duration of the sequence is about 3s, but each sub-function does everything at the millisecond level (75ms, 91ms, and etc.).

Why do sequentially run functions suffer from cold starts?

Datetime            Activation ID                    Kind        Start Duration   Status  Entity
2021-08-29 16:47:49 3d16b547bc4e4f0a96b547bc4eaf0a7c python-io:3 cold  75ms       success guest/generate_pagraph:0.0.2
2021-08-29 16:47:49 e581a60959ef417e81a60959ef317ebd python-io:3 cold  91ms       success guest/generate_sentence:0.0.2
2021-08-29 16:47:48 f177744c6b8b4c29b7744c6b8b0c2963 python-io:3 cold  90ms       success guest/generate_word:0.0.2
2021-08-29 16:47:47 25e234c3da144a68a234c3da14ba685d sequence    warm  2.835s     success guest/concat_pagraph:0.0.2
2021-08-29 16:47:42 e4093fa1db5e4e6b893fa1db5e1e6b7a python-io:3 cold  77ms       success guest/generate_pagraph:0.0.2
2021-08-29 16:47:41 5a0b5a05243246558b5a052432c655a4 python-io:3 cold  75ms       success guest/generate_sentence:0.0.2
2021-08-29 16:47:40 b7fe5ad559744a54be5ad55974da5410 python-io:3 cold  92ms       success guest/generate_word:0.0.2
2021-08-29 16:47:39 d646342a55264de886342a55263de86e sequence    warm  3.059s     success guest/concat_pagraph:0.0.2

Thank you

Hi @GitHubDiom, Please note that the whisk deploy tool has not control over cold/warm start times of functions; it is simply a deploy/undeploy tool. I would recommend this issue be moved to the main openwhisk repo. and discussed as a backend issue. Perhaps it is a problem with reusing warm action from the same sequence (scheduling)?