Link to home
Start Free TrialLog in
Avatar of James_T
James_T

asked on

Client Side Caching

I'm carrying out an investigation to see how the performance of a server side and client side cahed web application differs.

To capture the reponse time of a system using server side caching, i'm going to use performance counters on the web server.

Does anyone know how I can capture the response time of the application when its cached on the client?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of thur6165
thur6165

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of James_T
James_T

ASKER

Well the application is developed in asp.net.

The investigation needs to as rigorous and scientifically credible as possible.

rd when you say the following:

And really, if it is a PHP, ASP, JSP etc...it would be more accurate to do the timer with the server side script, as there will be some latency when the page loads before the JavaScript timer begins.

Surely this wouldnt work if it is cached client side?
The request first goes to the server, therefore from the time you receive the request at the server until the client fires the XMLHTTP request is the total time.

Here is my browser retrieving Google's home page:

http://www.google.com/

GET / HTTP/1.1    <------------ first thing is request to Google for content.
Host: www.google.com
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cache-Control: max-age=0

HTTP/1.x 200 OK    <------------------ the response from Google
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Server: GWS/2.1
Content-Length: 2033
Date: Thu, 29 Mar 2007 00:20:04 GMT
----------------------------------------------------------
http://www.google.com/intl/en_ALL/images/logo.gif

GET /intl/en_ALL/images/logo.gif HTTP/1.1   <------ my browser requests the logo
Host: www.google.com
Accept-Encoding: gzip,deflate
Keep-Alive: 300
Connection: keep-alive
Cache-Control: max-age=0

HTTP/1.x 304 Not Modified  <------------- Google responds the logo has not changed
Server: GWS/2.1
Content-Length: 0  <----------- Google sends nothing my browser fetches it from cache
Content-Type: text/html
Date: Thu, 29 Mar 2007 00:20:04 GMT
----------------------------------------------------------
http://www.google.com/images/x2.gif  <------- My browser requests another image

GET /images/x2.gif HTTP/1.1
Host: www.google.com
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.google.com/
Cache-Control: max-age=0

HTTP/1.x 304 Not Modified  <--------- Google says not modified
Server: GWS/2.1
Content-Length: 0     <--------- nothing sent, I get it from cache
Content-Type: text/html
Date: Thu, 29 Mar 2007 00:20:05 GMT
----------------------------------------------------------
http://www.google.com/images/nav_logo2.png  <--- Yet another request

GET /images/nav_logo2.png HTTP/1.1
Host: www.google.com
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.google.com/
Cache-Control: max-age=0

HTTP/1.x 304 Not Modified  <----- not modified, get from cache
Server: GWS/2.1
Content-Length: 0
Content-Type: text/html
Date: Thu, 29 Mar 2007 00:20:05 GMT
----------------------------------------------------------


So, If I start the timer at the beginning, until the call back to my log.aspx page, I get the true time to load, which also considers client side cache.

If I only start the timer after all the headers are sent and enough of the page loads to render the JavaScript, I'm missing possibly a significant amount of time, depending on what content is loaded before I retrieve from client cache.

In most cases, we are hopefully talking about milliseconds, but if you want scientific accuracy you better start at the beginning of the request headers.

You also need a large number of measurements....hundreds or thousands.

The time to send the call back to the log.aspx page will be negligible and averaged into all of the calls.  If you only count client side and don't send the results back, how will you get your measurements?



The client side would have to be just the javascript.  The java script starts timing as soon as the page starts getting parsed by the browser.

I beleive the server side script is getting the amount of time it takes for the server to create the page.  So maybe your solution there is to add the time of the javascript and the server side script.

rdivilbiss - correct me if i'm wrong on this.  what is the php script timing?

>what is the php script timing?

In this case it would have to be aspx, but it wouldn't matter as the time sent by the client back to the aspx page would be constant so any response delay on the aspx page receiving the data would not be counted.

>The java script starts timing as soon as the page starts getting parsed by the browser.

I don't agree that the JavaScript starts as soon as the page starts getting parsed.  It has to render all the headers and at least load the script block before that occurs.  Since the question is page load time, which starts at the request, not when the page has rendered sufficiently to begin to execute JavaScript.  

So when the page has finished loading, we send the time back to the server via AJAX to an aspx receiver.  The time it takes for that to process isn't counted so we are only getting the time from the request until the page has rendered. If the aspx receiver took ten minutes to process, that wouldn't matter.

Now I'm not going to say there should be a significant amount of time between the initial request and the beginning of the JavaScript timer, but depending on the page layout and the server, it could be.  It should be counted.

Also, client time can be different from Server time, but that's easily accounted for by using GMT time on both ends.  Then you simply have end-begin = actual rendering time.

Avatar of James_T

ASKER

So to sum up, if I put the Javascript in both the server side cached and client side cached versions of the application, and pass the results across to an aspx page to store the results, this would be an accurate experiment?

rd the function sendToLog you wrote, what language is that in?  

Thanks for both of your help.
>>rd the function sendToLog you wrote, what language is that in?

JavaScript (AJAX) for the client side.

Avatar of James_T

ASKER

Right i've got that working.

To test the affect of both tyoes of caching i am going to load test the system with varying numbers of using using Microsoft Application Center Test (ACT).

The way ACT works is by generating a script consisting of the GET and POST requests, when I run this script, would it bypass the client side caching and go to the server or would it get the page from the client cache?
I'm not familiar with ACT, sorry.