content-manager-sdk / Community

Content Manager SDK Samples
http://hprm.info
The Unlicense
50 stars 37 forks source link

Should DatabaseConnectionPool be used? #13

Closed catmanjan closed 4 years ago

catmanjan commented 4 years ago

This link seems to imply that database connection pooling is handled internally by calling Database connect: https://content-manager-sdk.github.io/Community/94/release_notes.html#rn_92_DatabasePool

However there is a new section on database pooling here: https://content-manager-sdk.github.io/Community/94/programming_guide.html#database_pooling

Is this just for added flexibility around cache settings, or should developers always be using the database pool in multiuser scenarios?

catmanjan commented 4 years ago

Also, what should be considered when setting MaxConnectionAge and MaxConnectionCount?

What would be the side effect of setting these to int.MaxValue?

dchurchland commented 4 years ago

In 92 the pooling was automatic, in 94 we added DatabaseConnectionPool to support configuration and monitoring.

I suppose it would be possible for it to be auto enabled but I suspect most applications will not require it and unless there is a compelling case for change I prefer not to change it again.

I have never investigated the memory footprint of the Database connection so I don't know whether setting MaxConnectionCount to int.MaxValue is likely to cause memory issues. For myself I would just set it to a number that is comfortably larger than your maximum expected concurrent users.

In theory a database connection should be able to stay alive forever but I feel more comfortable if I know they are getting recycled periodically. You could try setting MaxConnectionAge to 8 hours or more and see if you have any issues.

catmanjan commented 4 years ago

Thanks @dchurchland, you say in 92 the pooling was automatic, does that mean it is no longer automatic?

dchurchland commented 4 years ago

Yes. You have to instantiate the pool.

On Fri, 15 May 2020 at 16:18, Jan Martin notifications@github.com wrote:

Thanks @dchurchland https://github.com/dchurchland, you say in 92 the pooling was automatic, does that mean it is no longer automatic?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/content-manager-sdk/Community/issues/13#issuecomment-629051306, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG7YHX6EMXFVO2UE7YVX4LRRTNE3ANCNFSM4NBHWHGA .

catmanjan commented 4 years ago

Thanks!