I created 9 python scripts that I run as cron jobs.

When I run them on a VirtualBox virtual machine running Ubuntu Server 20.04 with 512MB of RAM with a single processor, everything runs smoothly and only a reasonable amount of memory is used by each job (the virtual machine is hosted on a Windows 10 physical machine).

When I try to run the same scripts on a Raspberry Pi Zero 2 running Ubuntu Server 20.04.5 with 512MB of RAM, each job consumes a lot of memory. I was not able to run more than 3 out of the 9 jobs concurrently without the Pi becoming inaccessible by SSH because all the available memory is being consumed by the 3 jobs. CPU-wise, everything seems fine.

Is there a way to optimize python, the scripts, or the Pi to get performance similar to the ones on the virtual machine?

Any help would be greatly appreciated.

  • It is because they are running on different architecture. Feb 10, 2023 at 21:19
  • This is very possible. But is there anything I can do to optimize performance on the Raspberry Pi Zero 2 architecture other than upgrading it to a Pi 3 or 4? Feb 11, 2023 at 0:21
  • Pi zero is already very slow. Overriding is not really a good option because this chipset can't handle that much processing speed. Feb 11, 2023 at 0:23
  • Let me google that for you.
    – Seamus
    Feb 11, 2023 at 0:37
  • Maybe the only solution is to upgrade to a more powerful Pi after all. Unfortunately, they are hard to find these days. Feb 11, 2023 at 12:08


Browse other questions tagged or ask your own question.