skip to Main Content

I have an Application deployed in ECS, which query Dynamodb on the status column using GSI and perform some computations and update the status.

My problem is quering the GSI in pagination takes a long time, I want to scale application horizontally i.e increase the desired count from 1 to 5. Which will launch 5 ecs task of the same application. Doing this makes it difficult to query.

One approach I can think about is adding a sort key to gsi and adding values like 1,2,3,4,5 and then the task definition 1 will query on records with sort key 1 and so on. But the problem here is I cannot think of a query that will achieve the same.

Need help to get thing working. I am doing this in java

2

Answers


  1. A Query operation will do that no problem.

    SELECT * FROM mytable.mygsi WHERE gsipk='ACTIVE' AND gsisk=1

    SELECT * FROM mytable.mygsi WHERE gsipk='ACTIVE' AND gsisk=2

    SELECT * FROM mytable.mygsi WHERE gsipk='ACTIVE' AND gsisk=N

    Login or Signup to reply.
  2. Continuously querying the DDB like that seems like a waste of money to me.

    Especially if you’re just basically trying to get a count of ACTIVE items.

    It would probably be more cost effective to enable DDB streams + Lambda to pre-calculate that aggregation as outlined in the documentation

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search