During one performance assessment, I noticed that a single user request
to preview a report, being generated by PHP using PDFLib,
actually generated two sequential HTTP GET requests.
(The browser used was Microsoft Internet Explorer
(IE) 5.5 SP1 -- the preferred browser at that time -- running on Windows 2000.)
The resulting PHP script was actually running twice
with the same inputs. I verified this by setting up a sniffer between
the client machine and the server that reported exactly what was
being sent back and forth between the two machines.
From the users' perspective, they would kick off the request to view a
report. After some period of time -- actually after the script had run once
-- the browser window would go blank. Then, after another equally long
period of time -- after the script had completed for the second time -- the
browser window would display the requested report. By eliminating
one of these requests, I could cut the time that the user
waits by half - a 100 percent improvement in performance.
I found that the problem of two GET requests being made to view a single report
was specific to Internet Explorer. After researching the Microsoft
Web site, I determined that multiple GET requests are
normal behavior for Internet Explorer when it handles MIME-types
such as PDF files. Based on information available from a Microsoft Support
WebCast, "MIME-Type Handling in Microsoft Internet
Explorer," you can avoid two GET requests by ensuring
that correct and complete headers describing the content are returned. In
particular, you should include the following header:
Content-Type: application/pdf
Content-Disposition: inline; filename=report.pdf
By examining network traffic, I observed that the
Content-Disposition line was omitted from the HTTP
response header. After modifying the application to output this extra
header, Internet Explorer correctly issued a single HTTP GET request for
each report.
Carefully examine the network traffic, and differences
between network traffic generated when using Internet Explorer,
Opera, or Netscape. You might achieve a 100 percent improvement in
performance for the recommended browser.