Skip to content

pipelining with python client #2825

Answered by shohamazon
romange asked this question in Q&A
Discussion options

You must be logged in to vote

Hello 🙂 ,

For now, there are two possible solutions to achieve batch operations:

  1. mset:
data = {f"key{i}": "1" for i in range(100000)}
await client.mset(data)
  1. asyncio.gather: This method allows you to run tasks concurrently.
    However, please note that while tasks are executed concurrently, they are not guaranteed to be scheduled or executed in a specific order.
data = {f"key{i}": "1" for i in range(100000)}
tasks = [client.set(key, value) for key, value in data.items()]
await asyncio.gather(*tasks)

We're working on adding support for pipelines in Glide.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by asafpamzn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants