">
 

We rewrote a Go service in Rust and our velocity tanked for a quarter.

Iniciado por joomlamz, Hoje at 02:25

Respostas: 1   |   Visualizações: 2

Tópico anterior - Tópico seguinte

0 Membros e 1 Visitante estão a ver este tópico.

Saudações, malta do **webmastersmz.com**! Espero que estejam todos bem e a bater código com força.

Como especialista em tecnologia, li com bastante atenção o tópico *"We rewrote a Go service in Rust and our velocity tanked for a quarter"* (Reescrevemos um serviço Go em Rust e a nossa velocidade despencou durante um trimestre). Este é um relato extremamente valioso e realista sobre um erro clássico de engenharia que muitas equipas cometem: **escolher a tecnologia pela "hype" (moda) e não pelo contexto operacional.**

Vamos analisar tecnicamente os pontos principais deste caso e perceber o que correu mal:

### 1. A Curva de Aprendizagem do Rust (O famoso *Borrow Checker*)
O Go foi desenhado pela Google para ser simples, direto e fácil de aprender em poucas semanas. A sua concorrência (goroutines) é simples. Já o Rust, embora seja uma linguagem fantástica para segurança de memória e performance ao nível do sistema, tem uma curva de aprendizagem extremamente íngreme. O conceito de *ownership* (propriedade) e o *borrow checker* exigem que o programador mude completamente a sua forma de pensar. Forçar uma equipa de Go a produzir Rust ao mesmo ritmo de antes, sem um período de transição, é uma receita para o desastre.

### 2. O Ecossistema e a Produtividade (Standard Library)
No Go, a biblioteca padrão (*standard library*) é extremamente robusta. Vocês conseguem criar um servidor HTTP de alta performance, lidar com JSON e conectar a bases de dados quase sem dependências externas. No Rust, o ecossistema é mais fragmentado. Para fazer o mesmo, é preciso escolher entre várias *crates* (bibliotecas) externas (Tokio, Actix-web, Axum, serde, etc.). Essa necessidade de "costurar" o ecossistema drena o tempo de desenvolvimento da equipa.

### 3. Tempos de Compilação (*Feedback Loop*)
Um dos maiores trunfos do Go é a velocidade de compilação. É quase instantâneo, o que torna o ciclo de *feedback* (escrever código -> testar -> corrigir) extremamente rápido. O Rust, devido às suas otimizações agressivas e verificações de segurança em tempo de compilação, demora muito mais para compilar. Isso quebra o ritmo de trabalho do programador.

### 4. A Armadilha do "Rewrite" (Reescrever do Zero)
Mudar de linguagem para um serviço em produção raramente é uma decisão puramente técnica de sucesso imediato. Quase sempre subestima-se o esforço. Durante um trimestre inteiro (um "quarter"), a equipa não entregou novas funcionalidades de negócio porque estava ocupada a reescrever o que já funcionava em Go. O custo de oportunidade foi altíssimo.

---

### Vamos debater no Fórum!

Gostaria de convidar toda a comunidade do **webmastersmz.com** a partilhar as suas experiências:
*   Já passaram por algum cenário onde a reescrita de um sistema atrasou os vossos projetos?
*   Para a nossa realidade em Moçambique, onde o tempo de entrega e os recursos muitas vezes são limitados, compensa trocar a simplicidade do Go ou do Node.js pela robustez complexa do Rust?
*   Até que ponto a "hype" das novas tecnologias tem atrapalhado as decisões arquiteturais nas vossas empresas?

Deixem os vossos comentários e pontos de vista lá no fórum. O debate promete ser muito rico!

---

Para garantir que os vossos projetos e fóruns rodam sem falhas, convido-vos a conhecer as soluções de alojamento de alta performance da **AplicHost** em **https://aplichost.com**. Quer estejam a rodar uma aplicação leve em Go, um fórum de grande tráfego ou sistemas complexos, eles têm a infraestrutura ideal com a estabilidade que o nosso mercado exige.

We rewrote a Go service in Rust and our velocity tanked for a quarter.



Tópico: We rewrote a Go service in Rust and our velocity tanked for a quarter.
Categoria: Tutoriais | Programação & Tecnologia
Idioma Principal: Português (Conteúdo de Tecnologia)

Descrição do Conteúdo / Informações:
-------------------------------------------------------------------------
For a full quarter, our feature velocity significantly dropped after we re-implemented a Go service using Rust.

The performance improvements actually happened.



Why we did it in the first place


We are a small startup. Each engineer is important, and each week is even more important.

Our backend was built using Go, which was performing well. It was fast, reliable, and we could easily find resources to hire.

However, we became infected with that fever. The phrase "Rewrite it in Rust" was being used in all kinds of situations, and it sounded very appealing with its promises of memory safety, no garbage collector pauses, and blazing speed.

We told ourselves it was an investment in the future. What we actually bought was a quarter of silence.



The numbers nobody warns you about


I may not have the exact metrics we use internally, but I can direct you to an individual who shared accurate calculations transparently.

In a retrospective from November 2025, engineering manager Noah Byteforge wrote that a Node.js-to-Rust backend rewrite "dropped API response times from 340ms to 28ms. That's 12.1x faster."

And the other metric. A 65% decrease in sprint velocity. They didn't deliver a single story point for three weeks.

The time it took to send out new features increased by 185%. The time it took for pull requests to be processed increased by 320%. Additionally, scores from the "I feel productive" survey dropped from 8.2 to 4.1.

Most importantly, the kicker is what he says in his own words: "We'd won the technical battle and lost the war that actually mattered." He also admits that if he had been forthright about the 6-12 month per engineer ramp, "the business case would've fallen apart immediately."

That retrospective was so relatable, it read like our own diary. The battles with the borrow checker and the compile times just snuck entire weeks away from us.



The wins were real. That's the trap.


I must give credit to Rust because the safety benefits are not exaggerated.

The rewrite done by Byteforge reduced the memory footprint by 80%, going from 2.1GB to 420MB. CPU utilization also went down to 8%, and there were no more crashes related to memory.

Similarly, Discord experienced this in February 2020, and had to rewrite their Read States service because Go's GC pauses kept interrupting it. This was because their use of Go would inadvertantly heap allocate every time it was invoked, triggering GC pauses every two minutes that caused significant disruptions.

A developer forum comment that has been widely cited regarding the rewrite says: "Rust makes some common, poor-performance things difficult... It's more work up front." The "up front" is clearly doing a lot of heavy lifting here.

It's not that Rust is no good. It's that, for a startup, "up front" really translates to "at the expense of the critical differentiating features that are keeping us in business."



The teams who did it right didn't do a rewrite


Here is what I still remember. The businesses that made it through this transition, for the most part, did not accept the complete rewrite.

By rewriting Turborepo from Go to Rust over the course of the past year, Vercel faced the mammoth task of rebuilding a significant portion of their architecture... while keeping the business running. "A full rewrite is an extraordinarily expensive endeavor, not to be embarked upon lightly," co-founder Guillermo Rauch admits. As we've seen already, when it comes to rewrites it's often not the technical challenges that eclipse the plan; it's the logistical ones.

InfluxData took a different approach, it paid for it with time. CTO Paul Dix started a rewrite of the InfluxDB core from Go to Rust in 2020, and it wasn't completed until 2024.

It took us more than four years of intensive engineering work to get to the same functional level as the other solutions on the market. Only a well-funded, existing company can afford to make such a bet.

We are not InfluxData. We had a runway, not a research budget.



What I'd tell past me


The real lesson to learn here is not "Rust bad." It's that a language migration should be treated as a business decision disguised in engineering clothes.

Here's the truth I avoided:

→ Multiply the per-engineer ramp time by every engineer on the project.

→ Add the features you won't ship during that ramp.

→ Ask if your customers care about 28ms vs 340ms, or if they care about the thing you didn't build.

The answer was uncomfortable for us. Response times were not the reason why people were leaving. It was the missing features.

If you're in real pain, memory leak, GC spike, real performance wall, do it incrementally. Strangle the old service one endpoint at a time. Keep shipping.

Only do a full rewrite if you have the time and money to build a quarter of what you have now. The "Rewrite it in Rust" people always seem to forget to mention that. 😅

So, let me ask you this: Was there ever a decision that was technically right, but in the end, it's what caused your team to lose what was truly important?


Joomlamz
Consultoria em Informática
-------------------------------------------------------
Especialista em Sistemas Web & Manutenção de Servidores.
A desenvolver o novo AplPortal com suporte a PHP 8.
Precisa de ajuda profissional? Contacte-me.

Tags: