How to enable multithreading in RASA

Hey,

Can anyone help me with how can we enable multithread with Rasa, currently only one single session seems to work for me. I want to open multiple Chats at the same time and that should not affect the other chats, is this possible in Rasa.

Thanks, Pausali

I want to open multiple Chats at the same time

Can you please clarify on that?

Rasa uses sanic an async server which can process other tasks while the current task is blocked (e.g. due to IO). Threads wouldn’t help you a lot due the Python GIL. You could use multiple Sanic workers, but then you’d need to implement a process safe LockStore

Hi Tobias,

i would like to open multiple chats for different user for testing the bot, i am new to this technology, can you help me with a document or link where i can configure the same.

The Python Global Interpreter Lock or GIL, in simple words, is a mutex (or a lock) that allows only one thread to hold the control of the Python interpreter. All the GIL does is make sure only one thread is executing Python code at a time; control still switches between threads. What the GIL prevents then, is making use of more than one CPU core or separate CPUs to run threads in parallel.

Python threading is great for creating a responsive GUI, or for handling multiple short web requests where I/O is the bottleneck more than the Python code. It is not suitable for parallelizing computationally intensive Python code, stick to the multiprocessing module for such tasks or delegate to a dedicated external library. For actual parallelization in Python, you should use the multiprocessing module to fork multiple processes that execute in parallel (due to the global interpreter lock, Python threads provide interleaving, but they are in fact executed serially, not in parallel, and are only useful when interleaving I/O operations). However, threading is still an appropriate model if you want to run multiple I/O-bound tasks simultaneously.

Hi,

Do you have any demo chatbot or any video where i can refer to this, if yes please do share with me.