danwent / Perspectives-Server

network notary implementation for the Perspectives project
http://perspectives-project.org
GNU General Public License v3.0
50 stars 13 forks source link

In-memory caching using only python #18

Closed daveschaefer closed 11 years ago

daveschaefer commented 11 years ago

Here is a module that implements Least Recently Used caching using only python. This can be used on servers that don't have a dedicated caching system.

In my performance tests I hit the server with 200 requests per second for 60 seconds, 20 times, and averaged the results. Using --pycache vs no caching showed these improvements with a postgress database:

100% increase in average responses/requests served in 60 seconds (4,041 -> 8,094 requests server) 13% decrease in average request timeouts in 60 seconds (1715 -> 1484 timeouts) 92% decrease in average response time (546ms -> 46ms response time)

Additionally the server no longer became overwhelmed and unresponsive.