Search code examples
pythonmultithreadingwebservermultiprocessingtornado

Tornado web server and multithreading sharing issues


I have a web server based on Tornado and I'm facing with a problem related to the single core/single threaded behavior of Tornado.

From the documentation, Tornado can use all the CPU cores by running multiple processes, though they are unique different processes.

This would be totally fine for me, though I need to share a global configuration structure data between the processes as they need to be sync in real time, and the structure itself should be accessible in R/W by all of them.

What's the best situation for handling such issue? If they were different threads on a unique process it would have been easier, but Python doesn't scale on multicore environments unless they are different processes.

Many thanks in advance!


Solution

  • I think the best solution is to use any third-party key-value storage, for example Redis:

    http://redis.io/

    https://pypi.python.org/pypi/redis