RealAfricanProgrammer
RealAfricanProgrammer

Reputation: 23

asp.net mvc bundling scalability

When you add a script or style bundle to an mvc site, the bundling framework will append a version to the output markup.

e.g. <script src="/Scripts/custom/App.js?v=nf9WQHcG-UNbqZZzi4pJC3igQbequHCOPB50bXWkT641"></script> notice the querystring ?v=xxx-xxx

If you are hosting your App on multiple servers then each server would have a different version appended to the resource url which means in a classic round robin load balanced environment you will download that resource each time you hit a different server.

To me, seems to negate the value of bundling in some ways, since the initial load is quicker but a deteriorated performance is experienced on subsequent user interaction.

In practice how have others handled this issue I know depending on the size of the download it could be insignaficant because the minified and gzipped resource is tiny but in many situations this might not be the case. So how can one with minimal effort reap the benefits of bundling and minification in a high scale out environment.

Upvotes: 2

Views: 380

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038720

In practice the version number is a hash of the contents of the files. So if you have the same javascript files on all nodes of your webfarm, they should all get the same version number. If you are getting a different hash this could be an indication that you haven't deployed the same contents of those files on all nodes of your webfarm.

Upvotes: 3

Related Questions