upstash / redis-py

HTTP based Python Redis Client for Serverless and Edge Functions
https://docs.upstash.com/redis
MIT License
29 stars 3 forks source link

Add pipeline and transaction #47

Closed CahidArda closed 4 months ago

CahidArda commented 4 months ago

Adding pipeline and transaction feature as described in #45.

Majority of the update is complete. Next steps:

linear[bot] commented 4 months ago

DX-882 Add transactions and pipeline support to Python SDK

CahidArda commented 4 months ago

to benchmark the pipeline, I tried sending 100 incrby commands back to back

Code Pure redis: ```py t1 = time.time() iter_count = 100 for i in range(iter_count): redis.incrby("marine", 10) val = redis.get("marine") assert val == str(iter_count*10) t2 = time.time() print(t2-t1) ``` Pipeline: ```py import time t1 = time.time() iter_count = 100 with redis.multi() as pipeline: for i in range(iter_count): pipeline.incrby("marine", 10) val = redis.get("marine") assert val == str(iter_count*10) t2 = time.time() print(t2-t1) ```
Runtimes: Normal Pipeline Transcation
5.28 s 0.31 s 0.34 s