<?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>Forem: Utkarsh Mehta</title>
    <description>The latest articles on Forem by Utkarsh Mehta (@life_of_utkarsh).</description>
    <link>https://forem.com/life_of_utkarsh</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%2F617385%2Ff3edb55a-6dd8-4180-8e5d-e1fb60919126.JPG</url>
      <title>Forem: Utkarsh Mehta</title>
      <link>https://forem.com/life_of_utkarsh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/life_of_utkarsh"/>
    <language>en</language>
    <item>
      <title>Fluentbit &amp; Clickhouse Benchmarking</title>
      <dc:creator>Utkarsh Mehta</dc:creator>
      <pubDate>Mon, 14 Mar 2022 12:22:22 +0000</pubDate>
      <link>https://forem.com/life_of_utkarsh/fluentbit-clickhouse-benchmarking-1ige</link>
      <guid>https://forem.com/life_of_utkarsh/fluentbit-clickhouse-benchmarking-1ige</guid>
      <description>&lt;p&gt;&lt;a href="https://life-of-utkarsh.medium.com/benchmarking-fluent-bit-with-clickhouse-dedabf3c3d61"&gt;Post&lt;/a&gt;&lt;/p&gt;

</description>
      <category>fluentbit</category>
      <category>clickhouse</category>
      <category>benchmarking</category>
      <category>boxyhq</category>
    </item>
    <item>
      <title>Benchmarking fluent-bit with Clickhouse</title>
      <dc:creator>Utkarsh Mehta</dc:creator>
      <pubDate>Mon, 14 Mar 2022 00:00:00 +0000</pubDate>
      <link>https://forem.com/boxyhq/benchmarking-fluent-bit-with-clickhouse-2j5</link>
      <guid>https://forem.com/boxyhq/benchmarking-fluent-bit-with-clickhouse-2j5</guid>
      <description>&lt;p&gt;One of our products, &lt;a href="https://github.com/boxyhq/hermes"&gt;Hermes&lt;/a&gt; is an audit logs service. Currently, Hermes is in the prototype phase and uses a &lt;a href="https://go.dev/"&gt;Go&lt;/a&gt; REST API server to ingest audit logs and send them to &lt;a href="https://grafana.com/oss/loki/"&gt;Loki&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We were trying out different databases, ingesters &amp;amp; tools to see which are best suited for Hermes and should be able to scale with high traffic without losing a single audit log &amp;amp; which can search through high amount data efficiently.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jm3BT1C4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://boxyhq.com/assets/images/fluentbit-clickhouse-86b56a7ab3f219724eb29ba348e11c71.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jm3BT1C4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://boxyhq.com/assets/images/fluentbit-clickhouse-86b56a7ab3f219724eb29ba348e11c71.png" alt="Title Image" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We decided to benchmark different combinations of ingesters (Vector, Fluentd, Fluent-Bit, etc.) and storage &amp;amp; query tools (Mongodb, Clickhouse, Elasticsearch, etc.).&lt;/p&gt;

&lt;p&gt;The first round of benchmarks will be lightweight and extensive benchmarks will follow later once we pick the right tools for Hermes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hardware Configuration​
&lt;/h2&gt;

&lt;p&gt;The following tests and benchmarks have been performed on a MacBook Pro (14-inch, 2021) with Apple M1 Pro and 16 GB RAM, the tools to be tested were dockerized with docker desktop running with 4 GB Memory, 4 CPUs &amp;amp; 1 GB Swap.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Fluent Bit is a super-fast, lightweight, highly scalable logging and metrics processor and forwarder. It is the preferred choice for cloud and containerized environments. Source: &lt;a href="https://fluentbit.io/"&gt;fluent-bit website&lt;/a&gt;Clickhouse is the fastest OLAP database on earth. ClickHouse works 100–1000x faster than traditional approaches. Companies like Uber, Cloudflare, Spotify, and eBay use Clickhouse. Source: &lt;a href="https://clickhouse.com/"&gt;Clickhouse website&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So few pointers before we go ahead,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Fluent-bit is fast at ingesting logs/data, processing them, and sending them to a destination.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Clickhouse is efficient at handling and querying data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fluent-bit does not support Clickhouse by default.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The fluent-bit ecosystem lets users write their plugins in Golang and add additional support required.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For faster querying in Clickhouse, an efficient table schema with indexes, compression, etc. should be established.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Clickhouse plugin for fluent-bit​
&lt;/h2&gt;

&lt;p&gt;I developed a fluent-bit output &lt;a href="https://github.com/boxyhq/fluent-bit-clickhouse"&gt;plugin&lt;/a&gt; for Clickhouse.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fluent-Bit config​
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--n1IKuySp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://boxyhq.com/assets/images/fluentbit-config-417b42159b9e62c6290fab792bc62b44.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n1IKuySp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://boxyhq.com/assets/images/fluentbit-config-417b42159b9e62c6290fab792bc62b44.png" alt="Fluent-bit Configuration" width="627" height="892"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This config makes fluent-bit ingest data via HTTP server listening on port 8888 and sends the data to Clickhouse with configuration stated.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clickhouse config​
&lt;/h2&gt;

&lt;p&gt;I ramped up the number of concurrent requests/queries by modifying the config.xml. After multiple tests, I finalized the following config.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--drn2OmsD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://boxyhq.com/assets/images/clickhouse-config-bccab31cee8f37b91b2ee44ff5f715d4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--drn2OmsD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://boxyhq.com/assets/images/clickhouse-config-bccab31cee8f37b91b2ee44ff5f715d4.png" alt="Clickhouse Configuration" width="670" height="64"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Load testing tool​
&lt;/h2&gt;

&lt;p&gt;I developed a load testing tool with Node.js that can be used to benchmark REST API-based endpoints of Fluent-bit.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/boxyhq/api-benchmarking"&gt;API Benchmarking&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another tool to load test is the querying part of Clickhouse.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/boxyhq/clickhouse-db-load-testing"&gt;Clickhouse Load Testing&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The results​
&lt;/h2&gt;

&lt;p&gt;These results are dependent on the ram allocated to the Docker engine, in my case, it's(4 GiBs).&lt;/p&gt;

&lt;h3&gt;
  
  
  Ingester​
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w-JGckia--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://boxyhq.com/assets/images/results-ingester-6ad22867ac8627737da5147ed055d84c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w-JGckia--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://boxyhq.com/assets/images/results-ingester-6ad22867ac8627737da5147ed055d84c.png" alt="Ingester results" width="800" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Query​
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_CG8bh1U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://boxyhq.com/assets/images/results-query-539fb5336df8f2d0476ca72d060cf9d5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_CG8bh1U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://boxyhq.com/assets/images/results-query-539fb5336df8f2d0476ca72d060cf9d5.png" alt="Queryer result" width="800" height="623"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion​
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Ingester​
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Fluent-bit can handle loads up to 2000 req/sec but in the case of bigger batches, the speed goes down drastically. (200 X 10) &amp;amp; (300 X 10)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the case of long-term light batches, Fluent-bit performs consistently. (10 X 1000)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fluent-bit performs at average speeds in the case of average loads (50 X 50).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Query​
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Clickhouse shows the best req/sec performance with an average load (50 X 50).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Also, Clickhouse's performance was pretty satisfactory for all the different variations of records in DB. (1.1 mils, 50k, 25k, 10k, 2k &amp;amp; 1k).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Clickhouse was able to manage short-term high loads and long-term light loads efficiently. (100 X 10) and (10 X 5000).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We will be posting more blogs regarding benchmarks, tools, etc., as we go on to build Hermes and many other dev tools. Please leave comments below.&lt;/p&gt;

&lt;p&gt;Thank you!&lt;/p&gt;

</description>
      <category>enterprisereadiness</category>
      <category>engineering</category>
      <category>auditlogs</category>
      <category>hermes</category>
    </item>
  </channel>
</rss>
