I have a multi-tenant SaaS. I am planning on creating a cassandra user and keyspace per-tenant for security reasons.If one Session is not an option what are my alternatives?
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.
Would it be possible to add java driver configuration API to allow the per-session thread pool size to be controlled/managed?
On Wed, Feb 5, 2014 at 11:23 AM, Scott Lewis <scott...@gmail.com> wrote:
Would it be possible to add java driver configuration API to allow the per-session thread pool size to be controlled/managed?
Would you mind explaining a bit how do you think this change things?
As far as I can tell this would make the configuration phase more complicated.
Also the management of threadswould become quite complicated too, as you'd not only have to deal with it at the session level, butalso across all session to make sure you are not overwhelming the client.
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.
<stuff deleted>
So we both agree about the added complexity.
What are the advantages? Considering you can already tune these at the cluster level
and that having hundreds of keyspaces is not really a use case Cassandra isoptimizing for,
why would we want a more complicated API and thread management?
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-user+unsubscribe@lists.datastax.com.
Ok, it doesn't seem that what you're talking about is all that linked to the initial subject and I think I'm slightly confused on what you are asking about/suggesting now. But since you're talking about threads,
what I can tell about that is that there the number of session do not directly influence the number of threads in the sense that there is no per-session dedicated threads. This is a number of Netty worker threads and the driver has a few internal ExecutorService so it can do its work (creating connections and host pools, attempt reconnections, ...) without blocking other stuffs, but all of those are shared by all sessions and don't grow with more sessions.
I created 100 sessions (one session per keyspace); and they are alive till the life of App....stuff deleted...
4. I see 100s of worker threads (Thread [Cassandra Java Driver worker-38]) created and destroyed ..
...stuff deleted....
[Scott] And my original question was whether configuration could be added (or already exists) to reduce/manage/control the '100s of worker threads' associated with 100 sessions. Perhaps this can be done right now with netty configuration (since it seems netty is being used)...but that's what I don't know.
On Fri, Feb 7, 2014 at 5:35 PM, Scott Lewis <scott...@gmail.com> wrote:
I created 100 sessions (one session per keyspace); and they are alive till the life of App....stuff deleted...
4. I see 100s of worker threads (Thread [Cassandra Java Driver worker-38]) created and destroyed ..
...stuff deleted....
[Scott] And my original question was whether configuration could be added (or already exists) to reduce/manage/control the '100s of worker threads' associated with 100 sessions. Perhaps this can be done right now with netty configuration (since it seems netty is being used)...but that's what I don't know.
I see. As as said, that part is not really a problem. Those 'Java Driver worker' thread are not the Netty workers actually, but they are still not per-session. They are just thread created through an ExecutorService that the Cluster instance uses to do works it doesn't work to block on. Such work include creating per-host connection pools when a new host is added, or when a Session is created. So really, what those messages mean is that 100 tasks are created, one for each session. Now, it happens that in version before 1.0.5/2.0.0-rc1 the driver was not limiting the number of thread the ExecutorService could create, so if 100 session are created basically simultaneously, that thread pool service would create in the order of 100 thread to handle the load of 'connection pool creation' tasks, and once this is done would destroyed those threads because they are not useful. The did fixed that in recent versions of the driver so that no more than 'the number of processor' threads are created.
And arguably we could expose configuration to fine tune that ExecutorService, but in any case, this is not directly associated to the number of Sessions and fine tuning that is honestly at best a minor concern (all you might hope to gain by fine tuning is saving a few milliseconds for the creation of your 100 sessions, which sound more effort than is worth).
The benefit of creating/exposing such configuration is that people (i.e. consumers of the driver...with possibly unanticipated use cases) might disagree with your assessment of it being a 'minor concern'.
And arguably we could expose configuration to fine tune that ExecutorService, but in any case, this is not directly associated to the number of Sessions and fine tuning that is honestly at best a minor concern (all you might hope to gain by fine tuning is saving a few milliseconds for the creation of your 100 sessions, which sound more effort than is worth).
Yes...configuration complexity is slightly increased...although honestly I happen to think that's a 'minor concern'...but the value is in the flexibility for consumers.
It seems you've answered your own question. You can indeed use a single Sessionthrough fully qualified keyspace names in the query. And there is no wall to behit by doing this. You can also use the QueryBuilder instead of doingmanual string concatenation.
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.