Why Asynchronous Logging Doesn’t Boost TPS – Real Test Results with Logback and Log4j2

Through extensive JMeter and APM testing on a 6‑core, 8 GB server, this article reveals that switching Logback from synchronous to asynchronous logging yields minimal TPS improvement, explains why, and demonstrates that Log4j2’s async implementation can achieve up to six‑fold performance gains.

Java Backend Technology
Java Backend Technology
Java Backend Technology
Why Asynchronous Logging Doesn’t Boost TPS – Real Test Results with Logback and Log4j2

Earlier I published an article titled “Logback configuration file improves TPS by 10×”, which attracted many comments and suggestions.

logback performance test shows little difference between synchronous and asynchronous TPS.

Even in 2022 we are still using logback.

After reviewing the feedback, I conducted a new round of testing.

Server Hardware

CPU: 6 cores

Memory: 8 GB

Testing Tools

JMeter

JProfile

APM (New Relic)

Issues with the Previous Test

Sample size was too small (100 threads, 1 loop, total 100 samples).

Only one test run, leading to randomness.

Inconsistent sample counts between runs caused pollution.

In the new test I increased the thread count to 200, loop count to 100, resulting in 20 000 samples per run, and repeated the test five times.

Logback sync vs async performance report
Logback sync vs async performance report

The new results show that TPS differences between synchronous and asynchronous logging are negligible.

Logback sync vs async test results
Logback sync vs async test results

Even though asynchronous logging does not significantly increase TPS, it reduces the time spent writing logs.

Using APM to monitor JMeter requests (100 threads, 0 ramp‑up, 100 loops) gave the following averages over five minutes:

APM async logging TPS
APM async logging TPS

Async logging average TPS: 378 rpm.

APM sync logging TPS
APM sync logging TPS

Sync logging average TPS: 333 rpm, confirming the difference is still small.

Why the change is small: TPS includes three stages – client request, server internal processing, and response. Logging accounts for only about 5.3 % of the total processing time, so optimizing it has limited impact on overall TPS, though it does cut log‑write latency.

Recommendation: Use Async Logging

For Logback, enable asynchronous logging to reduce log latency.

Why Switch to Log4j2

Log4j2 is the successor of Log4j 1.x, incorporates many of Logback’s good designs, and adds major performance improvements. Its asynchronous implementations include Async Append (similar to Logback) and Async Log, which is built on the LMAX Disruptor library for high‑throughput logging.

In the test, Log4j2’s async implementation (Async Log) used the same parameters as the Logback test: 200 threads, 100 loops, five repetitions.

Logback vs Log4j2 async performance report
Logback vs Log4j2 async performance report
Logback vs Log4j2 async test results
Logback vs Log4j2 async test results

TPS increased by six times!

Log4j2’s async logging reduces log‑write time to near‑zero, and official benchmarks confirm its superiority over Logback.

Official test report: https://logging.apache.org/log4j/log4j-2.3/manual/async.html

Conclusion

If you continue using the Logback framework, enable asynchronous logging.

When choosing a logging framework, prefer Log4j2 for its superior async performance.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

javaPerformance Testinglogbacklog4j2asynchronous logging
Java Backend Technology
Written by

Java Backend Technology

Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.