f5devcentral / f5-bigip-image-generator

Generate custom images for F5 BIG-IP.
Apache License 2.0
34 stars 20 forks source link

Container requires over 55G's memory to produce final image #37

Closed ghost closed 2 years ago

ghost commented 2 years ago

Describe the bug In Azure, when running the container inside a VM provisioned with type 'Standard_D8_v3' (KVM support with 32G of memory), program exits at below with MemoryError

create blob client {'BootLocations': '1', 'BuildHost': '4fad2dbfd9c9', 'BuildSource': 'build-image', 'BuildUser': 'root', 'Modules': 'all', 'Platform': 'azure', 'ImageSize': '55GiB', 'BuildType': 'local', 'LicenseModel': 'byol', 'VersionProduct': 'BIG-IP', 'VersionVersion': '16.1.2.2', 'VersionBuild': '0.0.28', 'VersionSequence': '16.1.2.2-0.0.28.0', 'VersionBasebuild': '0.0.28', 'VersionEdition': 'Point Release 2', 'VersionDate': 'Thu Apr 7 13:32:41 PDT 2022', 'VersionBuilt': '220407133241', 'VersionChangelist': '3586715', 'VersionJobid': '1352058'}

Process Process-1: Traceback (most recent call last): File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/f5/src/lib/python/image/azure_disk.py", line 87, in upload_azure vhd_file.read(), MemoryError

Changing the instance type to 'Standard_D32_v3' (KVM support with 128G of memory) worked.

The memory it used was 55G as seen from the host VM below.

$ free -h total used free shared buff/cache available Mem: 125G 55G 9.8G 908K 60G 68G Swap: 0B 0B 0B

To Reproduce

Run build-image in a container inside an Azure VM provisioned with Standard_D8_v3 instance type.

Expected behavior Per documentation ( https://github.com/f5devcentral/f5-bigip-image-generator/#image-generator-prerequisites ) the image generator only requires 1G of memory.

Additional context Does the container indeed require over 55G of memory to produce the final result? Can this huge memory footprint be reduced?

kmaloney commented 2 years ago

I have been able to reproduce this for the Azure platform. Nominal memory usage was slightly under 3GB (exceeds current documentation) but spikes to 55GB during the upload (likely due to image size of 55GB). Other non-Azure platforms seem to peak slightly below 3GB.

This issue will be tracked internally using VECLOUD-1311.

kmaloney commented 2 years ago

Resolved in v1.19. Azure image generation memory requirements are now similar to other platforms. Increased documented memory required from 1GB to 4GB.