Python tutorial - IT technology blog

redis-py活用ガイド:Caching、Pipeline、Distributed LockでPythonアプリのパフォーマンスを最適化する

redis-pyはPythonアプリを高速化する3つの実践的なテクニックを提供する:cache-aside patternによる無駄なデータベースクエリの回避、コマンドをbatchにまとめてネットワークのround-tripを8〜12分の1に削減するpipeline、そして複数のworkerが並列実行する際のrace conditionを防ぐdistributed lock。各テクニックを実際のコード例とRedis組み込みstatsを使ったパフォーマンス計測方法とともに解説する。