nodejs golang
GoLang has started to skyrocket in popularity over the recent years. GoLang is not a new programming language; it was conceived back in 2009 around the same time as NodeJS. Its recent gains in popularity come down to its advantages which include fast performance, portability and cloud-nativeness. In addition, GoLang is now one of the top paying programming languages.
近年来,GoLang的人气开始飙升。 GoLang并不是一种新的编程语言。 它是在2009年与NodeJS大约同一时间构思的。 它最近的受欢迎程度归结为它的优势,包括快速的性能,可移植性和云原生。 此外,GoLang现在是收入最高的编程语言之一。
However, this article is not a comparison of the advantages of GoLang vs. NodeJS. Much of that is already covered around the web. Instead, I’ll be talking about how practical GoLang is for startups like ours and why we made the decision to ditch GoLang for NodeJS.
但是,本文并不是将GoLang与NodeJS的优势进行比较。 网络上已经涵盖了许多内容。 相反,我将谈论GoLang对像我们这样的初创公司的实用性,以及我们为什么决定放弃NodeL的GoLang。
In the Beginning…
在一开始的时候…
Let’s start from the beginning. We started out with a backend stack comprising GraphQL, PostgreSQL and of course GoLang. Our engineering team started out as a band of two people — one person in backend and another in the front end working on our iOS app. When I joined the team, these two engineers were log gone but left behind a backend full of issues.
让我们从头开始。 我们从包含GraphQL,PostgreSQL和GoLang的后端堆栈开始。 我们的工程团队最初由两个人组成,一个人在后端,另一个人在前端使用我们的iOS应用程序。 当我加入团队时,这两位工程师已经消失了,但是却被遗留在后端的问题困扰。
No ORM was used so queries to the database were made explicitly. The queries written were so inefficient we kept hitting memory limits and we encountered long wait times before queries were fulfilled. The code had no architecture; it was a complete jumble of code with files all over the place. No GraphQL library was used with GoLang. It was clear the previous backend engineer was trying to go completely vanilla which was not an ideal path to take if you want to scale quickly.
没有使用ORM,因此显式查询数据库。 编写的查询非常低效,以至于不断达到内存限制,并且在执行查询之前遇到了漫长的等待时间。 该代码没有架构。 这是一堆完整的代码,其中到处都是文件。 GoLang没有使用GraphQL库。 很明显,以前的后端工程师正在尝试完全精简,如果要快速扩展,这不是理想的选择。
GoLang Itself Was Not the Problem
GoLang本身不是问题
None of these issues are GoLang specific problems. These were problems introduced by an engineer who was not competent with GoLang. This presented our startup with a problem. There are very few GoLang engineers and even less competent ones. We found ourselves hiring and dismissing two GoLang engineers each attempting to patch the problems in our backend but without success. Competent engineers are expensive and at the time well beyond the budget of our young startup.
这些问题都不是GoLang特定的问题。 这些是由不具备GoLang能力的工程师提出的问题。 这给我们的创业公司带来了问题。 GoLang工程师很少,而胜任的工程师也更少。 我们发现自己雇用和解雇了两名GoLang工程师,每个工程师都试图修补后端的问题,但没有成功。 胜任的工程师非常昂贵,而且远远超出了我们年轻创业公司的预算。
As a startup we were racing towards bringing an MVP version of our app to market and this meant we needed speed. A small set of libraries available for GoLang and GraphQL coupled with a small community meant we were hacking our way through problems at a slow pace. Add to this our inexperience with GoLang, we spent more time fixing problems than building features. The app itself was destined to become more complex which meant things were not sustainable in the long term. We needed an alternative.
作为一家初创公司,我们正在努力将应用的MVP版本推向市场,这意味着我们需要速度。 一小部分可用于GoLang和GraphQL的库,再加上一个小型社区,这意味着我们正在缓慢解决问题。 除此之外,我们对GoLang的经验不足,我们花费更多的时间解决问题而不是构建功能。 该应用程序本身注定会变得更加复杂,这意味着从长远来看,这种情况是不可持续的。 我们需要一个替代方案。
The Move to NodeJS
迁移到NodeJS
At some point, we sat down to discuss re-writing our backend. We needed to address the following issues:
在某个时候,我们坐下来讨论重写后端。 我们需要解决以下问题:
- We needed a competent backend engineer at a fair market price our startup could afford.
- We needed a backend stack with lots of pre-baked solutions to common problems to move at speed.
- We needed a backend stack with enough resources out there to solve for less common problems as we approached complexity.
Our decision was to replace GoLang with NodeJS. This addressed all our issues which really centered on speed and cost.
我们的决定是用NodeJS代替GoLang。 这解决了我们所有真正集中在速度和成本上的问题。
- NodeJS has a larger market of engineers available than GoLang.
- Experienced NodeJS engineers are much cheaper than GoLang engineers.
- NodeJS has many existing packages to solve for common problems enabling us to focus on building our app and not fixing the app.
To conclude, our decision to move to NodeJS was largely based on business dynamics of our startup. Whereas it’s often debated whether NodeJS or GoLang fits into your project depending on technical merits of the project, ours came down to what would move us forward from prototype to MVP in a reasonable time frame.
总而言之,我们迁移到NodeJS的决定很大程度上取决于我们创业公司的业务动态。 尽管经常会根据项目的技术优劣来争论NodeJS或GoLang是否适合您的项目,但我们的问题归结为在合理的时间内使我们从原型发展到MVP的原因。
nodejs golang