ср, 11 мар. 2026 г. в 23:28, James H. H. Lampert via users
<[email protected]>:
>
> I just happened to discover (while investigating an issue brought up by
> a customer) that the standard catalina.sh shell script in Tomcat 9 has a
> section, conditioned to only execute on IBM Midrange boxes, that sets
> the run priority to 6.
>
> if $os400; then
> COMMAND='chgjob job('$JOBNAME') runpty(6)'
> system $COMMAND
> # Enable multi threading
> export QIBM_MULTI_THREADED=Y
> fi
>
> When I discussed this on the Midrange Java List, it was pointed out that
> this is an extremely high priority (low RUNPTY values have more priority
> than high RUNPTY values). Terminal session jobs typically have a
> priority of 20; batch jobs typically have a priority of 50, with certain
> high-priority ones getting 35 or 25. Typically, only the most critical
> jobs get 10 or better.
>
> Is there some reason why this is the default for Tomcat?
A trivial answer is that
1. That block is accompanied by a comment that you missed in your quote:
# Set job priority to standard for interactive (interactive - 6) by using
# the interactive priority - 6, the helper threads that respond to requests
# will be running at the same priority as interactive jobs.
COMMAND='chgjob job('$JOBNAME') runpty(6)'
2. A blame output shows that this fragment is there from
commit 421604 (2006-07-13), "Add the set of scripts",
initial commit for the file. So I guess the origins are in Tomcat 5 or earlier.
3. For threads that matter, nowadays you can configure the priority
via configuration:
For the acceptor thread (that handles incoming connection attempts)
via "acceptorThreadPriority" on a <Connector>
https://tomcat.apache.org/tomcat-9.0-doc/config/http.html#Standard_Implementation
For request processing threads via "threadPriority" on an Executor
(preferred), or
on the Connector (if you have not configured an Executor).
https://tomcat.apache.org/tomcat-9.0-doc/config/executor.html#Standard_Implementation
Both values are documented to default to"5" (the value of
java.lang.Thread.NORM_PRIORITY).
I wonder whether the value in the shell file has any effect. Between
- the value configured in the shell file and
- the default value (5) and
- an explicitly configured Thread priority value (if one edits the
configuration)
which one wins?
The main java thread (that actually listens for the "SHUTDOWN" command
and does nothing else)
certainly does not need a high priority.
An explanation may be that either those configuration options were not
available,
or java.lang.Thread API had limitations on your OS,
20 years ago in 2006.
BTW, the same "runpty" call is present in tool-wrapper.sh
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]