<?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: Thi Nguyen (T)</title>
    <description>The latest articles on DEV Community by Thi Nguyen (T) (@anhthii).</description>
    <link>https://dev.to/anhthii</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%2F800657%2F40146602-2474-4f0f-a742-19e340bea168.jpg</url>
      <title>DEV Community: Thi Nguyen (T)</title>
      <link>https://dev.to/anhthii</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anhthii"/>
    <language>en</language>
    <item>
      <title>When CPUs Hit 100%: Hard-Earned Lessons from a Multichain Indexer Outage, with Bloom Filters as the Rescue.</title>
      <dc:creator>Thi Nguyen (T)</dc:creator>
      <pubDate>Tue, 30 Sep 2025 15:30:53 +0000</pubDate>
      <link>https://dev.to/anhthii/when-cpus-hit-100-hard-earned-lessons-from-a-multichain-indexer-outage-with-bloom-filters-as-the-46af</link>
      <guid>https://dev.to/anhthii/when-cpus-hit-100-hard-earned-lessons-from-a-multichain-indexer-outage-with-bloom-filters-as-the-46af</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3s2ooqgaebewbfm72j8a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3s2ooqgaebewbfm72j8a.png" alt=" " width="800" height="591"&gt;&lt;/a&gt;# When CPUs Hit 100%: Hard-Earned Lessons from a Multichain Indexer Outage | Fystack Blog&lt;br&gt;
At &lt;strong&gt;Fystack&lt;/strong&gt;, where we build blockchain wallet infrastructure, our transaction indexer needs to process &lt;strong&gt;over 100 million transactions per day&lt;/strong&gt; across multiple blockchains, including Ethereum, BNB, Polygon, Tron, and Solana.&lt;/p&gt;

&lt;p&gt;Our initial indexing logic was straightforward:&lt;br&gt;&lt;br&gt;
We maintain a &lt;strong&gt;database of wallet addresses&lt;/strong&gt; generated for our users. For each block on the blockchain, we parse the raw transaction data and &lt;strong&gt;check if the destination address exists in our database&lt;/strong&gt;. If it does, we process the transaction; otherwise, we ignore it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F29syjm3fygyk2s4pb38y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F29syjm3fygyk2s4pb38y.png" width="800" height="1241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Indexing flow of Fytack indexer&lt;/p&gt;

&lt;p&gt;Handling EVM chains alone was manageable, but everything changed when we integrated &lt;strong&gt;Solana,&lt;/strong&gt; one of the most active chains, with huge transaction volumes driven by meme coin crazes and projects like &lt;a href="https://bump.fun/?ref=ghost.fystack.io" rel="noopener noreferrer"&gt;Bump.fun&lt;/a&gt;, averaging around &lt;strong&gt;42 million transactions per day&lt;/strong&gt; (~3,000 TPS).&lt;/p&gt;

&lt;p&gt;Our servers, particularly the CPU, were constantly under stress, with utilization hovering between &lt;strong&gt;80–90%&lt;/strong&gt;. On peak days, CPU usage reached &lt;strong&gt;100%&lt;/strong&gt;, causing the server to become unresponsive and our customers repeatedly encounter &lt;strong&gt;504 Gateway Timeout&lt;/strong&gt; errors and started complaining.&lt;/p&gt;

&lt;p&gt;The team had to temporarily suspend Solana processing and restart the server just to restore normal operations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpyy8t9djyjqhorhko8mq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpyy8t9djyjqhorhko8mq.png" width="800" height="155"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CPU is under high stress&lt;/p&gt;

&lt;p&gt;We knew it was time to optimize.&lt;br&gt;&lt;br&gt;
Our team quickly identified that Consul where we persist user wallet addresses, was becoming a bottleneck. Storing and querying every address there doesn’t scale well when transaction volume is high.&lt;/p&gt;

&lt;p&gt;To handle this efficiently, we adopted a &lt;strong&gt;Bloom filter&lt;/strong&gt;, a well-known probabilistic data structure also used by the Ethereum blockchain for log filtering. A Bloom filter answers a simple question: &lt;em&gt;Could this item be in the set?&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  If it says &lt;strong&gt;no&lt;/strong&gt;, the item is definitely absent and can be skipped.&lt;/li&gt;
&lt;li&gt;  If it says &lt;strong&gt;yes&lt;/strong&gt;, the item might be present, and we perform a full check against our source of truth.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because most transactions are unrelated to our platform, this lets us skip the vast majority of checks. Properly tuned, a Bloom filter can store millions of wallet addresses while consuming only a few MBs of memory.&lt;/p&gt;
&lt;h3&gt;
  
  
  Bloom Filter Process
&lt;/h3&gt;

&lt;p&gt;To ensure efficiency and scalability, we utilize the &lt;a href="https://redis.io/docs/latest/develop/data-types/probabilistic/bloom-filter/?ref=ghost.fystack.io" rel="noopener noreferrer"&gt;Redis Bloom filter module&lt;/a&gt;. When a transaction arrives, we check if the destination address exists in the Bloom filter. If it does not, we skip the transaction; if it does, we proceed to verify it in persistent storage.&lt;/p&gt;

&lt;p&gt;The team successfully refactored the system, added new logic, tested, and deployed the solution in under 2 days, allowing operations on Solana to resume as usual.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func (s *publicKeyStore) Exist(addressType enum.AddressType, publicKey string) bool {
    // First check the bloom filter.
    // If the bloom filter returns false, the key definitely doesn't exist.
    if !s.bloomFilter.Contains(publicKey, addressType) {
        return false
    }

    // Since bloom filters may have false positives, check the underlying KV store.
    v, err := s.kvstore.GetWithOptions(composeKey(addressType, publicKey), &amp;amp;infra.DefaultCacheOptions)
    if v == "" || err != nil {
        return false
    }

    return true
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To make it works seamlessly, we periodically synchronize addresses from our PostgreSQL database to a Redis Bloom filter through a simple and efficient process.&lt;/p&gt;

&lt;p&gt;Recent optimizations have significantly enhanced our indexer’s performance and resilience. It now maintains CPU utilization between 40-60%, even under high load, rarely reaching 100%.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0w0ikmv98tqkw5i9wkal.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0w0ikmv98tqkw5i9wkal.png" width="800" height="591"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fystack indexer with Bloom filter&lt;/p&gt;

&lt;p&gt;We’ve open-sourced our multichain indexer, supporting Ethereum, EVM chains, and Tron. Check it out at &lt;a href="https://github.com/fystack/multichain-indexer?ref=ghost.fystack.io" rel="noopener noreferrer"&gt;github.com/fystack/multichain-indexer.&lt;/a&gt; Bitcoin and Solana support are planned for future development.&lt;/p&gt;

&lt;p&gt;At &lt;a href="http://fystack.io/?ref=ghost.fystack.io" rel="noopener noreferrer"&gt;Fystack&lt;/a&gt;, we are building open source scallable wallet infrastructure that users can self host and doens't need to rely on expensive custodians.&lt;/p&gt;

&lt;p&gt;Check out our Github : &lt;a href="https://github.com/fystack/?ref=dev.to"&gt;https://github.com/fystack/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>performance</category>
      <category>architecture</category>
      <category>blockchain</category>
      <category>systemdesign</category>
    </item>
  </channel>
</rss>
