<?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: victor perez</title>
    <description>The latest articles on DEV Community by victor perez (@victor_perez).</description>
    <link>https://dev.to/victor_perez</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4036421%2Fe7678140-4b87-415b-b86c-498673685f82.jpg</url>
      <title>DEV Community: victor perez</title>
      <link>https://dev.to/victor_perez</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/victor_perez"/>
    <language>en</language>
    <item>
      <title>Rails Wasn’t Our Bottleneck. PostgreSQL I/O Was.</title>
      <dc:creator>victor perez</dc:creator>
      <pubDate>Sun, 19 Jul 2026 12:25:42 +0000</pubDate>
      <link>https://dev.to/victor_perez/rails-wasnt-our-bottleneck-postgresql-io-was-40fo</link>
      <guid>https://dev.to/victor_perez/rails-wasnt-our-bottleneck-postgresql-io-was-40fo</guid>
      <description>&lt;p&gt;Tansa is a Rails application that transforms Bitcoin data into structured, verifiable information.&lt;/p&gt;

&lt;p&gt;Its processing pipeline uses PostgreSQL and Sidekiq:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bitcoin Core → Layer1 → Cluster → ActorProfile → ActorBehavior → ActorLabels&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When one module started falling behind, Rails and Sidekiq looked like the obvious suspects. The processing ran through background jobs, with several large writes going through Active Record.&lt;/p&gt;

&lt;p&gt;We could have immediately added more workers.&lt;/p&gt;

&lt;p&gt;That would probably have made the problem worse.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the Measurements Revealed
&lt;/h2&gt;

&lt;p&gt;We waited for the query responsible for inserting data into &lt;code&gt;cluster_inputs&lt;/code&gt;, then observed its behavior inside PostgreSQL.&lt;/p&gt;

&lt;p&gt;One execution took &lt;strong&gt;114.39 seconds&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;During our sampling, almost all the observed wait time was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;IO/DataFileRead
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The query accessed approximately:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;55 MB from storage&lt;/li&gt;
&lt;li&gt;1.6 GB from PostgreSQL’s shared cache&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Rails job was running. Sidekiq was doing exactly what we had asked it to do. Ruby CPU execution was not the main issue.&lt;/p&gt;

&lt;p&gt;The pipeline’s throughput was being limited by PostgreSQL reads and the characteristics of the underlying storage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why More Workers Would Have Been Dangerous
&lt;/h2&gt;

&lt;p&gt;An additional worker would not have made the disk faster.&lt;/p&gt;

&lt;p&gt;It would have sent more concurrent queries to an already constrained database, increased contention, and made the problem harder to diagnose.&lt;/p&gt;

&lt;p&gt;We focused on the actual constraint instead:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;measuring the exact SQL query;&lt;/li&gt;
&lt;li&gt;inspecting PostgreSQL wait events;&lt;/li&gt;
&lt;li&gt;increasing &lt;code&gt;shared_buffers&lt;/code&gt; from 4 GB to 8 GB;&lt;/li&gt;
&lt;li&gt;improving the insertion and flushing path;&lt;/li&gt;
&lt;li&gt;controlling the number of concurrent jobs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;During an initial tuning phase, one representative insertion dropped from &lt;strong&gt;252 to 156 seconds&lt;/strong&gt;. After further improvements, another measured execution completed in &lt;strong&gt;114 seconds&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;These are production observations, not controlled laboratory benchmarks. But they gave us the evidence needed to move in the right direction.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Lesson
&lt;/h2&gt;

&lt;p&gt;Saying that a Rails application is slow is not a diagnosis.&lt;/p&gt;

&lt;p&gt;Rails was orchestrating the pipeline correctly. Sidekiq was executing the jobs correctly. But PostgreSQL and the storage layer determined the actual throughput.&lt;/p&gt;

&lt;p&gt;Before adding workers, replacing a framework, or rewriting a service, ask a much simpler question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What is the system actually waiting for?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In our case, the answer was not Ruby.&lt;/p&gt;

&lt;p&gt;It was the disk.&lt;/p&gt;

&lt;p&gt;I document these real engineering decisions and incidents in &lt;em&gt;Building Tansa with AI&lt;/em&gt;, a book about the architecture of an application built with artificial intelligence.&lt;/p&gt;

&lt;p&gt;Have you ever discovered that a performance problem blamed on your framework was actually caused by the database or storage layer?&lt;/p&gt;

</description>
      <category>rails</category>
      <category>postgres</category>
      <category>performance</category>
      <category>architecture</category>
    </item>
    <item>
      <title>A Git Cleanup Left Me With an Application I No Longer Recognized</title>
      <dc:creator>victor perez</dc:creator>
      <pubDate>Sun, 19 Jul 2026 11:04:50 +0000</pubDate>
      <link>https://dev.to/victor_perez/une-mauvaise-gestion-de-git-a-ramene-mon-application-dans-un-etat-que-je-ne-reconnaissais-plus-39ph</link>
      <guid>https://dev.to/victor_perez/une-mauvaise-gestion-de-git-a-ramene-mon-application-dans-un-etat-que-je-ne-reconnaissais-plus-39ph</guid>
      <description>&lt;p&gt;I am building Tansa, a large Bitcoin analysis application using Rails, PostgreSQL, Sidekiq, and AI coding agents.&lt;/p&gt;

&lt;p&gt;After months of development, the Git repository had accumulated many commits, branches, recovery points, and AI-generated changes. We decided to clean it up and make the history easier to understand.&lt;/p&gt;

&lt;p&gt;The operation appeared successful. The repository looked coherent, the main branch was clean, and the important Git references had been preserved.&lt;/p&gt;

&lt;p&gt;Then I restarted the application.&lt;/p&gt;

&lt;p&gt;I no longer recognized it.&lt;/p&gt;

&lt;p&gt;Recent features were missing, and parts of the application had returned to an older state. Git itself had not failed. The problem was more subtle:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We had produced a cleaner repository without first proving that it contained the correct application.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We had focused on commits, branches, and history. We should have started with a different question:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which exact functional state are we trying to preserve?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Recovery required us to stop making changes, preserve every available reference, compare candidate versions, and verify the actual application—not only the commit graph.&lt;/p&gt;

&lt;p&gt;This incident changed the way I manage Git with AI agents:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Define the functional reference before modifying history.&lt;/li&gt;
&lt;li&gt;Create a remote recovery branch and tag first.&lt;/li&gt;
&lt;li&gt;Give one person or agent ownership of Git operations.&lt;/li&gt;
&lt;li&gt;Require a diff and human approval before destructive commands.&lt;/li&gt;
&lt;li&gt;Validate the running application, not only the test suite.&lt;/li&gt;
&lt;li&gt;Never delete a recovery reference too early.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A clean Git history is not proof that you preserved the right software.&lt;/p&gt;

&lt;p&gt;AI makes development faster, but it can also execute a poorly defined Git decision at remarkable speed. The more agents you use, the more explicit Git ownership and recovery rules must become.&lt;/p&gt;

&lt;p&gt;I have documented these lessons in a book about Git and AI-assisted development. The English edition is now published and available on Leanpub: &lt;a href="https://leanpub.com/git-in-the-age-of-ai-agents" rel="noopener noreferrer"&gt;https://leanpub.com/git-in-the-age-of-ai-agents&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have you ever ended up with a technically clean repository that no longer represented the application you intended to preserve?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>git</category>
      <category>agents</category>
      <category>softwareengineering</category>
    </item>
  </channel>
</rss>
