You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2019/01/25 17:05:09 UTC

[GitHub] sven-lange-last commented on a change in pull request #104: Dynamically setting the memory limit of the Nodejs VM

sven-lange-last commented on a change in pull request #104: Dynamically setting the memory limit of the Nodejs VM
URL: https://github.com/apache/incubator-openwhisk-runtime-nodejs/pull/104#discussion_r251059554
 
 

 ##########
 File path: core/nodejs10Action/init.sh
 ##########
 @@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+#
+# 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.
+#
+
+limit_in_bytes=$(cat /sys/fs/cgroup/memory/memory.limit_in_bytes)
+heap_size=128
+export NODE_OPTS="--expose-gc"
+export RESERVED_MEGABYTES=96
 
 Review comment:
   Where does this number come from? Looking into a Node.js 10 pe-warmed container:
   
   ```
   # 256 MiB limit
   root@1cbef29a259c:/nodejsAction# cat /sys/fs/cgroup/memory/memory.limit_in_bytes
   268435456
   
   # around 16 MiB current usage
   root@1cbef29a259c:/nodejsAction# cat /sys/fs/cgroup/memory/memory.usage_in_bytes
   16437248
   
   # around 23 MiB max usage
   root@1cbef29a259c:/nodejsAction# cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes
   24449024
   
   root@1cbef29a259c:/nodejsAction# cat /sys/fs/cgroup/memory/memory.stat
   cache 0
   rss 13848576
   rss_huge 0
   mapped_file 0
   dirty 0
   writeback 0
   swap 0
   pgpgin 7145
   pgpgout 3764
   pgfault 9808
   pgmajfault 0
   inactive_anon 0
   active_anon 13799424
   inactive_file 0
   active_file 0
   unevictable 0
   hierarchical_memory_limit 268435456
   hierarchical_memsw_limit 268435456
   total_cache 0
   total_rss 13848576
   total_rss_huge 0
   total_mapped_file 0
   total_dirty 0
   total_writeback 0
   total_swap 0
   total_pgpgin 7145
   total_pgpgout 3764
   total_pgfault 9808
   total_pgmajfault 0
   total_inactive_anon 0
   total_active_anon 13799424
   total_inactive_file 0
   total_active_file 0
   total_unevictable 0
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services