GithubHelp home page GithubHelp logo

lock performance about cashews HOT 4 CLOSED

krukov avatar krukov commented on May 27, 2024
lock performance

from cashews.

Comments (4)

Krukov avatar Krukov commented on May 27, 2024

Huge Thanks for sharing it.

I found the problem, is_locked function reserved a connection. So 100 concurrent is_locked coroutines blocking other operations including release lock (unlock)

Also locking without timeout (ttl=None) was unexpected - in this case if lock did not acquire it will raise an exception without waiting for lock release.

Fixed in 5.3.1

I saw your libraries for cache too, rust based memory storage is impressive, do you mind if I decided to use it too as an alternative backend ?

And also could you please share your results of benchmarks or share the repo with code?

from cashews.

Yiling-J avatar Yiling-J commented on May 27, 2024

Great, then I can continue my benchmarks. Feel free to use Theine as your backend, my Cacheme is doing the same.

I'm still refactoring my Cacheme, this is the results currently:

https://github.com/Yiling-J/cacheme/blob/refactor/reduce_overhead/benchmarks/trace.py

Redis GET means how many redis get command encountered and Load Hits is how many times the slow load function called.
totaly 200k requests and use a zipf generator to generate numbers. Aiocache-2 is aiocache_stampede decorator and cashews-2 is lock=True

1k concurrency

Time Redis GET Load Hits
Cacheme 30 s 166454 55579
Aiocache 46 s 200000 56367
Aiocache-2 63 s 256492 55417
Cashews 51 s 200000 56920
cashews-2 x x x

100k concurrency

Time Redis GET Load Hits
Cacheme 30 s 60990 56782
Aiocache 80 s 200000 125085
Aiocache-2 178 s 326417 65598
Cashews 88 s 200000 87894
cashews-2 x x x

from cashews.

Yiling-J avatar Yiling-J commented on May 27, 2024

fix confirmed, this is the result for locked cashews:
1k: redis count 200000, load count 55425, spent 137.26466012001038s
100k: redis count 200000, load count 55348, spent 236.61019372940063s

from cashews.

Krukov avatar Krukov commented on May 27, 2024

Thanks for sharing

from cashews.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.