I am writing some new code and I am experimenting with PHP and Python. The script will be connecting to a MongoDB instance and running a few core functions such as playing messages, playing MusicOnHold and voicemail. I noticed that every time I invoke an AGI and keep the call up, regardless of the language (PHP or Python) once I load the modules needed for my code, each agi uses 20-30 megs. This is sort of OK till there is a rush of calls. I am wondering if there is any other language that will offer a lower memory foot print such as
node.js
Go
Ruby
Perl
Has anyone dealt with any of these and Asterisk agi’s in which would have the lowest memory footprint?
C (or any compiled language) eliminates dragging an interpreter into memory and parsing the scripting language source (Perl, PHP, Python) and will have the smallest memory footprint.
Just for fun, in one terminal I started a new Python session:
ldo@theon:seaskirt> python3
Python 3.11.4 (main, Jun 7 2023, 10:13:09) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Lower-level languages are always going to be more “efficient” than higher-level ones, aren’t they. Your C code likely looks bloated compared to something written in assembly language, for example.
But how much code are you going to have to add to handle
I see your PDP-11 and raise you a PDP-8. Or better still, a Motorola 6800D2 kit with 384 bytes of RAM, programmed via a hex keypad. Or a TI-58C calculator with a maximum of 480 program steps or 60 memory registers, but not both at once.
But those who are not into techno-chest-beating might be interesting in seeing where some of the memory goes. I did a more detailed monitoring of the RAM usage of a Python process as it loads various modules needed by Seaskirt, ending with Seaskirt itself. Here are some of the points at which significant (> 1MiB) additional memory was needed: