Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

ModPagespeedLoadFromFile should share cache w/ multiple URLs #525

Open
GoogleCodeExporter opened this issue Apr 6, 2015 · 6 comments
Open

Comments

@GoogleCodeExporter
Copy link

It seems that LoadFromFile and LoadFromFileMatch don't share the same cache. If 
I map two distinct URLs to the same directory, the cached files are still saved 
with the URL as the key instead of the mapped directory. This is quite 
unfortunate.

It's probably not a very big deal with LoadFromFile is used as it wouldn't be 
very often when multiple URLs are mapped to the same dir, but when 
LoadFromFileMatch is used, the expectation is that it could be used in large 
scale to reduce load.

Let me know if you need more info or don't understand. Marking this as a 
feature because it _does_ work; it's just not very efficient.

Original issue reported on code.google.com by amat...@gmail.com on 12 Oct 2012 at 6:26

@GoogleCodeExporter
Copy link
Author

Original comment by sligocki@google.com on 12 Oct 2012 at 6:31

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

@GoogleCodeExporter
Copy link
Author

Hi.  When you say "saved with the URL as the key" I'd like to understand your 
observation a little better.

When mod_pagespeed gets a resource from its HTTP fetcher, it stores it by the 
URL in the file-cache.  Depending on the optimization, we may also save the 
optimized results using the rewritten ".pagespeed." URL in the file-cache.

However, when we get a resource directly from the file system, we should not be 
caching it again at all; since it's on the file system already there is not 
much benefit.  We have unit-tests that count cache insertions with LoadFromFile 
and prove we don't re-store the input, but it's possible there's a corner case 
we've missed.

Exactly what are you observing in the cache?

Original comment by jmara...@google.com on 12 Oct 2012 at 7:36

  • Changed state: RequestClarification

@GoogleCodeExporter
Copy link
Author

I'm observing this problem incidentally and am seeing it reflected in my 
pagespeed cache dir.

Incidentally, let's say I pagespeed-map www.example.com/(user1|user2)/static to 
/var/www/static and that the HTML in those user dirs reference assets in the 
mapped static dir. When I hit www.example.com/user1, the first view is not 
pagespeed-optimized (as expected). A reload of the page a second later 
indicates that the async processing finished and that the optimized resources 
are now being linked to. Then, on my initial view of www.example.com/user2, I 
expected to see that the static resources on that page were referencing the 
already-optimized versions; they weren't.

What I dug into my cache to see if the resources were at least sharing the same 
cache entries, I found out that they weren't. I saw distinct entries like this 
for example:

/var/www/mod_pagespeed/cache/http,3A/,2Fwww.example.com/user1/static/css/W.test.
css,2Cqver=3.4.2.pagespeed.cf.CvyrCOB-uI.css,
/var/www/mod_pagespeed/cache/http,3A/,2Fwww.example.com/user2/static/css/W.test.
css,2Cqver=3.4.2.pagespeed.cf.CvyrCOB-uI.css,

In other words, the optimized test.css that's served from user1's and user2's 
HTML is optimized and saved to -- and I assume served from -- two different 
cache entries due to the URL being the cache key. I'd expect that there should 
only be one entry for the single optimized test.css, not two (and, in the case 
of thousands of users, I assume thousands of entries).

Original comment by amat...@gmail.com on 12 Oct 2012 at 8:29

@GoogleCodeExporter
Copy link
Author

Issue 746 has been merged into this issue.

Original comment by jmara...@google.com on 24 Sep 2013 at 1:27

@GoogleCodeExporter
Copy link
Author

Clarification has been given.  We should work on improving our cache behavior 
in a few dimensions and this is one.

Original comment by jmara...@google.com on 31 Jan 2014 at 3:52

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

I would also like to see cache aggregation in the cases where the same domain 
is used for HTTP and HTTPS.

Original comment by rsre...@gmail.com on 12 Dec 2014 at 6:20

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

No branches or pull requests

1 participant