<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Eduard Mishkurov</title>
    <description>The latest articles on DEV Community by Eduard Mishkurov (@emishkurov).</description>
    <link>https://dev.to/emishkurov</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3869031%2Fe4784988-d383-4972-bcc9-1e56ac59b53b.jpg</url>
      <title>DEV Community: Eduard Mishkurov</title>
      <link>https://dev.to/emishkurov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/emishkurov"/>
    <language>en</language>
    <item>
      <title>Async logging is not a performance optimization</title>
      <dc:creator>Eduard Mishkurov</dc:creator>
      <pubDate>Thu, 09 Apr 2026 06:28:53 +0000</pubDate>
      <link>https://dev.to/emishkurov/async-logging-is-not-a-performance-optimization-4caa</link>
      <guid>https://dev.to/emishkurov/async-logging-is-not-a-performance-optimization-4caa</guid>
      <description>&lt;p&gt;Async logging is not a performance optimization.&lt;/p&gt;

&lt;p&gt;Most developers assume that moving logging to another thread makes it cheaper.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It doesn’t.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Logging has a cost, and that cost doesn’t disappear just because you enqueue work somewhere else.&lt;/p&gt;

&lt;p&gt;In real systems, logging overhead typically comes from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;formatting (often the dominant part)&lt;/li&gt;
&lt;li&gt;memory allocations and copying&lt;/li&gt;
&lt;li&gt;synchronization between threads&lt;/li&gt;
&lt;li&gt;actual I/O (file, console, network)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Async logging changes &lt;em&gt;where&lt;/em&gt; these costs are paid, but not &lt;em&gt;whether&lt;/em&gt; they exist.&lt;/p&gt;

&lt;p&gt;If your system produces logs faster than they can be processed, async logging will not fix the problem — it will only hide it temporarily behind a queue.&lt;/p&gt;

&lt;p&gt;Eventually, one of these happens:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the queue grows and increases memory usage&lt;/li&gt;
&lt;li&gt;producers get blocked&lt;/li&gt;
&lt;li&gt;logs get dropped&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Another subtle issue is data lifetime.&lt;/p&gt;

&lt;p&gt;If you defer formatting, you must ensure that all referenced data is still valid in the logging thread. That often means copying data earlier — which again shifts cost, but does not remove it.&lt;/p&gt;

&lt;p&gt;In practice, async logging is mostly a latency optimization:&lt;br&gt;
it can reduce the time spent in the calling thread.&lt;/p&gt;

&lt;p&gt;But total work done by the system often stays the same — or even increases.&lt;/p&gt;

&lt;p&gt;Understanding this distinction is important when designing logging systems and interpreting benchmarks.&lt;/p&gt;

&lt;p&gt;If you're interested, I wrote a deeper breakdown with examples and real-world observations:&lt;br&gt;
&lt;a href="https://medium.com/@emishkurov/async-logging-is-not-a-silver-bullet-what-actually-limits-performance-90cd45f23c7b" rel="noopener noreferrer"&gt;https://medium.com/@emishkurov/async-logging-is-not-a-silver-bullet-what-actually-limits-performance-90cd45f23c7b&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>performance</category>
      <category>logging</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
