Skip to content

CDN and Debug Mode Speed Improvements #305

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

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

David-Durst
Copy link

CDN - Previously, cassette would cache the url created by the modify method of the IUrlModifier in CassetteConfigurations. I split that into two functions: PreCacheModify and PostCacheModify. One can prepend the desired CDN url and programmatically switch it without cassette caching the old value.

Debug Mode Speed Improvements - Using Cassette with approximately 150 bundles significantly slows the development cycle. On a six-core processor with 24 gigs of ram, it takes about 30 seconds to make a change and refresh the page if the site isn't rebuilt. Otherwise, the reload takes about 90 seconds. I decreased these times to about 5 seconds and 30 seconds by caching the bundles on disk and in memory.

In Memory Caching - Previously, when one bundle changed, cassette recompiled all of them. Now, DiskBackedBundleCache stores in them in memory in their post-processing form so that if one has been changed, only that one needs to be recompiled.

On Disk Caching - If the developer re-compiles the site, the assets are not processed. Rather I use files on disk that contain the post-processing forms of the assets. I ensure that, if an asset has changed, I do not serve an older form of the asset by storing files with the following name format: <filename><hash of file><filename>.<fileformat> .

@andrewdavey
Copy link
Owner

Hi David, thank you for digging into these performance issues. It's great to see Cassette being used on a large project, and getting improved as a result!

I've been getting ready for Cassette v2 over in the v2 branch. This has significantly diverged from master, so merging may be tricky! I may end up cherry picking commits/ideas into v2 instead.

It would be very useful to have an integration test suite that simulates a large number of bundles. Can you provide more detail on the size and make-up of your 150 bundles? e.g. number of assets per bundle, number of types of bundle (script, stylesheet, htmltemplate), coffeescript, less, etc?

Thanks again for all the work you've put into Cassette :)

@pbering
Copy link

pbering commented Aug 30, 2012

Will this get into v2.1?

@andrewdavey
Copy link
Owner

It makes sense for Cassette v2.1 to focus on improving performance. So I will certainly be using this pull request for inspiration.

I won't be introducing breaking API changes though. So some things may be rolled in v3, or altered to not change public interfaces.

@andrewdavey
Copy link
Owner

I've created a new branch https://github.com/andrewdavey/cassette/tree/perf where I'm experimenting with performance improvements for the v2 code base.

Changing one asset file while the application is running in debug mode now results in only the one bundle being re-processed, instead of all bundles. I've also made a few other perf tweaks.

@David-Durst
Copy link
Author

Sorry! I was an intern at ZocDoc this summer and now I'm back at school.
There were script, stylesheet, and htmltemplate bundles. Other than that, I am not table to provide much more details. One of my co-workers at ZocDoc, Christopher Cliff, might be able to provide you with some better details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants