style95 commented on a change in pull request #4910:
URL: https://github.com/apache/openwhisk/pull/4910#discussion_r523426422



##########
File path: docs/prewarm.md
##########
@@ -0,0 +1,106 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# runtimes
+
+the runtime is the docker image for different language, e.g. nodejs:N, 
python:N, swift:N, etc.
+
+when user invokes actions, these relative activations are run on docker 
containers which base on
+these runtime docker images.
+
+# Prewarmed container without `reactive`
+
+Prewarmed containers are created when invoker starts, they are created 
according to runtimes.json's stemCells, e.g.
+
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB"
+     }
+     ]
+}
+```
+Regarding above runtime(nodejs:10 kind + 256 MB memory), `2` prewarmed 
conatainrs will be created when invoker starts,
+and the number of prewarmed container is stable usually, when activation is 
scheduled on the prewarmed container,
+another new prewarmed container will be created at the same time, on the other 
hand, previous used prewarmed container
+is moved from `prewarmedPool` to `busyPool`.
+
+the activation will be scheduled on prewarmed container firstly, then 
subsequent activation will be scheduled on warmed containers.
+because prewarm container is already created in advance, so this can avoid 
`cold start`.
+
+# Prewarmed container with `reactive`
+
+`Adjust the prewarmed container resource dynamically` is supported by 
`reactive` configuration, e.g.
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB",
+         "reactive": {
+             "minCount": 1,
+             "maxCount": 4,
+             "ttl": "2 minutes",
+             "threshold": 1,
+             "increment": 1
+     }
+     ]
+}
+```
+`reactive` fields explanation:
+* minCount: exist at least `minCount` prewarmed containers.
+* maxCount: can't create more than `maxCount`prewarmed containers.
+* ttl: the prewarmed conainers will be deleted due to expiration, because they 
are not used in ttl time.
+* threshold and increment: these two fileds are used together to calculate the 
new created number of prewarmed containers.
+
+How to support `adjust the prewarmed container resource dynamically`
+
+* Some prewarmed containers will be deleted if they are expiration, this can 
save some memory resource.
+* Create a certain range prewarmed conainers according to the cold start in 
same kind on next schedule time, e.g.
+  - cold start number = 2, number of prewarmed container will be created = 
cold start number(2)/threshold(2) * increment(1) = 1

Review comment:
       Isn't threshold 1 in the above example?

##########
File path: docs/prewarm.md
##########
@@ -0,0 +1,106 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# runtimes
+
+the runtime is the docker image for different language, e.g. nodejs:N, 
python:N, swift:N, etc.
+
+when user invokes actions, these relative activations are run on docker 
containers which base on
+these runtime docker images.
+
+# Prewarmed container without `reactive`
+
+Prewarmed containers are created when invoker starts, they are created 
according to runtimes.json's stemCells, e.g.
+
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB"
+     }
+     ]
+}
+```
+Regarding above runtime(nodejs:10 kind + 256 MB memory), `2` prewarmed 
conatainrs will be created when invoker starts,

Review comment:
       ```suggestion
   In the above example, there is only one runtime configuration, which is 
`nodejs:10`. It has a stem cell configuration and 2 containers with 256MB 
memory for `nodejs:10` will be provisioned when an invoker starts. When an 
activation with the `nodejs:10` kind arrives, one of the prewarm containers can 
be used to alleviate a cold start. A prewarm container that is assigned to an 
action is moved to the busy pool and the invoker creates one more prewarm 
container to replenish the prewarm pool.  In this way, when no reactive 
configuration is configured, an invoker always maintains the same number of 
prewarm containers.
   
   ```

##########
File path: docs/prewarm.md
##########
@@ -0,0 +1,106 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# runtimes
+
+the runtime is the docker image for different language, e.g. nodejs:N, 
python:N, swift:N, etc.
+
+when user invokes actions, these relative activations are run on docker 
containers which base on
+these runtime docker images.
+
+# Prewarmed container without `reactive`

Review comment:
       ```suggestion
   # How prewarm containers are provisioned without a reactive configuration
   ```
   
   

##########
File path: docs/prewarm.md
##########
@@ -0,0 +1,106 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# runtimes
+
+the runtime is the docker image for different language, e.g. nodejs:N, 
python:N, swift:N, etc.
+
+when user invokes actions, these relative activations are run on docker 
containers which base on
+these runtime docker images.
+
+# Prewarmed container without `reactive`
+
+Prewarmed containers are created when invoker starts, they are created 
according to runtimes.json's stemCells, e.g.

Review comment:
       ```suggestion
   Prewarmed containers are created according to the stemcell configuration in 
the `runtime.json` file at the invoker bootup time, e.g.
   ```

##########
File path: docs/prewarm.md
##########
@@ -0,0 +1,106 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# runtimes

Review comment:
       Maybe we can skip this part as there is this part?
   
https://github.com/apache/openwhisk/blob/master/docs/actions.md#languages-and-runtimes
   
   Instead of this, we may add a section to briefly describe why we need 
prewarm containers and the effect of it.
   

##########
File path: docs/prewarm.md
##########
@@ -0,0 +1,106 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# runtimes
+
+the runtime is the docker image for different language, e.g. nodejs:N, 
python:N, swift:N, etc.
+
+when user invokes actions, these relative activations are run on docker 
containers which base on
+these runtime docker images.
+
+# Prewarmed container without `reactive`
+
+Prewarmed containers are created when invoker starts, they are created 
according to runtimes.json's stemCells, e.g.
+
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB"
+     }
+     ]
+}
+```
+Regarding above runtime(nodejs:10 kind + 256 MB memory), `2` prewarmed 
conatainrs will be created when invoker starts,
+and the number of prewarmed container is stable usually, when activation is 
scheduled on the prewarmed container,
+another new prewarmed container will be created at the same time, on the other 
hand, previous used prewarmed container
+is moved from `prewarmedPool` to `busyPool`.
+
+the activation will be scheduled on prewarmed container firstly, then 
subsequent activation will be scheduled on warmed containers.
+because prewarm container is already created in advance, so this can avoid 
`cold start`.
+
+# Prewarmed container with `reactive`

Review comment:
       ```suggestion
   # How prewarmed containers are provisioned with a reactive configuration
   ```

##########
File path: docs/prewarm.md
##########
@@ -0,0 +1,106 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# runtimes
+
+the runtime is the docker image for different language, e.g. nodejs:N, 
python:N, swift:N, etc.
+
+when user invokes actions, these relative activations are run on docker 
containers which base on
+these runtime docker images.
+
+# Prewarmed container without `reactive`
+
+Prewarmed containers are created when invoker starts, they are created 
according to runtimes.json's stemCells, e.g.
+
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB"
+     }
+     ]
+}
+```
+Regarding above runtime(nodejs:10 kind + 256 MB memory), `2` prewarmed 
conatainrs will be created when invoker starts,
+and the number of prewarmed container is stable usually, when activation is 
scheduled on the prewarmed container,
+another new prewarmed container will be created at the same time, on the other 
hand, previous used prewarmed container
+is moved from `prewarmedPool` to `busyPool`.
+
+the activation will be scheduled on prewarmed container firstly, then 
subsequent activation will be scheduled on warmed containers.
+because prewarm container is already created in advance, so this can avoid 
`cold start`.
+
+# Prewarmed container with `reactive`
+
+`Adjust the prewarmed container resource dynamically` is supported by 
`reactive` configuration, e.g.
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB",
+         "reactive": {
+             "minCount": 1,
+             "maxCount": 4,
+             "ttl": "2 minutes",
+             "threshold": 1,
+             "increment": 1
+     }
+     ]
+}
+```
+`reactive` fields explanation:

Review comment:
       ```suggestion
   In the above example, there is a reactive configuration for `nodejs:10` and 
there are 4 underlying configurations.
   
   ```

##########
File path: docs/prewarm.md
##########
@@ -0,0 +1,106 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# runtimes
+
+the runtime is the docker image for different language, e.g. nodejs:N, 
python:N, swift:N, etc.
+
+when user invokes actions, these relative activations are run on docker 
containers which base on
+these runtime docker images.
+
+# Prewarmed container without `reactive`
+
+Prewarmed containers are created when invoker starts, they are created 
according to runtimes.json's stemCells, e.g.
+
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB"
+     }
+     ]
+}
+```
+Regarding above runtime(nodejs:10 kind + 256 MB memory), `2` prewarmed 
conatainrs will be created when invoker starts,
+and the number of prewarmed container is stable usually, when activation is 
scheduled on the prewarmed container,
+another new prewarmed container will be created at the same time, on the other 
hand, previous used prewarmed container
+is moved from `prewarmedPool` to `busyPool`.
+
+the activation will be scheduled on prewarmed container firstly, then 
subsequent activation will be scheduled on warmed containers.
+because prewarm container is already created in advance, so this can avoid 
`cold start`.
+
+# Prewarmed container with `reactive`
+
+`Adjust the prewarmed container resource dynamically` is supported by 
`reactive` configuration, e.g.
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB",
+         "reactive": {
+             "minCount": 1,
+             "maxCount": 4,
+             "ttl": "2 minutes",
+             "threshold": 1,
+             "increment": 1
+     }
+     ]
+}
+```
+`reactive` fields explanation:
+* minCount: exist at least `minCount` prewarmed containers.

Review comment:
       ```suggestion
   * `minCount`: the minimum number of prewarm containers. The number of 
prewarm containers can't be fewer than this value.
   ```

##########
File path: docs/prewarm.md
##########
@@ -0,0 +1,106 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# runtimes
+
+the runtime is the docker image for different language, e.g. nodejs:N, 
python:N, swift:N, etc.
+
+when user invokes actions, these relative activations are run on docker 
containers which base on
+these runtime docker images.
+
+# Prewarmed container without `reactive`
+
+Prewarmed containers are created when invoker starts, they are created 
according to runtimes.json's stemCells, e.g.
+
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB"
+     }
+     ]
+}
+```
+Regarding above runtime(nodejs:10 kind + 256 MB memory), `2` prewarmed 
conatainrs will be created when invoker starts,
+and the number of prewarmed container is stable usually, when activation is 
scheduled on the prewarmed container,
+another new prewarmed container will be created at the same time, on the other 
hand, previous used prewarmed container
+is moved from `prewarmedPool` to `busyPool`.
+
+the activation will be scheduled on prewarmed container firstly, then 
subsequent activation will be scheduled on warmed containers.
+because prewarm container is already created in advance, so this can avoid 
`cold start`.
+
+# Prewarmed container with `reactive`
+
+`Adjust the prewarmed container resource dynamically` is supported by 
`reactive` configuration, e.g.
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB",
+         "reactive": {
+             "minCount": 1,
+             "maxCount": 4,
+             "ttl": "2 minutes",
+             "threshold": 1,
+             "increment": 1
+     }
+     ]
+}
+```
+`reactive` fields explanation:
+* minCount: exist at least `minCount` prewarmed containers.
+* maxCount: can't create more than `maxCount`prewarmed containers.
+* ttl: the prewarmed conainers will be deleted due to expiration, because they 
are not used in ttl time.

Review comment:
       ```suggestion
   * `ttl`: the amount of time that prewarm containers can exist without any 
activation. If no activation for the prewarm container arrives in the given 
time, the prewarm container will be removed.
   ```

##########
File path: docs/prewarm.md
##########
@@ -0,0 +1,106 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# runtimes
+
+the runtime is the docker image for different language, e.g. nodejs:N, 
python:N, swift:N, etc.
+
+when user invokes actions, these relative activations are run on docker 
containers which base on
+these runtime docker images.
+
+# Prewarmed container without `reactive`
+
+Prewarmed containers are created when invoker starts, they are created 
according to runtimes.json's stemCells, e.g.
+
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB"
+     }
+     ]
+}
+```
+Regarding above runtime(nodejs:10 kind + 256 MB memory), `2` prewarmed 
conatainrs will be created when invoker starts,
+and the number of prewarmed container is stable usually, when activation is 
scheduled on the prewarmed container,
+another new prewarmed container will be created at the same time, on the other 
hand, previous used prewarmed container
+is moved from `prewarmedPool` to `busyPool`.
+
+the activation will be scheduled on prewarmed container firstly, then 
subsequent activation will be scheduled on warmed containers.
+because prewarm container is already created in advance, so this can avoid 
`cold start`.
+
+# Prewarmed container with `reactive`
+
+`Adjust the prewarmed container resource dynamically` is supported by 
`reactive` configuration, e.g.

Review comment:
       ```suggestion
   With a reactive configuration, the number of prewarm containers is 
dynamically controlled, e.g.
   ```

##########
File path: docs/prewarm.md
##########
@@ -0,0 +1,106 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# runtimes
+
+the runtime is the docker image for different language, e.g. nodejs:N, 
python:N, swift:N, etc.
+
+when user invokes actions, these relative activations are run on docker 
containers which base on
+these runtime docker images.
+
+# Prewarmed container without `reactive`
+
+Prewarmed containers are created when invoker starts, they are created 
according to runtimes.json's stemCells, e.g.
+
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB"
+     }
+     ]
+}
+```
+Regarding above runtime(nodejs:10 kind + 256 MB memory), `2` prewarmed 
conatainrs will be created when invoker starts,
+and the number of prewarmed container is stable usually, when activation is 
scheduled on the prewarmed container,
+another new prewarmed container will be created at the same time, on the other 
hand, previous used prewarmed container
+is moved from `prewarmedPool` to `busyPool`.
+
+the activation will be scheduled on prewarmed container firstly, then 
subsequent activation will be scheduled on warmed containers.
+because prewarm container is already created in advance, so this can avoid 
`cold start`.
+
+# Prewarmed container with `reactive`
+
+`Adjust the prewarmed container resource dynamically` is supported by 
`reactive` configuration, e.g.
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB",
+         "reactive": {
+             "minCount": 1,
+             "maxCount": 4,
+             "ttl": "2 minutes",
+             "threshold": 1,
+             "increment": 1
+     }
+     ]
+}
+```
+`reactive` fields explanation:
+* minCount: exist at least `minCount` prewarmed containers.
+* maxCount: can't create more than `maxCount`prewarmed containers.

Review comment:
       ```suggestion
   * `maxCount`: the maximum number of prewarm containers. The number of 
prewarm containers cannot exceed this value.
   ```

##########
File path: docs/prewarm.md
##########
@@ -0,0 +1,106 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# runtimes
+
+the runtime is the docker image for different language, e.g. nodejs:N, 
python:N, swift:N, etc.
+
+when user invokes actions, these relative activations are run on docker 
containers which base on
+these runtime docker images.
+
+# Prewarmed container without `reactive`
+
+Prewarmed containers are created when invoker starts, they are created 
according to runtimes.json's stemCells, e.g.
+
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB"
+     }
+     ]
+}
+```
+Regarding above runtime(nodejs:10 kind + 256 MB memory), `2` prewarmed 
conatainrs will be created when invoker starts,
+and the number of prewarmed container is stable usually, when activation is 
scheduled on the prewarmed container,
+another new prewarmed container will be created at the same time, on the other 
hand, previous used prewarmed container
+is moved from `prewarmedPool` to `busyPool`.
+
+the activation will be scheduled on prewarmed container firstly, then 
subsequent activation will be scheduled on warmed containers.
+because prewarm container is already created in advance, so this can avoid 
`cold start`.
+
+# Prewarmed container with `reactive`
+
+`Adjust the prewarmed container resource dynamically` is supported by 
`reactive` configuration, e.g.
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB",
+         "reactive": {
+             "minCount": 1,
+             "maxCount": 4,
+             "ttl": "2 minutes",
+             "threshold": 1,
+             "increment": 1
+     }
+     ]
+}
+```
+`reactive` fields explanation:
+* minCount: exist at least `minCount` prewarmed containers.
+* maxCount: can't create more than `maxCount`prewarmed containers.
+* ttl: the prewarmed conainers will be deleted due to expiration, because they 
are not used in ttl time.
+* threshold and increment: these two fileds are used together to calculate the 
new created number of prewarmed containers.
+
+How to support `adjust the prewarmed container resource dynamically`

Review comment:
       ```suggestion
   The number of prewarmed containers is dynamically controlled when:
   * they are expired due to a TTL, some prewarmed containers are removed to 
save resources.
   * cold starts happen, some prewarm containers are created according to the 
following calculus.
      * `# of prewarm containers to be created` = `# of cold starts` / 
`threshold` * `increment`.
      * ex1) `cold start number(2)` / `threshold(2)` * `increment(1)` = 1
      * ex2) `cold start number(4)` / `threshold(2)` * `increment(1)` = 2
      * ex3) `cold start number(8)` / `threshold(2)` * `increment(1)` = 4
      * ex4) `cold start number(16)` / `threshold(2)` * `increment(1)` = 4 
(cannot exceed the maximum number)
   * no activation arrives for long time, the number of prewarm containers will 
eventually converge to `minCount`.
   
   ```
   
   
   

##########
File path: docs/prewarm.md
##########
@@ -0,0 +1,106 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# runtimes
+
+the runtime is the docker image for different language, e.g. nodejs:N, 
python:N, swift:N, etc.
+
+when user invokes actions, these relative activations are run on docker 
containers which base on
+these runtime docker images.
+
+# Prewarmed container without `reactive`
+
+Prewarmed containers are created when invoker starts, they are created 
according to runtimes.json's stemCells, e.g.
+
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB"
+     }
+     ]
+}
+```
+Regarding above runtime(nodejs:10 kind + 256 MB memory), `2` prewarmed 
conatainrs will be created when invoker starts,
+and the number of prewarmed container is stable usually, when activation is 
scheduled on the prewarmed container,
+another new prewarmed container will be created at the same time, on the other 
hand, previous used prewarmed container
+is moved from `prewarmedPool` to `busyPool`.
+
+the activation will be scheduled on prewarmed container firstly, then 
subsequent activation will be scheduled on warmed containers.
+because prewarm container is already created in advance, so this can avoid 
`cold start`.
+
+# Prewarmed container with `reactive`
+
+`Adjust the prewarmed container resource dynamically` is supported by 
`reactive` configuration, e.g.
+```
+{
+    "kind": "nodejs:10",
+    "default": true,
+    "image": {
+        "prefix": "openwhisk",
+        "name": "action-nodejs-v10",
+        "tag": "nightly"
+    },
+    "deprecated": false,
+    "attached": {
+        "attachmentName": "codefile",
+        "attachmentType": "text/plain"
+     },
+     "stemCells": [
+     {
+        "initialCount": 2,
+         "memory": "256 MB",
+         "reactive": {
+             "minCount": 1,
+             "maxCount": 4,
+             "ttl": "2 minutes",
+             "threshold": 1,
+             "increment": 1
+     }
+     ]
+}
+```
+`reactive` fields explanation:
+* minCount: exist at least `minCount` prewarmed containers.
+* maxCount: can't create more than `maxCount`prewarmed containers.
+* ttl: the prewarmed conainers will be deleted due to expiration, because they 
are not used in ttl time.
+* threshold and increment: these two fileds are used together to calculate the 
new created number of prewarmed containers.

Review comment:
       ```suggestion
   * `threshold` and `increment`: these two configurations control the number 
of new prewarm containers to be created.
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to