📜 ⬆️ ⬇️

ExtJS and Hosting Base Files in CDN

If you are developing projects on ExtJS, then surely in your source tree there is the library distribution kit itself and you connect it on all pages where its capabilities are used. And keep the library itself also on your hosting. This is, of course, the correct and simple approach, but it has its limitations. Firstly, in most cases, ExtJS will be the biggest component of the page, because its total volume is about 1 MB, and therefore it will slow down the page until the browser loads the entire library. As a way out, everyone recommends customizing compression (for example, mod_deflate, it’s good that there are almost no browsers that do not understand compressed content, and who has it, as they say, maliciously Buratino itself), caching tags, etc. Well, in an extreme case - to collect for your project, or even for each page, your version of the library, including the necessary components. I already wrote about the framework structure and the constructor located on the site , which will be able to automatically generate you your personal distribution kit.

However, there is now another possibility to store these include files. There are systems such as CDN - Content Delivery Networks, which have their own network of geographically dispersed servers that are connected to powerful high-speed channels and are located close to the user requesting a particular file. If it is stored in the CDN, then the file will be returned from the server that is closest to the user, which means that the file will load faster.

In partnership with CacheFly , ExtJS can now store their assemblies on such a network. In addition to the JS files themselves, the style files are also stored (ext-all.css, which is also quite large). Moreover, now creating your own framework build via the web interface, you can immediately put it in the CDN and use it directly, simply by changing the links. Note that if your version of the framework is already used by someone, then a new file will not be created, and you will simply be given a link to the already cached one.

Of course, for many projects, the acceleration achieved in this way may be insignificant, well, we won half an second ... but believe me, there is no limit in the struggle for optimization, and everything that helps to win even the shortest time in the application will be appreciated by customers .
')
I decided not only to write, but also to check whether the download from the CacheFly servers will indeed go faster than when connecting the file directly from the project server.

Honestly, loading is not slower for sure. In particular, due to the fact that the download comes from another host, which means that the browser simultaneously requests other files, which is important, since the simultaneous number of requests to a single domain is limited. Checking the availability of the site by ping, on average, the values ​​were at or below the data for my server, although when I checked the last time, the difference was significant, one and a half times, in favor of CacheFly. So, it is difficult to advise something - it is necessary to try it personally, but it won't be any worse, that's for sure.

Source: https://habr.com/ru/post/45683/


All Articles