Current time: 11-14-2019, 04:38 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What determines a "static asset"
01-28-2011, 12:22 AM
Post: #1
What determines a "static asset"
I have a site that uses several Ajax calls to acquire (JSON) data that is used by client-side Javascript to render the page. I am working to have my server-side scripts return better headers to optimize performance. In my test results, under Speed Optimization, I get a report to "Remove query string from static resources." The resources referenced are for CGI scripts that return data.

Further, WPT advices that these "static resources" should be served from a cookieless domain. While I do use a distinct domain for true static resources (CNAMEd to my CDN), these scripts need information from the client in order to properly assemble the returned JSON payload. The data is transmitted to the scripts by both cookies and query string arguments.

So, I am curious how WPT determines what is a "static resource" ?

Here are the Headers returned for one of these Ajax calls:

Cache-Control:public, max-age=86400
Connection:Keep-Alive
Content-Encoding:gzip
Content-Type:application/json; charset=utf-8
Date:Thu, 27 Jan 2011 12:46:05 GMT
Keep-Alive:timeout=2, max=194
Last-Modification:Wed, 25 Aug 2010 14:15:20 GMT
Server:Apache
Transfer-Encoding:Identity
Vary:Accept-Encoding


Notes:

1) my script examines the request header for Accept-Encoding, and returns gzip'd content when possible (which is the case in the Headers above)

2) the script is returning content derived from a file. I never know when that data will change, and presently it has not changed in a while (the Last-Modification header is the date of the last change to the file). But since it *may* change, I set the cache max-age to 1 day.
Find all posts by this user
Quote this message in a reply
01-28-2011, 12:48 AM
Post: #2
RE: What determines a "static asset"
There are 2 sets of optimization checks within WebPagetest. The grades at the top of the page are done by WebPagetest itself but the query parameters rule is from Page Speed which is integrated with WebPagetest (as well as being available as a plugin for Firefox). They have a Google group available for discussing things with the dev team: http://groups.google.com/group/page-speed-discuss

As far as static vs. dynamic, it's because it looks like the resource is cachable (making it "statc"). You need a pragma: no-cache and/or a cache-control: no-cache header for it to really be a dynamic asset. As far as the tools are concerned there's not really the concept of "sort of static but might change at some point" - we treat those like js/css where they should be cached and versioned.

If it doesn't make sense for your particular site, don't take the checks as Gospel. They are guidelines and recommendations but there are always exceptions.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)