New every Friday: the week's best founder lessons in one email. Subscribe free
Back to All Episodes
Developer Chats - Petr Petrenko
Dec 17, 2025 14:44

Developer Chats - Petr Petrenko

Bonus
0:00 / 14:44

About this episode

Large-scale backends and the tension between stability and innovation: Petr Petrenko, a senior PHP backend engineer, on when systems outgrow their teams, in Developer Chats.

———

Today, we are continuing our series, entitled Developer Chats - hearing from the large scale system builders themselves.

In this episode, we are talking with Petr Petrenko, Senior PHP Backend Engineer. Petr will take us through his developer journey, in working on large scale backends, managing the tension between stability and innovation, and designing systems to interact with culturally different economies.

Questions

  • You’ve worked on large-scale backends that serve millions of users. At what point do systems start to outgrow the teams that built them?
  • At some point, every mature backend reaches a stage where rewriting is no longer realistic. How do you recognize when a system has crossed that line, and what’s the right way to handle it?
  • There’s always this tension between stability and innovation. How do you decide when a system needs refactoring versus when you just need to live with the technical debt?
  • Let’s talk about the human side of legacy systems — what have you learned about culture, documentation, and knowledge transfer that keeps old systems alive and reliable?
  • You’ve also built and maintained complex payment systems for global users. What’s something most engineers underestimate about cross-border transactions?
  • When you’re designing systems that deal with different currencies, laws, and tax regulations, how do you balance the technical with the ethical — for example, user privacy or data sovereignty?
  • For engineers listening who want to build something durable — not just fast — what advice would you give about writing code that will still make sense years from now?
  • One of your most impressive projects is a high-performance image-matching system you built yourself, capable of scanning tens of millions of images with sub-second results. Can you walk us through the moment you realized you needed to redesign the system — and what engineering choices made that level of performance possible?
  • You’ve also worked on billing systems and fraud mitigation at scale. Was there ever a moment when you had to choose between a technically “clean” solution and a solution that better protected users or the business? How did you make that call?

Sponsors

Links

Times are from the episode recording; ad breaks in your player may shift them a bit later.

Read the key answers from this episode, with quotes and timestamps from Petr Petrenko: https://www.codestory.co/episodes/developer-chats-petr-petrenko/



Current Sponsors:

Checkout our Substack

Checkout our Stacklist!

Checkout our Patreon!

Hosted by Noah Labhart.



Our Sponsors:
* Check out Granola and use my code granola.ai/CODESTORY for a great deal: https://granola.ai
* Check out Perplexity: https://pplx.ai/codestory


Advertising Inquiries: https://redcircle.com/brands

Privacy & Opt-Out: https://redcircle.com/privacy

Chapters

Featured Guest

Latest Season of the Podcast is Sponsored By

Key Takeaways

  • Rewrite Only as Last Resort: Petr sees a rewrite making sense when the tech stack must change to move forward or the system has drifted too far from its original requirements. Otherwise, refactoring and cleanup are almost always better.
  • Fix the Real Bottleneck: On a 10-plus-year-old reporting system, heavy queries on an outdated database were the problem. Two weeks of fixes cut reports from 30 minutes to 10 seconds, at under 10% of the planned rewrite budget.
  • Treat Every Cent Seriously: Different exchange rates across transaction, processing and conversion can obscure revenue, anomalies and fraud. Petr's advice is to track down even a one-cent difference and fix it.
  • Algorithms Beat Language Speed: Petr's image matcher hit a limit set by algorithmic complexity, not PHP. A better data structure, then a multithreaded C core, met the goal of about two searches per second across 100 million photos.
  • Don't Overbuild for the Future: Petr has seen ambitious small teams overcomplicate products by predicting 10 years ahead, then run out of budget. Build what users need now, without letting the code become a pile of hacks.

Frequently Asked Questions

When should you rewrite a legacy system instead of refactoring it?

Petr Petrenko says it makes sense when you can't move forward without changing the tech stack, or when the system has drifted too far from its original requirements. As Petr put it, "For me, rewriting should always be the last resort." [02:29]

How can you speed up a slow legacy system without a full rewrite?

Petrenko analyzed a reporting project where each report took 10 to 30 minutes and found that heavy queries on an outdated database were the issue. The database couldn't simply be upgraded, so the queries were fixed, and in two weeks "reports went from 30 minutes to 10 seconds." [03:47]

How was the high-performance image matching system for real estate ads built?

Petrenko tested approaches on a database of 1 million photos, researched algorithms and academic papers, and prototyped a promising data structure in PHP. To make it faster, Petr said, "I wrote core on the C and added multithreading support that gave me the required performance." [12:13]

What do engineers underestimate about cross-border payment systems?

Petrenko says multiple exchange rates make it hard to know how much money was actually made, and systems built for one market often break when expanded. Petr's guidance is direct: "My main advice is always be careful with numbers." [07:48]

How do you write code that will still make sense years from now?

Petrenko argues that aiming for durability itself is a mistake, though a codebase full of hacks and quick fixes is the opposite extreme to avoid. In Petr's words, "Our real goal is to create a product that users need right now." [09:24]

Media List 5000, Podcasts, Fall 2026