Christopher,

thanks for the masterful analysis.
I'll pick out just one aspect :

Christopher Schultz wrote:
...

If it happened to be (2), then one could argue that adding an <Alias>
matching the real "Host:" of the calls, is actually slightly faster than
not doing so.

My point exactly.

...

One would just love to catch Chuck some time..

I'll bet he's quick: you'd better wear cleats and gloves.

Yes, but this time..
Assuming there is a single (and default) Host, like this :
<Host name="locahost" ...>
  <Alias name="somealias.company.com">
</Host>

and multiple requests comes in with a header
Host: somealias.company.com

then indeed the fact of having this Alias, would be faster than not having it, wouldn't it ?
And in such a case, Chuck's comment that
"Note that if you have only one <Host>, <Alias> elements are completely superfluous."
would be, in fact, incorrect. Ha !

(I do mention "multiple requests", because one could also argue that if the number of requests addressing that particular "alias" is low, then the additional overhead of creating the alias-related Hosts array entry in the first place, may negate the subsequent efficiency gain.)
We need one of these nice graphs showing the respective gains here..
Don't you feel tempted ?

About your optimisation suggestions, I see another possible one :
If this is a keep-alive connection, then the same Tomcat thread will handle subsequent browser requests over that same connection. As far as I know, there isn't really a case where a browser will issue multiple requests over the same connection, if not addressed to the same Host. So the thread could also cache a pointer to the Host entry obtained in the first request of the connection, and re-use it without lookup for subsequent requests over the same connection. Not so ? (To make this more certain, one could also cache the Host's name and check, but that might not even be necessary).

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to