I feel it would be more productive to let databases handle any shared state and only write my own code that uses local state. If the databases are falling short I am sure they will catch up in a hurry, and will do a better job than I will have time for.
Many languages/standard libraries offer some kind of concurrent map that might be worth considering depending on context, sync.Map in Golang for example.