Extensions: Donut Caching?

Created on 10 Jan 2016  路  14Comments  路  Source: dotnet/extensions

is there going to be partial page caching?

area-caching question

All 14 comments

That looks like a replacement for the output chaching which was before handled by IIS. This caches a complete page. I would be curious to know when running on linux / nginx why we would not let nginx handle this.???

My question was more on Donut caching, which enables you to cache only certain parts of a view into memory. say you have a site where the footer is generated via c# code from data in a db, the cache would store that so it would only be generated once every x hours.

I love how msft is taking performance seriously for scalable apps, but its more than competing against jetty or node for who has the most request per second. a lot of performance and scaling has to do with caching data, cachibg output, ssl performance (spdy), and even client side optimization.

It would be great to have a full performance best practices write up which could start from caching queries, to parts, pages, and really build up step by step on how to build a strongly performing app. adding examples for azure (redis, cdn) would he really helpful for those who go the azure route

@DamianEdwards?

Doesn't @DamianEdwards have enough on his plate?

The more I think about it, I think MSFT docs team should really create a couple path scenarios.
AWS does a good job with this, showing how you can use their infrastructure for different apps.

From the ASP.net 5 Perspective, it would be really cool to have an interactive flow chart on what choice of framework (Full Not Net, Cross Platform .net, and Mono), technology (MVC, Web Pages, SignalR) you might consider for typical apps.

For example:
Do your developers use Macs? (all options available)
Do you need to host on linux? Then you are forced into Core or Mono
Do you need support? Mono Dissapears.
Do you need to connect to SQL Server?
Do you need to

It would be great as you answer all these questions, that notes pop up about Azure features you can use to deploy them.

Just my 2 cents.
I am sure MSFT has already thought of this, but then again (since the higher ups refuse to rename ASP.net), maybe not =)

BTW,
What I am really asking about in the question is a mechanism to Cache Partial Views.

This would also have to work with Web Pages (which I love WAY more than MVC, and thus far has been given a beack seat).

@villanus Did you check the page @Tratcher shared with you? It caches whatever you put between the cache tags (which are tag helpers). An example from that page:

<cache expires-after="@TimeSpan.FromMinutes(10)">
    @Html.Partial("_WhatsNew")
    *last updated  @DateTime.Now.ToLongTimeString()
</cache>

I did. It seems like a broken way to do things since it doesn't support distributed cache. we can close the issue the way i worded it because it should really be titled support partial caching (distributed or azure redis cache)

in my apps in the past we have used full page caching by placing nginx in front of a set of IIs servers, and the used client side JavaScript to generate the uniqe items. for example the full welcome page is cached and served via a nginx upstream, and then the top header of the page would use jquery to inject the visitors name or cart count from a json string which bypasses the nginx cached page.

The above works great, but requires JavaScript as a work around to stitch the page. I was hoping asp.net would have full page / partial page caching which can scale. this would be useful for devs who are not on the JavaScript bandwagon, and even so the use cases are there

The use of local cache was deliberate.
A) Local cache has more powerful expiration mechanisms.
B) In a farm scenario with rolling deployments you don't want to share cached views from different versions of the application.

@Tratcher what if every server in a farm is on the same version? Sort of like how you would use Redis for Session storage, or even SQL?

Is there an advantage of using a local memory cache? Seems like each Server would be creating the same exact cache items? And if that server goes down, there is warm up time associated with getting the cache rebuilt?

Not ever server in the farm will always be on the same version unless you shut them all down during upgrades.

See the comment about expirations. E.g. you can link the memory cache entry to file change notifications or other events. That's much harder for distributed cache. Memory cache is also much faster.

@Tratcher I am not understanding this. Perhaps because I a mornon.
The way we do it right now is do a git commit and then pull the latest changes to our production changes. So everything is in sync.

For example say you are running a traditional IIS webfarm, or using a reverse proxy AAR, Nginx or whatever. If your content is different on the back end servers you are going to be in a world of trouble. I think in the IIS world of doing this, most people even use a shared disk to host their IIS sites to make sure the sites are exactly the same on each IIS server.

Again, this is not an issue for a 1 server situation, but how would it work for scaling a large application? Just seems like a feature you cannot use if you want your site to scale without wasting a bunch of resources on duplicate IIS caches.

This is going to be a problem when you go with the .NET core and Linux hosting where most people put Nginx in front of syncronized back end apps (python, ruby, node, php) and use a shared cache for those services.

The only workaround I can think of is to use Redis distributed cache and then hand code logic to check each partial view in Redis to see if its cached.

@villanus There is now a distributed cache tag helper here: https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.TagHelpers/DistributedCacheTagHelper.cs

It's also designed in a way you can redefine what storage is used, and alter what is stored like applying encryption and compaction by implementing specific services.

Will be really useful. Want to move from MVC 5, but no alternative in ASP.NET Core.
Any plans?

This is an old issue and actually belongs in dotnet/aspnetcore since it's related to output caching which lives in that repo. Closing.

Was this page helpful?
0 / 5 - 0 ratings