为什么我们不能将在父进程中初始化的cassandra会话共享给子进程(python驱动程序)? [英] Why cant we share cassandra session initialised in parent process to child process(python driver)?
问题描述
我正在开发一个多进程应用程序并使用cassandra,我在服务器的开头打开了一个会话,我想将该会话共享给其他进程.我只想知道cassandra(python司机) .如果不是,为什么?
I am developing a multi-process application and using cassandra, I have a single session opened at the begining of the server and i want to share the session to other processes.I just want to know is it possible in cassandra(python driver) . if not why ?
推荐答案
否,不建议使用.
引用正式的datastax文档:
Quoting the official datastax documentation:
确保永远不要在多个进程之间共享任何Cluster,Session或ResponseFuture对象.这些对象都应该在分叉过程之后而不是之前创建.
Be sure to never share any Cluster, Session, or ResponseFuture objects across multiple processes. These objects should all be created after forking the process, not before.
来源: https://datastax.github.io/python-driver /performance.html#multiprocessing
这篇关于为什么我们不能将在父进程中初始化的cassandra会话共享给子进程(python驱动程序)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!