You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/10/18 16:22:13 UTC
[tomcat] branch master updated: Minor optimisation - add new line
to access log message outside the sync
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new b8cc215 Minor optimisation - add new line to access log message outside the sync
b8cc215 is described below
commit b8cc21574938dc8f46b88396de0694e1ce7aa0a7
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Oct 18 17:03:47 2019 +0100
Minor optimisation - add new line to access log message outside the sync
---
java/org/apache/catalina/valves/AccessLogValve.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/java/org/apache/catalina/valves/AccessLogValve.java b/java/org/apache/catalina/valves/AccessLogValve.java
index fe2943e..b133e10 100644
--- a/java/org/apache/catalina/valves/AccessLogValve.java
+++ b/java/org/apache/catalina/valves/AccessLogValve.java
@@ -610,10 +610,10 @@ public class AccessLogValve extends AbstractAccessLogValve {
// Log this message
try {
+ message.write(System.lineSeparator());
synchronized(this) {
if (writer != null) {
message.writeTo(writer);
- writer.println("");
if (!buffered) {
writer.flush();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: [tomcat] branch master updated: Minor optimisation - add new line
to access log message outside the sync
Posted by Mark Thomas <ma...@apache.org>.
> Mark,
>
> On 10/18/19 12:22, markt@apache.org wrote:
>> This is an automated email from the ASF dual-hosted git
>> repository.
>
>> markt pushed a commit to branch master in repository
>> https://gitbox.apache.org/repos/asf/tomcat.git
>
>
>> The following commit(s) were added to refs/heads/master by this
>> push: new b8cc215 Minor optimisation - add new line to access log
>> message outside the sync b8cc215 is described below
>
> Doesn't this perform a string-mutation instead of a stream-append?
No. Both message and write are writers.
> Or is it more critical to hold the lock for as short a period as possible?
I was looking for hot-spots, making sure the header parsing changes
weren't having a measurable impact. The header parsing never even
appeared in the results. But the AccessLog did.
The new code is marginally faster but the hot spots were dominated by
I/O (on localhost) and profiler calls. The % of call time spent waiting
for that sync dropped from ~13% to ~12%.
I don't trust the numbers from the profiler as the test was well into
the realm where the profiler has a significant impact on the figures but
I do trust the direction of travel (downwards).
The AccessLog is still a bottleneck. I don't see any easy way to remove
that without significantly increasing the extent to which entries are
added out of chronological order.
Mark
>
> -chris
>
>> commit b8cc21574938dc8f46b88396de0694e1ce7aa0a7 Author: Mark Thomas
>> <ma...@apache.org> AuthorDate: Fri Oct 18 17:03:47 2019 +0100
>
>> Minor optimisation - add new line to access log message outside the
>> sync --- java/org/apache/catalina/valves/AccessLogValve.java | 2
>> +- 1 file changed, 1 insertion(+), 1 deletion(-)
>
>> diff --git a/java/org/apache/catalina/valves/AccessLogValve.java
>> b/java/org/apache/catalina/valves/AccessLogValve.java index
>> fe2943e..b133e10 100644 ---
>> a/java/org/apache/catalina/valves/AccessLogValve.java +++
>> b/java/org/apache/catalina/valves/AccessLogValve.java @@ -610,10
>> +610,10 @@ public class AccessLogValve extends
>> AbstractAccessLogValve {
>
>> // Log this message try { +
>> message.write(System.lineSeparator()); synchronized(this) { if
>> (writer != null) { message.writeTo(writer); -
>> writer.println(""); if (!buffered) { writer.flush(); }
>
>
>> ---------------------------------------------------------------------
>
>
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: [tomcat] branch master updated: Minor optimisation - add new line
to access log message outside the sync
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Mark,
On 10/18/19 12:22, markt@apache.org wrote:
> This is an automated email from the ASF dual-hosted git
> repository.
>
> markt pushed a commit to branch master in repository
> https://gitbox.apache.org/repos/asf/tomcat.git
>
>
> The following commit(s) were added to refs/heads/master by this
> push: new b8cc215 Minor optimisation - add new line to access log
> message outside the sync b8cc215 is described below
Doesn't this perform a string-mutation instead of a stream-append?
Or is it more critical to hold the lock for as short a period as possibl
e?
- -chris
> commit b8cc21574938dc8f46b88396de0694e1ce7aa0a7 Author: Mark Thomas
> <ma...@apache.org> AuthorDate: Fri Oct 18 17:03:47 2019 +0100
>
> Minor optimisation - add new line to access log message outside the
> sync --- java/org/apache/catalina/valves/AccessLogValve.java | 2
> +- 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/java/org/apache/catalina/valves/AccessLogValve.java
> b/java/org/apache/catalina/valves/AccessLogValve.java index
> fe2943e..b133e10 100644 ---
> a/java/org/apache/catalina/valves/AccessLogValve.java +++
> b/java/org/apache/catalina/valves/AccessLogValve.java @@ -610,10
> +610,10 @@ public class AccessLogValve extends
> AbstractAccessLogValve {
>
> // Log this message try { +
> message.write(System.lineSeparator()); synchronized(this) { if
> (writer != null) { message.writeTo(writer); -
> writer.println(""); if (!buffered) { writer.flush(); }
>
>
> ---------------------------------------------------------------------
>
>
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl2sVi4ACgkQHPApP6U8
pFiMAA/8ChWuK3QDa2mOrHkVNKxexYiWD/yr3D/wex6w0BNpmKia6UzCs+qhFgwh
0jxbvbUzEUP11BJym2iZNOryLSk++ZCsq3s/e3730a0wn3eqaFaiCHH9xk2sogZ0
IWK1apDnGgB23mbQ5b+sshJinSWw6453X1XJUjnZtkv9Z89wac6cnfHs1WSqcqv4
bsxyZexlcs+bH3EUqxBqxlIGYxQS3GWQPFboWls04yCksBXwzGgT8s0CWJ94nfb8
jDA1ru0VIvJCwsqCY6ICqA9fXSByHfaZguXBbJ7rdMRHzrrSmwd/uei+leyN5Ch9
WhrwNZ1NlBmjvqQs2dhtMzZqhwWK7X4VEyg34KK0JI1Sx8LlajKd0VaD0J3Vz/FH
iu2ej/8YMorSIT8l6gVM28Yh8h+Zd+YeVvrZ7MZRZ0iFz+fXqS2EuR3s6oDU+6X+
7DSgkY1KMHi14t21fn5YZpAXe01OUI/tLUlP0OXzFrLzstscxOy3Bg24Ka1qT17N
rzGanNFlZxqtidyDpj+C17l8RACJbm7bBhlAg9+DaiwjkN+BbE0kKkcapjj0u41p
ay5mmX81tGG1qz4WfznD03fSI+H0xnVHdlRG5ewAMOceoKybOiVJjfIRh3mxG2rg
tqMCET6SvV3qaGja5trfRib6RVh/mTxAVdvHVW0YmRP/a1SY6Gw=
=g4kR
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org