When I refresh my website (Ctrl+F5), loading of
/bundles/Script?v=kHj78R8CVSwiLFaq5EOrj6UALoxbJmoUCasHhdgb9EQ1
(this is the script bundle that contains few js files, 2kb, 2kb, 70kb and the biggest one is the "kendo.all.min.js" that weighs 2mb)
takes too long one time in two. It took me 47 seconds to download this (see picture below).
What could be a problem?
Thank you in advance !!
Asked
Active
Viewed 3,265 times
2

Alex McManns
- 81
- 2
- 11
-
the other files also have a timestamp? – LellisMoon Oct 12 '16 at 08:25
1 Answers
-2
What could be a problème?
that weighs 2mb
You can utilize localStorage
or requestFileSystem
to download files once, at each subsequent load of page retrieve files from storage
or LocalFileSystem
, see How to cache a downloaded javascript fle which is downloaded using script tag

Community
- 1
- 1

guest271314
- 1
- 15
- 104
- 177
-
thank you for your respond. After inserting this piece of code on the script part of my Layout view, "=>" seems to be unknown. You have any idea why? – Alex McManns Oct 12 '16 at 08:57
-
-
@guest271314 why reinvent http caching that browsers can do well for years? – zerkms Oct 12 '16 at 08:59
-
@guest271314 could you give me more details about it please, like where to paste this code, what to put on 'path/to/resource', a file path or bundle path.... Thank you – Alex McManns Oct 12 '16 at 09:13
-
@AlexMcManns this answer does not solve the original problem, but mitigates the consequences (in an ugly and error prone way). – zerkms Oct 12 '16 at 09:16
-
@zerkms What is "error prone" about approach? What do you mean by "ugly"? – guest271314 Oct 12 '16 at 09:16
-
@guest271314 cache invalidation. Why ugly: there is a caching mechanism built-in into HTTP, it makes no sense to reinvent it again. – zerkms Oct 12 '16 at 09:17
-
-
-
@zerkms Well, you posted the term, why ask google when can get your interpretation of what you are saying? – guest271314 Oct 12 '16 at 09:20
-
I posted the term and I assume that someone that posted an answer about caching and when we discuss caching - knows basic terms. If one is not willing to be helpful - neither am I. Have fun. – zerkms Oct 12 '16 at 09:22
-
@zerkms There are several ways to approach issue, one of which is to use `FileSystem`; `Worker`, `ServiceWorker`, or even `` element. Yes, willing to be helpful, but why perform a search query when you can provide the details and context of which you speak? – guest271314 Oct 12 '16 at 09:23
-
@zerkms Do you have somethind to propose me in order to resolve my problem plzz? – Alex McManns Oct 12 '16 at 09:25
-
There is a HTTP caching mechanism to cache http responses https://tools.ietf.org/html/rfc2616#section-13 There really is no reason to reinvent it with what you suggested. @guest271314 if you have any argument for using anything you suggested over the standard mechanism - please provide so. – zerkms Oct 12 '16 at 09:25
-
@AlexMcManns information in the question is not enough to diagnose it. We now know that it takes 40+ seconds to download a 2+Mb file. It is, for example, fine if you're on a 56k modem connection. – zerkms Oct 12 '16 at 09:27
-
@zerkms There are several ways to achieve the desired result. One of which is to request the files once, store the files at `LocalFileSystem`. `Workspaces` could also be used at chromium, chrome; or, as you suggest, cache. Only mentioned two possible options at Answer. Really depends on what is best suited for OP. – guest271314 Oct 12 '16 at 09:32
-
@guest271314 so please provide an argument for using your error-prone suggestion instead of a *standardised mechanism*. – zerkms Oct 12 '16 at 09:33
-
@zerkms You still have not described what is "error-prone" about using `.toURL()` of `FileSystem` to reference files stored at user filesystem? – guest271314 Oct 12 '16 at 09:34
-
@zerkms I have an optical fiber internet connection, download speed is averagely 30Mb/s. And the more important thing is the problem occurs one time in four, five. Not all the time. – Alex McManns Oct 12 '16 at 09:34
-
@guest271314 your solution does not provide any cache invalidation mechanism. That + need of implementing it from the scratch makes it error prone. And, well, it would not even work for heaps of browser., – zerkms Oct 12 '16 at 09:34
-
@AlexMcManns so, have you tried to download it using say `curl`? What debugging have you already done? – zerkms Oct 12 '16 at 09:35
-
There is no need to "implement from scratch". Neither have you illustrated an error which would occur at all, negating the "error-prone" portion of your analysis. – guest271314 Oct 12 '16 at 09:36
-
@zerkms You are probably correct there as to `requestFileSystem` approach. Stay as far away from ie as possible, here. Though `localStorage` would return expected result; as well as utilizing `` element. – guest271314 Oct 12 '16 at 09:37
-
So, I demonstrated you a problem with your code. Now, please provide **ANY REASON** to use your broken code over the standard HTTP mechanism, that works in browsers for years? – zerkms Oct 12 '16 at 09:38
-
The code is not broken. Using ie is a broken process. Though, am open to your Knowledge in this area. Please demonstrate what you mean by using cache. – guest271314 Oct 12 '16 at 09:39
-
You're ignoring my question: is there **ANY TECHNICAL REASON** to use your code over the standardised mechanism, that is well tested and works for years? – zerkms Oct 12 '16 at 09:40
-
@zerkms tyied to reproduce the problem by compiling a project in local. in vain. In local I do not have a such problem. – Alex McManns Oct 12 '16 at 09:40
-
@AlexMcManns there are literally 0 technical details and in this comments. I suggested you to debug it, starting with `curl`. – zerkms Oct 12 '16 at 09:41
-
-
@guest271314 so, what would be a **TECHNICAL REASON** to prefer something broken over the standard that works? We are in engineering, we make weighted decisions. – zerkms Oct 12 '16 at 09:42
-
@zerkms Nothing is "broken". Store the files locally to only require requesting files once. What exactly do you mean by cache? What if cache is disabled at browser? Are you referencing using `ServiceWorker`? – guest271314 Oct 12 '16 at 09:44
-
@guest271314 your arguments make no sense, sorry, but I'm off. Good luck. – zerkms Oct 12 '16 at 09:44
-
-
@zerkms Good luck to you as well. There was no argument. Just different perspectives. Cheers – guest271314 Oct 12 '16 at 09:45
-
@AlexMcManns you've been given a keyword, please bother making a research on it. – zerkms Oct 12 '16 at 09:46
-
@AlexMcManns _"could you give me more details about it please"_ The approach at Answer would be to request each script individually, store at `localStorage`, load each individual script from `localStorage` within `` or when `document` is loaded – guest271314 Oct 12 '16 at 10:31