What's a low overhead language for linux with MySQL support?
<p>An Asterisk server needs to run an external script (an "AGI" if you must know) that queries a MySQL database. This script will run often, probably around 50-100 times per minute, and it doesn't do much (about 10-15 SELECTS, some calculations on the results and echos the result back to Asterisk).</p>

<p>If the script is a PHP shell script, during load testing it uses a lot of CPU (presumably as it loads the entire php library in and out every time it runs).</p>

<p>On the other hand if the script is a bash shell script, it takes a long time to run because bash can't (easily) maintain a single MySQL connection and doing 10-15 connections/disconnections to a remote server with SSL negotiation takes a few tenths of a second each so the script as a whole can take 3-4 seconds as a result.</p>

<p>What are some better choices of language for this task? Something with low overhead, but with easy MySQL support, preferably interpreted rather than compiled.</p>