X
Tap here to go to the mobile version of the site.

ஆதரவு மன்றம்

Firefox tends to evict from cache JavaScript with size over 15MB

  • 5 replies
  • 1 இந்த பிரச்சனை உள்ளது
  • Last reply by Peter Kolínek
பதிவிடப்பட்டது

We are using web application that uses JavaScript batch files, where one of them exceeded size of 15MB. Since then Firefox seems to evict the file from cache and always load it from the server also excluding If-Modified-Since header. When the file size is decreased to former size ( around 12MB ), caching works again as expected: file is either served from Firefox cache or If-Modified-Since header is sent in request to verify if server file changed. When I checked difference between files server, there was nothing changed except file size and content ( i.e. there is no dynamic changing of file, cache headers stay the same, ... ).

Is there some configuration setting or hard-coded limit which forces Firefox to evict larger files from cache and enforce their reloading?

Here is the list of selected response headers on mentioned file:

X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN Content-Security-Policy: frame-ancestors 'self' Expires: Tue, 22 Sep 2020 07:43:13 GMT Cache-Control: max-age=31536000 Cache-Control: public Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT ETag: "0" Content-Type: application/javascript;charset=UTF-8 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Transfer-Encoding: chunked

Thanks for any hints.

We are using web application that uses JavaScript batch files, where one of them exceeded size of 15MB. Since then Firefox seems to evict the file from cache and always load it from the server also excluding If-Modified-Since header. When the file size is decreased to former size ( around 12MB ), caching works again as expected: file is either served from Firefox cache or If-Modified-Since header is sent in request to verify if server file changed. When I checked difference between files server, there was nothing changed except file size and content ( i.e. there is no dynamic changing of file, cache headers stay the same, ... ). Is there some configuration setting or hard-coded limit which forces Firefox to evict larger files from cache and enforce their reloading? Here is the list of selected response headers on mentioned file: X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN Content-Security-Policy: frame-ancestors 'self' Expires: Tue, 22 Sep 2020 07:43:13 GMT Cache-Control: max-age=31536000 Cache-Control: public Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT ETag: "0" Content-Type: application/javascript;charset=UTF-8 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Thanks for any hints.
மேற்கோள்

Additional System Details

பயன்பாடு

  • User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0

கூடுதல் தகவல்

cor-el
  • Top 10 Contributor
  • Moderator
17479 தீர்வுகள் 157962 பதில்கள்
பதிவிடப்பட்டது

Firefox can send both a request to load content from the cache and also send a request to the server. Which response arrives first is used. This is called a 'racing' feature (RCWN: Race Cache With Network). If you have a slower hard drive then in some cases the server might respond quicker and send a partial file. The about:networking#rcwn page shows the current RCWN stats.

The Network Monitor shows a 'raced' value in the transfer column. There is a network.http.rcwn pref (network.http.rcwn.enabled) that controls this feature, so you can test whether your issue is about RCWN or something different.

Firefox can send both a request to load content from the cache and also send a request to the server. Which response arrives first is used. This is called a 'racing' feature (RCWN: Race Cache With Network). If you have a slower hard drive then in some cases the server might respond quicker and send a partial file. The about:networking#rcwn page shows the current RCWN stats. The Network Monitor shows a 'raced' value in the transfer column. There is a network.http.rcwn pref (network.http.rcwn.enabled) that controls this feature, so you can test whether your issue is about RCWN or something different.

cor-el மூலமாக திருத்தப்பட்டது

இது உங்களுக்கு பயனுள்ளதாக இருந்ததா?
மேற்கோள்
jscher2000
  • Top 10 Contributor
8695 தீர்வுகள் 71076 பதில்கள்
பதிவிடப்பட்டது

You may have found this preference --

browser.cache.disk.max_entry_size

-- with a default value of 50MB (51,200 KB). That seems large enough for your application's needs.

You can review the comments in the source code to learn more about the user-configurable parameters and some of Firefox's behaviors. Other behaviors might not be as clearly documented:

https://dxr.mozilla.org/mozilla-release/source/modules/libpref/init/all.js#31

You may have found this preference -- browser.cache.disk.'''max_entry_size''' -- with a default value of '''50MB''' (51,200 KB). That seems large enough for your application's needs. You can review the comments in the source code to learn more about the user-configurable parameters and some of Firefox's behaviors. Other behaviors might not be as clearly documented: https://dxr.mozilla.org/mozilla-release/source/modules/libpref/init/all.js#31
இது உங்களுக்கு பயனுள்ளதாக இருந்ததா?
மேற்கோள்
பதிவிடப்பட்டது

கேள்வியின் உரிமையாளர்

cor-el said

... The Network Monitor shows a 'raced' value in the transfer column. There is a network.http.rcwn pref (network.http.rcwn.enabled) that controls this feature, so you can test whether your issue is about RCWN or something different.

Thank you cor-el for info about this feature, but unfortunately it seems not to be the cause. When I've disabled rcwn, caching was still not used for 15MB file.

jscher2000 said

You may have found this preference -- browser.cache.disk.max_entry_size -- with a default value of 50MB (51,200 KB). That seems large enough for your application's needs. You can review the comments in the source code to learn more about the user-configurable parameters and some of Firefox's behaviors. Other behaviors might not be as clearly documented: https://dxr.mozilla.org/mozilla-release/source/modules/libpref/init/all.js#31

Yes, I've checked those. Just to be sure, I've tried to increase the caching limit preferences to 10 times its default size, also disabled disk smart cache size and extended its limit to a few gigs, but it still did not help.

What I noticed also is that, when I completely clear Firefox cache, the 15MB file is cached and is being used from cache for a while. It is also shown in about:cache disk stats that the file is there and usage count increases on page reloads. But after a short time period ( few page reloads ) the file is being transferred from network again, despite I can still see it in about:cache listing - just usage count is not increasing of course. When hitting CTRL+F5 on the page, I can see new refreshed entry in about:config with usage count one or a few times, but then again after a while file is being requested from network.

''cor-el [[#answer-1254443|said]]'' <blockquote> ... The Network Monitor shows a 'raced' value in the transfer column. There is a network.http.rcwn pref (network.http.rcwn.enabled) that controls this feature, so you can test whether your issue is about RCWN or something different. </blockquote> Thank you cor-el for info about this feature, but unfortunately it seems not to be the cause. When I've disabled rcwn, caching was still not used for 15MB file. ''jscher2000 [[#answer-1254462|said]]'' <blockquote> You may have found this preference -- browser.cache.disk.'''max_entry_size''' -- with a default value of '''50MB''' (51,200 KB). That seems large enough for your application's needs. You can review the comments in the source code to learn more about the user-configurable parameters and some of Firefox's behaviors. Other behaviors might not be as clearly documented: https://dxr.mozilla.org/mozilla-release/source/modules/libpref/init/all.js#31 </blockquote> Yes, I've checked those. Just to be sure, I've tried to increase the caching limit preferences to 10 times its default size, also disabled disk smart cache size and extended its limit to a few gigs, but it still did not help. What I noticed also is that, when I completely clear Firefox cache, the 15MB file is cached and is being used from cache for a while. It is also shown in about:cache disk stats that the file is there and usage count increases on page reloads. But after a short time period ( few page reloads ) the file is being transferred from network again, despite I can still see it in about:cache listing - just usage count is not increasing of course. When hitting CTRL+F5 on the page, I can see new refreshed entry in about:config with usage count one or a few times, but then again after a while file is being requested from network.
இது உங்களுக்கு பயனுள்ளதாக இருந்ததா?
மேற்கோள்
cor-el
  • Top 10 Contributor
  • Moderator
17479 தீர்வுகள் 157962 பதில்கள்
பதிவிடப்பட்டது

Did you check in the Network Monitor whether the RCWN feature might be causing Firefox not to use the disk cache like I posted above?

Did you check in the Network Monitor whether the RCWN feature might be causing Firefox not to use the disk cache like I posted above?
இது உங்களுக்கு பயனுள்ளதாக இருந்ததா?
மேற்கோள்
பதிவிடப்பட்டது

கேள்வியின் உரிமையாளர்

I checked the Network Monitor regularly, but never seen RCWN feature kick in. Is it marked by 'raced' string in Transfer column? In Transfer I always saw either file size or 'cached' string.

I checked the Network Monitor regularly, but never seen RCWN feature kick in. Is it marked by 'raced' string in Transfer column? In Transfer I always saw either file size or 'cached' string.
இது உங்களுக்கு பயனுள்ளதாக இருந்ததா?
மேற்கோள்
கேள்வி எழுப்பு

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.