How to achieve thread safety for applications deployed in Kubernetes clusters?

2/18/2021

My databases (mongodb and mysql) are declared as StatefulSet in yaml files. Backend framework is django. If I define functions that perform write operations (edit or delete) as async, it gonna be thread safe, right? Should I use locks or mutexes?

-- Milo Lu
kubernetes
mongodb
multithreading
mysql
statefulset

1 Answer

2/18/2021

The same way you would do it anywhere else. MySQL offers many flavors and modes of transactional safety, which you use depends on your data structures and needs. Mongo is a little less complex but offers plenty of at least hypothetically transactional options.

-- coderanger
Source: StackOverflow