DynamoDbBackUp icon indicating copy to clipboard operation
DynamoDbBackUp copied to clipboard

Memory leak

Open luispabon opened this issue 8 years ago • 4 comments

We're currently considering this for backing up our DynamoDB tables and we've observed a memory leak.

We've mounted the app in a docker container then deployed into a Kubernetes cluster on AWS:

image

This is after backing up around 200K records into S3 on a full backup.

Our backups never finish as the process ends up exceeding available capacity (max 1.5 GB RAM) at 800K records and they get killed.

Also, the process slows down as memory consumption rises.

luispabon avatar Oct 27 '16 09:10 luispabon

Are you using the lambda-stream-workflow or are you talking from the "backup-full" option?!

snakelab avatar Dec 02 '16 13:12 snakelab

backup-full

luispabon avatar Dec 02 '16 13:12 luispabon

#!/usr/bin/env bash

# Check we have all we need on the environment
if [[ ! "$APP_S3_BUCKET" ]]; then
    printf "\n ** Please provide with APP_S3_BUCKET"
    exit 1
fi

if [[ ! "$APP_TABLE_NAME" ]]; then
    printf "\n ** Please provide with APP_TABLE_NAME"
    exit 1
fi

if [[ ! "$APP_S3_PREFIX" ]]; then
    printf "\n ** Please provide with APP_S3_PREFIX"
    exit 1
fi

if [[ ! "$APP_S3_REGION" ]]; then
    printf "\n ** Please provide with APP_S3_REGION"
    exit 1
fi

if [[ ! "$APP_DB_REGION" ]]; then
    printf "\n ** Please provide with APP_DB_REGION"
    exit 1
fi

# Run backup
node_modules/.bin/gulp backup-full \
    --s3bucket ${APP_S3_BUCKET} \
    --s3prefix ${APP_S3_PREFIX} \
    --s3region ${APP_S3_REGION} \
    --dbtable ${APP_TABLE_NAME} \
    --dbregion ${APP_DB_REGION}

# Capture success/error status and write status file
RV=$?
STATUS_FILE=/tmp/dynamodb_backup_status.$$
if [ "${RV}" -eq "0" ]; then
  echo "OK" > ${STATUS_FILE}
else
  echo "BAD" > ${STATUS_FILE}
fi
aws s3 cp ${STATUS_FILE} s3://${APP_S3_BUCKET}/status/${APP_TABLE_NAME}/status

exit $RV

luispabon avatar Dec 02 '16 13:12 luispabon

Thanks for quick reply. As far as i see the code there should not be a problem using it with a lambda function working on a smaller amount of data...

snakelab avatar Dec 06 '16 08:12 snakelab