Handling transaction log directory in AWS Lambda #1760
Replies: 3 comments 1 reply
-
When you say high volume, how high of a volume of writes coming in and are they little writes? I have trigger a number of Lambdas to perform various tasks, but I do route everything through SQS by default, which leads to my Lambdas being triggered with batches of writes to execute. I'm guessing you're also seeing a slow down because Lambda invocations are competing for dynamodb locks? |
Beta Was this translation helpful? Give feedback.
-
I use Kinesis streams for controlling my batches, and the write volume for each batch is approximately 1.5 MB (for 150 events). Additionally, 40 instances of my Lambdas are running concurrently, and I don't observe any significant idle time for acquiring locks. In fact, when my Lambda starts writing to an empty table, it works perfectly and is very fast. However, over time, the writing process becomes slower, which is due to the accumulation of extensive logs for transactions. So, if I compact the table and then vacuum it, and after a checkpoint, delete all transaction logs, the writing speed in Lambdas increases again. |
Beta Was this translation helpful? Give feedback.
-
@alisheykhi are checkpoints being created by every Lambda after they write, or only by one, or something different? I would also be curious to know how large those checkpoint files are during normal operations? I'm wondering if the checkpoint files are potentially becoming very large or if they're itty bitty and therefore not serving much of an optimization since so many new commits are coming into the table |
Beta Was this translation helpful? Give feedback.
-
When using the Python library in a Lambda function, the high volume of transaction logs causes a significant exponential decrease in writing speed to the table (S3). To address this issue, I used the
create_checkpoint
function after each batch, which improved the speed. However, a new problem has arisen due to the proliferation of checkpoint files, leading to exponential growth in the directory's size. Furthermore, usingcompact
andvacuum
with each batch does not appear to be a practical solution. Additionally, while thevacuum
function helps reduce the number of files in the data directory, it does not clean up the log directory. so I implemented a custom function for deleting expired checkpoints and logs!My question is, what is the best practice for this purpose?
Beta Was this translation helpful? Give feedback.
All reactions