Comments (5)
This is definitely an interesting problem, and it's something I want to spend more time thinking about. It makes sense to me to simply pin all the queries from a single request to one database, but I'd like to test it out and see what kind of side effects this would introduce. In the meantime, you may need to adjust your code to work around this limitation.
from django-balancer.
Thank You for this fast comment! Pinning all the queries from a single request to one DB I also find out (at least as a first thought) to be a reasonable solution.
I hope You will find some time to provide the additional router to handle the issue - I can't wait to test it!
from django-balancer.
I've finished a first pass at this feature, but I don't have an active project right now that I can do some real testing with. Can you test it out and let me know what you think?
Checkout the "feature/request-pinning" branch and set REQUEST_PINNING to True in your settings.py.
Thanks!
from django-balancer.
Since you usually want to spread the load as much as possible, I would vote against pinning within a transaction unless really needed (i.e. with writes and replication lag).
In this case I would go for a solution where you get a database from the router (i.e. db = db_for_read(Person)
) and do a young_people, old_people = young_people.using(db), old_people.using(db)
to use the same database for this specific case.
from django-balancer.
Okay, that's good to see that. I'll try to switch from pgpool to the django-router and test this update. Thanks a lot for Your time!
Of course, specifying the common db with .using in queryset is a solution that one should use for the merges. However, in my rather big project I'll have to localize all occurrences of these and switch them.
The update that bkonkle have entered handles the cases before the switch.
I'll give You the info how it works soon.
from django-balancer.
Related Issues (11)
- 'WSGIRequest' object has no attribute 'session' HOT 5
- Slave connection not present
- Django 1.8 Support HOT 1
- Add Travis & Coveralls Support
- Can't do subqueries with queries on different DBs. HOT 4
- DatabaseError: canceling statement due to conflict with recovery HOT 1
- InterfaceError: connection already closed HOT 1
- Take DB downtime into account HOT 3
- RoundRobinRouter shuffles self.pool, which is a setting. HOT 2
- Update pypi
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-balancer.