Connection string best practices

Ashutosh Pandey asked on February 1, 2020 18:49

Is there any sample connection string that we should follow with Kentico?

We are using this, is this fine or do we need to optimize it?

<add connectionString="Data Source=localhost;Initial Catalog=dbname;Integrated Security=False;Persist Security Info=False;User ID=userid;Password=password;Connect Timeout=60;Encrypt=False;Current Language=English;Min Pool Size=0;Max Pool Size=100;Pooling=true;" name="CMSConnectionString" />


Correct Answer

Dat Nguyen answered on February 2, 2020 05:47

When IIS worker thread is doing a lot of work, it usually means one or more of the following:

  1. Your site has a lot of visitor traffic
  2. You have a lot of content editors doing work in Kentico at the same time
  3. You have CPU-heavy scheduled tasks that are running at high traffic times or running too frequently
  4. You have CPU-heavy global event handlers running frequently

Also, you shouldn't use ADO.NET on the Kentico database itself, but you can use it for any external databases that provide data to the website. Kentico data should be retrieved and manipulated by ObjectQuery, which is optimized to perform those tasks.

EDIT: You should also review how you are caching data, because that will contribute to high memory usage. Read this documentation to see if you can alleviate your problems.

0 votesVote for this answer Unmark Correct answer

Recent Answers

Dat Nguyen answered on February 1, 2020 23:57

Looks good to me. If you're using Kentico installer, the connection string is already added to web.config. The default connection string doesn't include connection pooling settings, so keep that in mind if you run into any connection pool errors with your application.

0 votesVote for this answer Mark as a Correct answer

Ashutosh Pandey answered on February 2, 2020 05:32

Thanks @Dat for the quick reply, why there is no connection pool settings in default connection string of Kentico? Is it not recommended or Kentico handles connections on its own? Also, is it OK to use ADO.NET with Kentico?

Apologies for asking so many questions but we are having very slow website with 8 GB RAM and 300 mb database size. We are trying to figure out by looking logs and found mostly IIS worker thread is consuming lot of memory


0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.