Skip to content

Observing response time differ largely for concurrent calls, for dynamodb query #347

@joyceliaoxy

Description

@joyceliaoxy
  • Async AWS SDK for Python version: 13.0.0
  • Python version: 3.10
  • Operating System: MacOS

Description

So I am writing a SDK, and use aioboto3 as the base lib of my SDK. I have a a separate class to wrapping aioboto3 session, table and resources. And another class to perform the DB method, like put_item, delete_item, get_item... So what happens is that I tried to use the SDK I created to send multiple concurrent query to dynamodb. I got response time at the client side like:

  • reqeust 1 response 100mili-sec
  • requet2 response 1000mili-sec
  • request3 response 800mili-sec
  • request4 response 1500mili-sec

What I Did

The aioboto3 session wraping code:

class DbConnection:
    def __init__(self):
        self.session = aioboto3.Session()
    async def  db_client(self):
         async with self.session.client('dynamodb', region_name='us-east-2') as client:
             return client

class DbOperation:
    async def init(self):
        self.db_client = DbConnection.db_client()
     
    async def get_item(self, id):
        query_params = xxx
        sent_time = time.perf_count()
        response = await self.db_client.query(**query_params)
        response_time = time.perf_count() - sent_time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions