On Tue, Mar 4, 2014 at 1:54 PM, Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> John,
>
> On 3/4/14, 1:17 PM, John Smith wrote:
> > Tomcat 7.0.42 on RHEL6.
> >
> > Assume that Tomcat is serving only one jsp page. Say it just
> > rewrites a parameter value from the querystring to the html within
> > the jsp.
> >
> > Also assume that there are ~200,000 users attempting to access that
> > page - say "almost simultaneously".
> >
> > What are the most relevant optimizations I can make to a single
> > instance of tomcat for this scenario?
>
> So you want the highest-performance solution to the above scenario?
>
> As for Tomcat configuration, I would use the NIO connector with a
> large number of max connections (you'll have to see what practical
> size to give it) and a large number of threads in your thread pool
> (i.e. executor).
>
> NIO gets you the benefit of not blocking waiting for a second (or
> third, etc.) keepalive request to arrive over a connection before that
> thread can be used to do some real work. If all connections are
> "Connection:close" then this is less of an issue.
>
> If you have a big, beefy CPU relative to your Internet connection's
> bandwidth, you should probably enable compression on the connector:
> that will help you push bytes back to the client faster. You'll have
> to test whether or not this actually helps you in your particular
> situation, because you are trading CPU time for I/O time.
>
> Define only one <Host> element in your server.xml, and name it
> whatever your public hostname is: there is a slight optimization in
> the mapper that works slightly faster if you have exactly one <Host>
> element, and if that name matches the "Host" header from the request.
> (There is an even faster case for where there are no elements in the
> host list, then the default is used, but I'm not sure how to get a
> zero-element host list and yet still have a default host).
>
> Don't add any <Valve>s or <Filter>s that you don't absolutely need.
>
> I would remove any intermediate proxies that don't absolutely need to
> be there (like Apache httpd, Microsoft IIS, nginx, etc.). Tomcat
> itself comes fairly well-configured for performance out of the box
> (except for the use of the BIO connector, which gets the job done and
> it very stable and reliable, but certainly does not win any speed
> contests).
>
> If you want to optimize the hell out of the experience, you'll want to
> dump JSP: there's a lot of setup that goes into creating the
> environment in which a JSP page runs, and you don't mention that you
> need any of it above.
>
> If you just need to write HEADER + some value from query string +
> FOOTER, then try to do that all in 3 I/O writes, like this would be in
> a servlet:
>
> static final String HEADER = "<html><head><title>My Fast
> Page</title></head><body><h1>My Fast Page</h1><p>Your parameter value
> is <i>";
> static final String FOOTER = "</i></p></body></html>";
>
> void doGet(request, response) {
>
>   ServletOutputStream out = response.getOutputStream();
>   out.print(HEADER);
>   out.print(request.getParameter("key"));
>   out.print(FOOTER);
> }
>
> To save network bandwidth, remove any non-essential whitespace from
> your text as I have done above.
>

+1 Chris.

What about, also, a servlet/filter to set header for caching resources on
the client for some period of time (if/when applicable)? :)


>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJTFiFPAAoJEBzwKT+lPKRYR5wP/iiaEcMIFxKBE9Rr9EP6ZhA+
> +fxznQ1QED232LlhvAAcAiAjnOOv/dzLxmC62dai9EZoV0/24WcMpYaEjaRo2jZu
> jIyeGb4Dn4ommJj7aPG+yesPRRTBY6j23SIauWbnRNBCggn/YCpOnjERuUHPtjMO
> G4kDeZaHGGjfirwTuPYCKxiKlYow6C4H8HUzLH84BvuktPPCgO16qbtCSCI0st+b
> av4pza4lzKSO3YsjS3PBNa7eI9q7zvLYqTeB7TziyLq7Jf5OOWPL73qUVJUgb54A
> M6GzvsdIYWHCigGZff0iHT3oNbDEteSVK7TPLP8+XzI8x8F+xsn5G8yv5wXhStDH
> 44g2E2hZLwLhaaSiJqtxKGb2kTwoJA+CX33MnbngOkMGUO7SmRMlkx77d08GiYoA
> uvOKep8zz7R4Is8EZu5sdzUQSxPx2Y59uzQNMiBeER47d+hfu4aOl241QUrN2osO
> NsddzzXB6i9auvdhDdGUkNwbT2Iy8NtMKPBUvM+LWz2GC+8+/WyVeRjhQ5N3BUwc
> 5YHCKrHVEgZR/NO7j6HvsqXBdUnbt8JNFp0O6XtkCUtlilDabki50wIqVXn/jEmc
> rG9YJKYDFDQdxJSEnpeZEw5+iDmORkSyIOEMw5htqVCCgeBRp2jeATVWKpdcM76G
> EJD/P6bdni3Vj7kthhjs
> =ADJI
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to