Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SI: Add a ApplicationIntent="ReadOnly" option for select queries #391

Closed
mtrutledge opened this issue Feb 18, 2022 · 1 comment · Fixed by #392
Closed

SI: Add a ApplicationIntent="ReadOnly" option for select queries #391

mtrutledge opened this issue Feb 18, 2022 · 1 comment · Fixed by #392
Milestone

Comments

@mtrutledge
Copy link
Contributor

Is your feature request related to a problem?

This feature request is related to a performance issue. Hotcakes does a lot of database calls. The majority of these calls are read-related. In modern environments, especially in the cloud, it is not uncommon to have a read-only instance. It would be nice to take advantage of this by adding a ReadOnly connection string and have all Select statements request a read-only instance.

Describe the solution you'd like

Add a connection string in the web.config file that is a Read Only connection string like this:

<add name="SiteSqlServerReadOnly" connectionString="Data Source=(local);Initial Catalog=dnnplatform;Integrated Security=True;ApplicationIntent=ReadOnly;" providerName="System.Data.SqlClient" />

OR

Expose a ReadOnlyConnectionString Property that looks like this:

public string ReadOnlyConnectionString
{
    get 
    {
        return "ApplicationIntent=ReadOnly;" + System.Configuration.ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString;
    }
}

Adding the ApplicationIntent would have no effect if there was only a single SQL server. Everything would operate normally.

Describe alternatives you've considered

Alternatives may be to heavily use the cache for anything read-related but might be impractical in most environments. The proposed solution gives the ability to scale out if the environment supports it.

@mtrutledge
Copy link
Contributor Author

Updating the plan. Since Hotcakes uses Entity Framework it would be best to update the Repositories to call something like CreateReadStrategywhich will then call CreateReadOnlyHccDbContext using a ReadOnlyConnectionString as outlined above.

@WillStrohl WillStrohl changed the title Add a ApplicationIntent="ReadOnly" option for select queries SI: Add a ApplicationIntent="ReadOnly" option for select queries Feb 23, 2022
@WillStrohl WillStrohl added this to the 03.07.00 milestone Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants