Persistent Cluster and Session connection

53 views
Skip to first unread message

Chuan Miao

unread,
Apr 20, 2016, 11:47:18 AM4/20/16
to DataStax Python Driver for Apache Cassandra User Mailing List
I build a application using the python driver, and want the database connection persistent.

The discussion in a previous mail is very interesting, where it is suggested to use gunicorn to keep the cassandra session alive and reuse it. But from the four-simple-rule blog post, it is recommended that, only one connection should be used per cluster per application.

Does it mean that I should not use more than one pre-fork worker in gunicorn?

In that case, what is the benefit of gunicorn over multiprocessing module?

Chuan

Adam Holmberg

unread,
Apr 20, 2016, 12:17:28 PM4/20/16
to python-dr...@lists.datastax.com
"one per application" should be translated to "one per process" in this context. You can use as many workers as your application warrants. The main point from the earlier thread is that the cluster and sessions should be connected post-fork in whatever framework you choose.

Use long-lived workers, create sessions post fork, and keep them alive for the lifetime of the worker.

Regards,
Adam Holmberg

--
You received this message because you are subscribed to the Google Groups "DataStax Python Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-u...@lists.datastax.com.

Chuan Miao

unread,
Apr 20, 2016, 12:46:37 PM4/20/16
to DataStax Python Driver for Apache Cassandra User Mailing List
Thanks for the reply.  'one per process' makes more sense.

Regards,
Chuan
To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-user+unsub...@lists.datastax.com.

Reply all
Reply to author
Forward
0 new messages