Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Horizontally scale Django Application with single Database server

I have a Python/Django Application where we want to horizontal scale based on load. Once scaled up, we will have multiple Django servers (running on different VMs) and single postgreSQL server.

How should the transaction management take place between these servers who don't share any state/information between them?

Should we explicitly take a lock on the row/table etc when we want to commit a transaction?

like image 440
Cheezo Avatar asked May 19 '26 20:05

Cheezo


1 Answers

How should the transaction management take place between these servers who don't share any state/information between them?

That's what your database already does for you.

Should we explicitly take a lock on the row/table etc when we want to commit a transaction?

Why? Your database already does this for you.

Just use the ordinary Django transaction features.

https://docs.djangoproject.com/en/1.3/topics/db/transactions/

A single database is already the simplest horizontally scalable solution. Nothing more to worry about.

like image 125
S.Lott Avatar answered May 21 '26 10:05

S.Lott



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!