Comments (8)
I just confirmed restarting UWSGI indeed killed the connections and Redis connections fell to < 20.
from django-redis.
Hi @miohtama
Can you provide more details like, versions, uwsgi start params, how you obtain a cache instance?
Also, if you are using the last django-redis version (3.6.x) , try with same environment but downgrading django-redis to 3.5.2. In 3.6.x branch new connection management is introduced and can contain some regressions in this part. Tomorrow I'll try reproduce this behavior and fix it.
Thanks for report this error.
from django-redis.
Thanks. I'll try to diagnose the problem further tonight.
Here is already some further information:
- If I set max_connections in CACHES settings, django-redis will hit this settings quite fast, starting to give out errors
-> It is not properly reusing the connection
-> Maybe there is something in UWSGI or the application which prevents the connection reusing
from django-redis.
Try disable threads on uwsgi, the default connection pool seems not thread
safe.
Andrey.
Sent from my Nexus 4
On Apr 24, 2014 9:11 AM, "Mikko Ohtamaa" [email protected] wrote:
Thanks. I'll try to diagnose the problem further tonight.
Here is already some further information:
- If I set max_connections in CACHES settings, django-redis will hit
this settings quite fast, starting to give out errors-> It is not properly reusing the connection
-> Maybe there is something in UWSGI or the application which prevents the
connection reusing—
Reply to this email directly or view it on GitHubhttps://github.com//issues/76#issuecomment-41248890
.
from django-redis.
Hi again!
I have created test project, with simple view, that obtains a value from cache and increments it and sets the value. Additionally returns a value in a response.
from django.core.cache import cache
def handler1(request):
value = cache.get("foo1", 1)
value = value + 1
cache.set("foo1", value, timeout=None)
return HttpResponse("Hello World {}".format(value))
I have started uwsgi with threads and processes, and with last version of django-redis (3.6.1) with default configuration.
This is a uwsgi start command that I have used:
uwsgi -H /home/niwi/.virtualenvs/djredis-pool --http-socket 127.0.0.1:8080 --wsgi-file redis_pool/wsgi.py --master --processes 4 --threads 4
This is a command used for obtain a number of connections:
redis-cli info |grep connected_clients
And I have used ab
tool for simulate multiple concurrent access to the url: ab -n 9000 -c 100 http://127.0.0.1:8080/handler1
The results are as expected: in high load, with 4 threads and 4 processes, I found 16 open connections in the pool.
At this momment I need much more information like python environment versions (result from pip freeze
) , python version, uwsgi version, and cache instance usage examples for try reproduce the error. Because, with small load tests and default config using django 1.6 and uwsgi the last current version, the connection management seems working properly.
from django-redis.
I think I located whas was special in this configuration: it is using Redis pubsub, using the client connection pool from django-redis (cache.raw_client
). Apparently the issue might be little bit deeper in redis-py, outside django-redis scope.
However when I get at the bottom of it, I'll drop few warning words on the documentation.
from django-redis.
And thanks for the all help!
from django-redis.
No, thanks you for investigate! ;)
from django-redis.
Related Issues (20)
- object attribute is missing after manager.py is restarted when using django redis cache HOT 1
- Why do we use `param["url"]` as a unique connection pool key? HOT 5
- Connection Pooling doesn't work as intended HOT 1
- Pytest 7.0 compatibility HOT 1
- Drop django 4.0
- Drop support for django 3.2 HOT 1
- How to configure and connect redis cluster correctly? HOT 2
- Django `TIMEOUT` setting not working as expected HOT 2
- Which timezone wil it take? system timezone or django timezone HOT 1
- Why Django Redis does not raise exception while connecting to Redis Server with SSL param equal string "False"
- `Expire` method fails when using `DEFAULT_TIMEOUT` HOT 1
- Getting/Setting occasionally extremely slow HOT 5
- django requirements update
- Add NX, XX, GT and LT to expire and pexpire HOT 2
- Multiple redis caches with fallback mechanism HOT 1
- Is it necessary to get coverage of tests directory? HOT 2
- Implementing HGET
- using redis in django getting connection error HOT 1
- strict_map_key
- Connection refused on Celery health checks HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-redis.