Lambda random long execution while running QLDB query

0

I have a lambda triggered by a SQS FIFO queue when there are messages on this queue. Basically this lambda is getting the message from the queue and connecting to QLDB through a VPC endpoint in order to run a simple SELECT query and a subsequent INSERT query. The table selected by the query has a index for the field used in the where condition.

Flow (all the services are running "inside" a VPC):

SQS -> Lambda -> VPC interface endpoint -> QLDB

Query SELECT: SELECT FIELD1, FIELD2 FROM TABLE1 WHERE FIELD3 = "ABCDE"

Query INSERT: INSERT INTO TABLE1 .....

This lambda is using a shared connection/session on QLDB and this is how I'm connecting to it:

import { QldbDriver, RetryConfig } from 'amazon-qldb-driver-nodejs'

let driverQldb: QldbDriver
const ledgerName = 'MyLedger'

export function connectQLDB(): QldbDriver {
  if ( !driverQldb ) {
    const retryLimit = 4
    const retryConfig = new RetryConfig(retryLimit)
    const maxConcurrentTransactions = 1500
    driverQldb = new QldbDriver(ledgerName, {}, maxConcurrentTransactions, retryConfig)
  }
  return driverQldb
}

When I run a load test that simulates around 200 requests/messages per second to that lambda in a time interval of 15 minutes, I'm starting facing a random long execution for that lambda while running the queries on QLDB (mainly the SELECT query). Sometimes the same query retrieves data around 100ms and sometimes it takes more than 40 seconds which results in lambda timeouts. I have changed lambda timeout to 1 minute but this is not the best approch and sometimes it is not enough too.

The VPC endpoint metrics are showing around 250 active connections and 1000 new connections during this load test execution. Is there any QLDB metric that could help to identify the root cause of this behavior?

Could it be related to some QLDB limitation (like the 1500 active sessions described here: https://docs.aws.amazon.com/qldb/latest/developerguide/limits.html#limits.default) or something related to concurrency read/write iops?

1개 답변
1

Hi @thiagoscodeler,

Please check out the proposed answer on stackoverflow to this question you posted there.

https://stackoverflow.com/questions/73780825/lambda-random-long-execution-while-running-qldb-query/73816697#73816697

AWS
답변함 2년 전
  • Hi @bwinchester-aws, thank you. I'll check the stackoverflow answer.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠