Cache Failover and Shared options, YesSql updates - This week in Orchard (26/11/2021)

Gábor Domonkos's avatar
SQL Server, Caching, Media Library, This week in Orchard

Huge YesSql updates, new cache failover and shared options, Media Library improvements, and a new site running on Orchard Core! Do you want to know more? Then don't forget to check out our current post!

Orchard Core updates

YesSql updates

YesSql has updates for the following drivers: MySqlConnector 2.0, Npgsql 6.0, Microsoft.Data.Sqlite 6.0. The Npgsql 6.0 has breaking changes in terms of date and time serialization. The breaking change is in the way it handles time stamps and date-time storage and the type of column that it stores them into.

The Microsoft.Data.Sqlite is on 6.0, which contains the SQLite Connection Pooling, so it's pooling SQLite connections now. If we check out the benchmarks for MVC, where Orchard is one of them, and it's running the About page on SQLite, and you can see that on both Windows and Linux it goes up from around 5000 requests per second to 16000 requests per second and also the latency went down.

Orchard Core benchmarks

Removed beforeFolderAdded to stop multiple calls to fetch folders

When you click OK on the new Media Folder name dialog, the first thing it does after creating the new folder emits beforeFolderAdded which loads the folder we are currently on. Then it emits the folderAdded, which selects the new folder (triggering a load of the new folder through the watcher).

It appears that both requests are in flight at the same time, and we are seeing that occasionally the beforeFolderAdded request comes in last and then makes it appear as if the new folder has all the contents of the previously selected folder.

bus.$on('addFolder', function (target, folder) {
if (self.model == target) {
bus.$emit('beforeFolderAdded', self.model);
if (self.children !== null) {
self.children.push(folder);
}
folder.parent = self.model;
bus.$emit('folderAdded', folder);
}
});

So, when we create a folder, we fire the beforeFolderAdded then folderAdded both of which load contents of a folder, but there is no guarantee on the order these calls will resolve in. Occasionally, we are seeing the first call to the original folder come in second, and the new folder appears to be populated with images already.

Removing calling the beforeFolderAdded function

Cache Failover and Shared options

Sometimes the Redis server is not available because there could be timeouts for example. What do you serve when Redis is down, and it's part of your system. Do you serve something or just wait and try again?

You could say that if the cache fails then go to the database and return something from there. But at the same time, it can also be dangerous because you could expose yourself to put your site down. If you expect not to do a lot of database stuff because you have a caching layer, you can put your site down.

The DefaultDynamicCacheService uses the IMemoryCache to at least prevent something if Redis is down. For example, cache the id of a requested document locally so that the memory cache is used during the FailoverRetryLatency, which is a configuration value that has a 30 seconds value by default.

Using the IMemoryCache in the DefaultDynamicCacheService implementation

News from the community

Dixin's Blog is running on Orchard Core

If you navigate to https://weblogs.asp.net/dixin, you will find a blog that contains several interesting posts about .NET, Windows, and many more. The site is using Orchard Core, and as you may notice, it's very fast, no matter how much content it has on it.

Dixin's blog

Lombiq Gulp Extensions with Stylelint

Our Gulp Extensions project now also provides Sass SCSS linting with Stylelint! To use it in your Gulp JS SCSS build pipeline, just configure the corresponding SCSS targets Gulp task. Read more about how you can do that here!

SCSS targest Gulp task documentation

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 232 subscribers! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course.

Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here!

If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

No Comments

Add a Comment