Hi all,
I'm trying to migrate my servlet previously running on Tomcat 7 for
ages, to Tomcat 9.0.36 as per openSuse 15.4, and facing some problem.
The servlet in question is using websocket, basically as a
security-enhanced http-friendly replacement of plain-old TCP socket.
That is, as a bi-directional binary stream with guaranteed data
integrity and ordering.
By default Tomcat usually tries to spread the load over multiple threads
as much as reasonably possible. With normal http(s) requests, this all
works quite well out-of-the-box in most cases with no substantial
drawbacks. Now, websocket is somewhat different. Trying to automatically
split incoming websocket data over multiple threads is both useless and
harmfull, at least in some specific simple use-cases, because (1) the
servlet is not prepared to parallelize incoming commands from the same
client connection (it would make no sense due to application logic) so
it only adds unnecessary locking burden, and (2) more importantly, it
sometimes breaks the ordering of data in incoming websocket stream,
because OS thread scheduling is non-deterministic, so some portions
might arrive to the servlet in wrong order, from time to time. This all
was observed ages ago and for Tomcat 7 a simple fix was found:
replace "Protocol=HTTP/1.1" with
"Protocol=org.apache.coyote.http11.http11protocol"
in respective <Connector> item.
This made Tomcat 7 not spread one connection between multiple threads
and all worked just fine then.
Now in Tomcat 9, the "http11protocol" option no longer exists. Instead,
there is say "http11NioProtocol". But, it does not disable multithreaded
websocket.
So, my question is, is it possible to somehow prevent multithreading in
handling one connection in Tomcat 9? How do I configure that?
Thank you,
Regards,
Nikolai
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org