We tried two tests

One was

******************
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.zip.*;

/** Example showing benefits of gzipping pages to browsers
 *  that can handle gzip.
 *  <P>
 *  Taken from Core Servlets and JavaServer Pages
 *  from Prentice Hall and Sun Microsystems Press,
 *  http://www.coreservlets.com/.
 *  &copy; 2000 Marty Hall; may be freely used or adapted.
 */

public class EncodedPage1 extends HttpServlet {
  public void doGet(HttpServletRequest request,
                    HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html");
    String encodings = request.getHeader("Accept-Encoding");
    String encodeFlag = request.getParameter("encoding");
    PrintWriter out;
    String title;
    if ((encodings != null) &&
        (encodings.indexOf("gzip") != -1) &&
        !"none".equals(encodeFlag)) {
      title = "Page Encoded with GZip";
      OutputStream out1 = response.getOutputStream();
      out = new PrintWriter(new GZIPOutputStream(out1), false);
      response.setHeader("Content-Encoding", "gzip");
    } else {
      title = "Unencoded Page";
      out = response.getWriter();
    }
    out.println("<HTML><HEAD><TITLE>" + title + "</TITLE></HEAD>\n" + 
                "<BODY BGCOLOR=\"#FDF5E6\">\n" +
                "<H1 ALIGN=CENTER>" + title + "</H1>\n");
    String line = "Blah, blah, blah, blah, blah. " +
                  "Yadda, yadda, yadda, yadda.";
    for(int i=0; i<10000; i++) {
      out.println(line);
    }
    out.println("</BODY></HTML>");
    out.close();
  }
}
******************

The other was

%%%%%%%%%%%%%%%%%%

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.zip.*;

/** Example showing benefits of gzipping pages to browsers
 *  that can handle gzip.
 *  <P>
 *  Taken from Core Servlets and JavaServer Pages
 *  from Prentice Hall and Sun Microsystems Press,
 *  http://www.coreservlets.com/.
 *  &copy; 2000 Marty Hall; may be freely used or adapted.
 */

public class EncodedPage2 extends HttpServlet {
  public void doGet(HttpServletRequest request,
                    HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html");
    String encodings = request.getHeader("Accept-Encoding");
    String encodeFlag = request.getParameter("encoding");
    PrintWriter out;
    String title;
    
      title = "Unencoded Page";
      out = response.getWriter();
    
    out.println("<HTML><HEAD><TITLE>" + title + "</TITLE></HEAD>\n" + 
                "<BODY BGCOLOR=\"#FDF5E6\">\n" +
                "<H1 ALIGN=CENTER>" + title + "</H1>\n");
    String line = "Blah, blah, blah, blah, blah. " +
                  "Yadda, yadda, yadda, yadda.";
    for(int i=0; i<10000; i++) {
      out.println(line);
    }
    out.println("</BODY></HTML>");
    out.close();
  }
}

%%%%%%%%%%%%%%%%%%

We found the one with the zipped stream to be roughly 5 times faster (sorry
but we didn't take real good measurements).  You can try it yourself - it's
pretty easy to do. Mind you - this is not a veyr compreehnsive test - but
the results over a 56K modem appeared quite compelling (over a !0mbit
ethernet or a T1 you don't notice that much improvement)

Thanks
Nate

> -----Original Message-----
> From: Santosh Kumar [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 17, 2000 11:17 PM
> To: Orion-Interest
> Subject: Re:Orion slower than...
> 
> 
> Hi Nate,
>      Do you have some figures to look at?
>     I mean, How much was the improvement in speed? What is 
> the size of the
> content file?
>     Did you try out with various content sizes?
> 
> Santosh
> 
> ----- Original Message -----
> From: Kirby, Nathaniel <[EMAIL PROTECTED]>
> To: Orion-Interest <[EMAIL PROTECTED]>
> Sent: Wednesday, October 18, 2000 12:32 AM
> Subject: Orion slower than it could be [WAS: Compressing the 
> output stream]
> 
> 
> > We tried using Orion to host 2 servlets, one using 
> compression one not -
> the
> > one using compression was much faster than the one without 
> it.  I assume
> > this means that orion's JSP are not compressed.
> >
> > Please repsond if this is an inaccurate statement
> >
> > Thanks
> > Nate
> >
> > > -----Original Message-----
> > > From: Kirby, Nathaniel [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, October 16, 2000 1:30 PM
> > > To: Orion-Interest
> > > Subject: Compressing the output stream
> > >
> > >
> > > On jsp-interest
> > > [http://archives.java.sun.com/cgi-bin/wa?A2=ind9912&L=jsp-inte
> > > rest&P=R11079
> > > ] I read
> > >
> > > *******************
> > >
> > > Date:         Mon, 6 Dec 1999 12:29:14 +0100
> > > Reply-To:     Volker Turau <[EMAIL PROTECTED]>
> > > Sender:       A mailing list about Java Server Pages 
> specification and
> > >               reference <[EMAIL PROTECTED]>
> > > From:         Volker Turau <[EMAIL PROTECTED]>
> > > </cgi-bin/wa?A2=ind9912&L=jsp-interest&D=0&P=64939>
> > > Subject:      Re: How to compress JSP pages using Content Encoding
> > > Comments: To: Kayser William <[EMAIL PROTECTED]>
> > > In-Reply-To:  <[EMAIL PROTECTED]>
> > > Content-Type: TEXT/PLAIN; charset=US-ASCII
> > >
> > >
> > > You can do content encoding in jsp, I did it. Just make sure
> > > that the page
> > > does not access the implicit variable out at all (e.g do not
> > > have blanks
> > > outside scripts).
> > >
> > >
> > > But I think that jsp is not the right tool to do that. The
> > > JSP-Container
> > > should do that for you.
> > >
> > >
> > > The code is roughly:
> > >
> > >
> > > <%@page .....><%
> > >     response.setHeader("Content-Encoding", "gzip");
> > >     GZIPOutputStream gos = new
> > >                 GZIPOutputStream(response.getOutputStream());
> > >     byte[] b = "<html> bla bla ...</html>".getBytes();
> > >     gos.write(b);
> > >     gos.close();
> > > %>
> > >
> > >
> > > volker turau
> > > FH Wiesbaden Fachbereich Informatik
> > > Tel.: +49-611-9495-205 FAX +49-611-9495-210
> > > <http://www.informatik.fh-wiesbaden.de/~turau>
> > >
> > >
> > >
> > > ==============================================================
> > > ============
> > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > > JSP-INTEREST".
> > > FAQs on JSP can be found at:
> > >  <http://java.sun.com/products/jsp/faq.html>
> > >  <http://www.esperanto.org.nz/jsp/jspfaq.html>
> > >
> > > *******************
> > >
> > > Does orion do this automatically ? caus eit doesn't seem to
> > > allow me to in a
> > > JSp (I can't assign out to a different stream).  Do I have to
> > > do it in a
> > > servlet ?
> > >
> > > Anyone out there know ???
> > >
> > > TIA,
> > > Nate
> > >
> > >
> >
> 
> 

Reply via email to