Can Cluster
, ISession
and IMapper
instances be static in a web app, or we need separate ones for each user? I.e. is it OK to have all of these instantiated (as static) at application startup and then use them for all users? In the documentation it says that only one instance of ISession should be used per keyspace. I'm using only one keyspace, so is this OK, or would this be problematic? I'm using DataStax C# Driver.
Indeed, you just need one instance of ISession
for the application, i.e. singleton pattern.
However, if significant load is expected make sure you protect the creation of it from multiple attempts by whatever hosting environment you're using so that while a session is being established additional attempts are failed.