Taritsyn / BundleTransformer

Bundle Transformer - a modular extension for System.Web.Optimization (also known as the Microsoft ASP.NET Web Optimization Framework).
Apache License 2.0
130 stars 19 forks source link

Disk cache for minified assets? #38

Closed kendallb closed 4 years ago

kendallb commented 4 years ago

We have run into a problem where the load time for our application stack is super high after the application pool recycles. For years we have run a rolling deploy across our nodes and take them out of rotation to run the recycle, warm it up and then let customers back in so we get minimal disruption.

However recently we started using RayGun APM to find host spots in our code, and discovered that The YUI transformer we use for our Javascript assets is really, really slow to build the bundles. Like 20s or longer.

Since most of the time these assets do not actually changed, is it possible to get Bundle Transformer to recognize that the bundled content has not actually changed and somehow read the version that was used last time the application pool was started from a disk cache?

Taritsyn commented 4 years ago

Hello, Kendall!

Since most of the time these assets do not actually changed, is it possible to get Bundle Transformer to recognize that the bundled content has not actually changed and somehow read the version that was used last time the application pool was started from a disk cache?

Bundle Transformer is only responsible for asset transformations. Caching is implemented at the level of the Microsoft ASP.NET Web Optimization Framework.

However recently we started using RayGun APM to find host spots in our code, and discovered that The YUI transformer we use for our Javascript assets is really, really slow to build the bundles. Like 20s or longer.

YUI Compressor for .NET consumes quite a lot of memory, so I recommend that you switch to using the BundleTransformer.NUglify or BundleTransformer.MicrosoftAjax module.

kendallb commented 4 years ago

Alas we have tried both NUglify and MicrosoftAjax in the past and both of them ended up breaking some of our Javascript code. Hence the reason we use Yui, even though it's slow it gets it right.

As for caching, we are using the web optimization framework as I believe that''s what ends up using BundleTransformer to generate the files. Are you aware of how you can cache transformed assets across application pool restarts with that tool?

kendallb commented 4 years ago

Ahh yes, it uses the ASP.net cache. We currently do not really use that so it's just the default memory cache. I think I will look at either stashing the bundles on disk, or maybe in our memcached tier. Thanks!