We are testing the running times of two lambda functions. They both contain exactly the same code, however, one is deployed as a container image. We are doing this to test whether there are any significant differences in running times.
The code which retrieves 550.000 rows of data from a AWS SQL database
//import * as AWS from 'aws-sdk';
const Knex = require('knex');
//AWS.config.update({ region: 'us-east-1' });
const host = //hidden;
const user = //hidden;
const password=//hidden;
const database=//hidden;
const connection = {
ssl: { rejectUnauthorized: false },
host,
user,
password,
database,
};
// createaconnection
const knex = Knex({
client:'mysql',
connection,
});
exports.handler = async () => {
try {
var limit = 550000
const res=await knex('ALM_AGGR_LQ_201231_210111_0600_A048_V3_75_GAI').select().limit(limit);
console.log("RETRIEVING: " + limit);
const response = {
statusCode: 200,
//body: JSON.stringify(res),
};
return response;
}catch(err){
console.error(err);
}
};
We have configured the both versions (script and container) to use 10240MB, however, for some reason we are noticing that the container does not utilize all its memory
Logs
Lambda (not container)
Container
Can anyone explain to us, why the container is utilizing less memory (10097MB) compared to the script version that uses the maximum memory (10240MB) which we assume is the reason that the container version takes longer to execute (83 seconds) compared to the script version (76 seconds)

