Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance simplecache to return 304 Not Modified header when ETag matches (Trac #2002) #2002

Closed
elgg-gitbot opened this issue Feb 16, 2013 · 15 comments

Comments

@elgg-gitbot
Copy link

Original ticket http://trac.elgg.org/ticket/2002 on 40229220-03-18 by trac user milan, assigned to unknown.

Elgg version: 1.8.1b1

I've noticed that although simplecache is used to precache content before sending it to the client. It isn't used to cache content on the client/browser.

In the case of elggs js and css views which are loaded in every page, they are statically generated on the server, but that content is never cached on the client.

I've patched simplecache/view.php to allow it to return a 304 header when a eTag and modified since date matches the ones which would be used to return the data.

@elgg-gitbot
Copy link
Author

Attachment added by trac user milan on 40229222-06-06: view.php

@elgg-gitbot
Copy link
Author

ewinslow wrote on 40313412-03-08

Bump for this. It would be a huge performance improvement.

@elgg-gitbot
Copy link
Author

Milestone changed to Elgg 1.9 by brettp on 40769092-12-11

@elgg-gitbot
Copy link
Author

codelust wrote on 41010892-03-08

Can the same be done to mod/profile/icondirect.php ? It has made a massive difference in the performance of my installation.

@elgg-gitbot
Copy link
Author

Attachment added by trac user srokap on 41940789-01-22: cache_handler.php

@elgg-gitbot
Copy link
Author

trac user srokap wrote on 41940804-03-28

This code (see attachment) was already tested, it might be wise to consider other etag generation method, and maybe extract this part to allow reuse in other places like profile/icondirect.php
Also there's an assumption that server supports gzipping the output, I didn't test it in environment without it. Impact on rendering time is significant since downloading main css and js file does not block rendering of page any more.

@elgg-gitbot
Copy link
Author

Title changed from Enhance simplecache to return 304 Not Modified header when appropriate to Enhance simplecache to return 304 Not Modified header when appropriate + support for gzipping dynamically generated output by trac user srokap on 41940804-03-28

@elgg-gitbot
Copy link
Author

cash wrote on 41948645-06-17

I don't think we need to hash the contents of the file. The date encoded in the URL should be good enough to tell whether the file has been updated. If that's true we could just do a hash of the URL for the etag.

@elgg-gitbot
Copy link
Author

Attachment added by trac user srokap on 41959307-11-24: cache_handler.2.php

@elgg-gitbot
Copy link
Author

trac user srokap wrote on 41959312-03-04

We were working on this second version (attachment) without problems. It uses md5 hash from modification date as a etag, hashing the URL itself would be a bit strange to me.

@elgg-gitbot
Copy link
Author

Milestone changed to Elgg 1.8.3 by cash on 42004024-02-16

@elgg-gitbot
Copy link
Author

cash wrote on 42022308-12-10

I'm breaking this up into 3 tickets:

  • this ticket will be for ETag
  • another for last modified support for cache and icons (profile avatars and group icons)
  • another for gzipping

@elgg-gitbot
Copy link
Author

Title changed from Enhance simplecache to return 304 Not Modified header when appropriate + support for gzipping dynamically generated output to Enhance simplecache to return 304 Not Modified header when ETag matches by cash on 42022308-12-10

@elgg-gitbot
Copy link
Author

trac user Cash Costello wrote on 42022354-11-10

Fixes #2002 adds ETag support to simple cache handler
Changeset: d213db7

@elgg-gitbot
Copy link
Author

trac user Cash Costello wrote on 42050554-05-20

Fixes #2002 adds ETag support to simple cache handler
Changeset: d213db7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant