Skip to content
Snippets Groups Projects
Commit c0a40a77 authored by Antoine Schildknecht's avatar Antoine Schildknecht
Browse files

Fix recommended heap size check | refs #33160

parent 9b003cd4
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,6 @@ from pathlib import Path
import re
import subprocess # nosec: B404
import sys
import psutil
from defusedxml.ElementTree import parse
from psutil import net_connections
......@@ -23,6 +22,7 @@ from utilities import logging as lg # noqa: E402
LATEST_VERSION = "4.8.5"
WOWZA_TUNE_FILE = "/usr/local/WowzaStreamingEngine/conf/Tune.xml"
WOWZA_RECOMMENDED_HEAP_SIZE = 2000
def main():
......@@ -141,28 +141,16 @@ def check_heap_size() -> tuple:
warnings = 0
errors = 0
# Current total RAM extraction (in MB)
svmem = psutil.virtual_memory()
total_ram = round(svmem.total / 1024 / 1024)
# Configuration of the recommended wowza heap size regarding available RAM
if total_ram >= 15000:
recommended_heap_size = 8000
elif total_ram >= 7000:
recommended_heap_size = 4000
else:
recommended_heap_size = 2000
# Configured wowza heap size extraction
tune_xml = etree.parse(WOWZA_TUNE_FILE)
heap_size = tune_xml.find('Tune/HeapSize').text[0:-1]
if int(heap_size) < recommended_heap_size:
lg.warning(
if int(heap_size) < WOWZA_RECOMMENDED_HEAP_SIZE:
lg.error(
"not using recommended heap size: {0}M < {1}M (recommended)"
.format(int(heap_size), recommended_heap_size)
)
warnings += 1
errors += 1
else:
lg.success(
"using recommended heap size or above: {0}M"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment