HACKER Q&A
📣 silentsea90

When to switch startup backend from Python to Golang?


Self explanatory question, but you could replace Python with NodeJS or any script like fast paced language, and Golang with Java or any sturdy compiled statically typed language

I don't want our startup to slow down much but also don't want our life to be hell (performance, code quality, jenga brick backend) later with our choices.

Did any of you start with Golang perhaps and felt you were as fast as perhaps Python would have made you?

Is there a standard canonical best practice around this?


  👤 spenczar5 Accepted Answer ✓
The limit for your startup's success is more likely to be your ability to acquire and keep users. After that, it might be your engineer's velocity - their ability to keep up with the pace of change as you learn what your users _actually_ need.

The performance of your backend can be very low on your priority list.

My experience there comes from working at Twitch. The entire video platform's backend was in Python for a long, long time - at least 5 years before some components moved to Go, piece-by-piece. The Python stuck around for over a decade in some fashion.

There are exceptions depending on what your startup does - if your fundamental _product_ depends upon serving millions of concurrent requests quickly on a really frugal budget, you probably already know that.


👤 speedgoose
The best practice in my humble opinion is to chose your stack and stick with it.

If you start with Python, you will use Python. Major rewrites in another programming language are not worth the time, the effort, nor the risk.

You could eventually replace some parts with golang to improve the performances, but that's unlikely going to be cost effective.


👤 alephu5
I spent a couple of years working on a Haskell backend and honestly the safety and performance wasn't worth it, compared to the agility of python.

Judicious use of mypy, unit testing and leaning heavily on the framework can keep things well organised

If you're hitting performance limits you likely have enough revenue to get some extra computing power and this might even be a viable long-term solution. Otherwise you can: - Build a service in the performant language - Embed C, Rust or Fortran into python

A full rewrite in a performant language is an option but almost never the right one in my experience. In any case optimise for development agility right now, which includes writing good organised code. You can cross the performance bridge when you come to it.


👤 daviddever23box
Tooling is quite good with Go and IMHO an average developer can become quite productive with it.

👤 kokizzu3
when you got enough money/growth/customers to hire devs for maintainability (but i always started with golang anyway, statically typed language = easier to reason, good for long term)

👤 satya71
Probably never. Python is plenty fast most apps. And bigger servers are cheaper than a huge rewrite.

Also, Guido and team are working full time on speeding up Python.


👤 Jugurtha
Scalability at YouTube: https://youtu.be/G-lGCC4KKok?t=610

The Python is the less likely think that will suffocate you.

What did you suffer from in past projects with each of these languages?


👤 the_drow
Never. Use PyPy if you need to speed up your servers (note the caveats regarding C extensions, if you have any being used).

👤 midrus
When you reach Google level scale and income.

So, never.