Writing to Kentico log in an Active/Active (geo-replicated) database scenario

Noam Rinat asked on August 11, 2021 20:39

I am hosting on Azure and I would like to geo-replicate the database so that one location has a read-write copy and the replicated locations have a read-only copy. I am considering options and I'm curious to see what others would do.

  • Configure the logger with a separate connection string that points at the read/write copy: Not sure even that it can be done. And if it could, sending synchronous operations across the globe doesn't sound like a good idea.

  • Write to an in-memory queue and then have a background process that will write to the log. Should this background process have a separate connection string to the read/write database or should it use the Kentico Rest API of the admin site, which can write to t he database?

What would you do?

Recent Answers


Sean Wright answered on August 12, 2021 00:19

I'm not exactly sure what you are trying to achieve.

Configure the logger with a separate connection string

When you write "logger", what do you mean exactly? The Event Log (CMS_EventLog table) or a change/event log (which would probably be the CMS_WebFarmServerTask table)?

There's nothing, that I know of, in Kentico Xperience that lets you do a CQRS separation of data persistence.

You can specify separate connection strings per application, or even per custom module class, but not reads vs writes.

Is the geo-replication to improve performance of reads at distance locations?

Maybe there's a way to do this natively at a lower level with SQL Server replication, but I'm not experienced in that area.

0 votesVote for this answer Mark as a Correct answer

Noam Rinat answered on August 12, 2021 14:08 (last edited on August 12, 2021 14:09)

Thanks for the answer @Sean. In an active/active scenario you have the MVC site deployed in multiple regions, in order to minimize latency in that region. In order for the optimization to be effective, all assets need to reside in the same region or as close as possble: Web app, database, cache, etc. The database needs to be part of a active/active failover group. That means that only one database is read/write and the replications are read only. That means that the MVC site cannot write to the log. A solution I am thinking about involves writing log entries to an in-memory queue and have a background process read that queue and send REST API calls to the admin site in order to write to the database.

0 votesVote for this answer Mark as a Correct answer

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