network programming - Synchronising across networked python apps -


i hoping isn't vague question...

i writing python app have multiple instances of allow load balancing , redundancy take place.

each instance need able read , write backend database, raises issue of 2 'gateways' trying update same item.

can recommend approach (not looking code solution) this?

thank in advance ;)

you have 2 ways avoid loosing consistency on data set:

  • either use lock mechanisms between python processes,
  • or use transactions when accessing database.

lock mechanisms must based on inter-process communications. depending on underlying operating system, may have access shared memory (think test-and-set primitive, use shared memory such goal), semaphores , others tools. see python ipc, instance: https://docs.python.org/2/library/ipc.html

transactions depend on database. instance, traditional sql database, can configure behaviours according needs: auto-commit, optimistic concurrency, etc...


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -