Hello,

I am occasionally experiencing a remarkable increase of the time it takes to
print a StringWriter
to the PrintWriter obtained by response.getWriter():

code skeleton:

  public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException
  {
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    StringWriter stringWriter;
    javax.xml.transform.stream.StreamResult streamResult;
    [...]

    stringWriter = new StringWriter();
    [... prepare the string = the HTML for the web page ...]

    // take time stamp here
    out.print( stringWriter ); <-- this here can take several seconds, even
if the web page is only a few kB large
    // take time stamp here
    ...
  }


Which factors affect the time it takes to print the data from the
StringWriter to the response's PrintWriter?

Usually, print() this is very fast (less than a second, often much less),
but intermittently it takes its time... several
seconds and longer... is this in some way dependant on (brainstorming
here... I couldn't find any documentation
explicitly stating where the data goes and what might cause delays there
when print() is called):
- a buffer belonging to the servlet engine
- a buffer belonging to the web server
- data is already sent to the client if a buffer is full and print() doesn't
continue after the client acknowledged
  receiving it (which would cause a slow network to have an impact on the
time it takes to execute print())
- ...

Now, that a StringWriter is used might appear weird, it's the result of me
taking the time printing to the
PrintWriter takes (the original code had an XSLT transformer write directly
into the PrintWriter instead
of into a StringWriter, but when I noticed that this occasionally took
unusually long, I decided to separate
the actual XML+XSL transformation and writing the web page to the result's
PrintWriter to get a better idea
where the time was lost).

environment:

MS Internet Information Server 5.00.xxx, New Atlanta ServletExec 3.1, Sun's
JRE 1.3.1

Thanks a lot for input
Michael

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to