选择无聊的技术:降低长期维护成本
Probably the single best thing to happen to me in my career was having had Kellan placed in charge of me. I stuck around long enough to see Kellan’s technical decisionmaking start to bear fruit. I learned a great deal from this, but I also learned a great deal as a result of this. I would not have been free to become the engineer that wrote Data Driven Products Now! if Kellan had not been there to so thoroughly stick the landing on technology choices.
在我职业生涯中,发生在我身上最好的事情可能就是让Kellan来负责指导我。我坚持了足够长的时间,看到了Kellan的技术决策开始结出硕果。我从中受益匪浅,但也因此学到了很多。如果Kellan没有如此彻底地在技术选择上成功落地,我就不可能自由地成为写出《数据驱动产品现在!》的工程师。
Being inspirational as always.
一如既往地鼓舞人心。
In the year since leaving Etsy, I’ve resurrected my ability to care about technology. And my thoughts have crystallized to the point where I can write them down coherently. What follows is a distillation of the Kellan gestalt, which will hopefully serve to horrify him only slightly.
离开Etsy后的一年里,我重新恢复了对技术的热情。我的想法已经清晰到可以连贯地写下来。以下是对Kellan思想的提炼,希望这只会让他稍微感到震惊。
Embrace Boredom.
拥抱无聊。
Let’s say every company gets about three innovation tokens. You can spend these however you want, but the supply is fixed for a long while. You might get a few more after you achieve a certain level of stability and maturity, but the general tendency is to overestimate the contents of your wallet. Clearly this model is approximate, but I think it helps.
假设每家公司大约有三张创新代币。你可以随意使用这些代币,但供应在很长一段时间内是固定的。在你达到一定程度的稳定和成熟之后,你可能会得到更多,但总的趋势是高估你钱包里的内容。显然这个模型是近似的,但我认为它很有帮助。
If you choose to write your website in NodeJS, you just spent one of your innovation tokens. If you choose to use MongoDB, you just spent one of your innovation tokens. If you choose to use service discovery tech that’s existed for a year or less, you just spent one of your innovation tokens. If you choose to write your own database, oh god, you’re in trouble.
如果你选择用NodeJS编写你的网站,你就花掉了一张创新代币。如果你选择使用MongoDB,你就花掉了一张创新代币。如果你选择使用存在时间不超过一年的服务发现技术,你就花掉了一张创新代币。如果你选择自己编写数据库,哦天哪,你麻烦了。
Any of those choices might be sensible if you’re a javascript consultancy, or a database company. But you’re probably not. You’re probably working for a company that is at least ostensibly rethinking global commerce or reinventing payments on the web or pursuing some other suitably epic mission. In that context, devoting any of your limited attention to innovating ssh is an excellent way to fail. Or at best, delay success [1].
如果你是一家JavaScript咨询公司或数据库公司,这些选择中的任何一个都可能是明智的。但你可能不是。你可能在一家至少表面上在重新思考全球商业或重塑网络支付或追求其他类似史诗级使命的公司工作。在这种情况下,将你有限的注意力投入到创新ssh上是失败的好方法。或者,充其量是延迟成功[1]。
What counts as boring? That’s a little tricky. “Boring” should not be conflated with “bad.” There is technology out there that is both boring and bad [2]. You should not use any of that. But there are many choices of technology that are boring and good, or at least good enough. MySQL is boring. Postgres is boring. PHP is boring. Python is boring. Memcached is boring. Squid is boring. Cron is boring.
什么算无聊?这有点棘手。“无聊”不应与“糟糕”混为一谈。有些技术既无聊又糟糕[2]。你不应该使用那些。但有很多技术选择既无聊又好,或者至少足够好。MySQL是无聊的。Postgres是无聊的。PHP是无聊的。Python是无聊的。Memcached是无聊的。Squid是无聊的。Cron是无聊的。
The nice thing about boringness (so constrained) is that the capabilities of these things are well understood. But more importantly, their failure modes are well understood. Anyone who knows me well will understand that it’s only with a overwhelming sense of malaise that I now invoke the spectre of Don Rumsfeld, but I must.
无聊技术(如此受限)的好处在于,这些技术的能力已被充分理解。但更重要的是,它们的故障模式也被充分理解。任何了解我的人都会明白,只有带着极度不适感,我才会提起唐纳德·拉姆斯菲尔德的幽灵,但我必须这么做。
To be clear, fuck this guy.
明确地说,去他的这家伙。
When choosing technology, you have both known unknowns and unknown unknowns [3].
在选择技术时,你既面临已知的未知,也面临未知的未知[3]。
- A known unknown is something like: we don’t know what happens when this database hits 100% CPU.
- An unknown unknown is something like: geez it didn’t even occur to us that writing stats would cause GC pauses.
- 已知的未知,比如:我们不知道当这个数据库达到100% CPU时会发生什么。
- 未知的未知,比如:天哪,我们甚至没想到写入统计数据会导致GC暂停。
Both sets are typically non-empty, even for tech that’s existed for decades. But for shiny new technology the magnitude of unknown unknowns is significantly larger, and this is important.
这两类问题通常都不为空,即使是已经存在数十年的技术也是如此。但对于闪亮的新技术,未知的未知的规模要大得多,这一点很重要。
Optimize Globally.
全局优化。
I unapologetically think a bias in favor of boring technology is a good thing, but it’s not the only factor that needs to be considered. Technology choices don’t happen in isolation. They have a scope that touches your entire team, organization, and the system that emerges from the sum total of your choices.
我毫不抱歉地认为,偏向无聊技术是件好事,但这并不是唯一需要考虑的因素。技术选择并非孤立发生。它们的影响范围触及你的整个团队、组织,以及由你所有选择总和所涌现出的系统。
Adding technology to your company comes with a cost. As an abstract statement this is obvious: if we’re already using Ruby, adding Python to the mix doesn’t feel sensible because the resulting complexity would outweigh Python’s marginal utility. But somehow when we’re talking about Python and Scala or MySQL and Redis people lose their minds, discard all constraints, and start raving about using the best tool for the job.
为公司添加技术是有成本的。作为抽象陈述,这显而易见:如果我们已经在使用Ruby,再加入Python似乎并不明智,因为由此产生的复杂性会超过Python的边际效用。但不知何故,当我们谈论Python和Scala或MySQL和Redis时,人们会失去理智,抛弃所有约束,开始狂热地谈论使用最适合工作的工具。
Your function in a nutshell is to map business problems onto a solution space that involves choices of software. If the choices of software were truly without baggage, you could indeed pick a whole mess of locally-the-best tools for your assortment of problems.
你的职责简而言之就是将业务问题映射到涉及软件选择的解决方案空间。如果软件选择真的没有负担,你确实可以为你的各种问题挑选一大堆局部最优的工具。
Crazy Created with Sketch. Problems Technical Solutions
疯狂 用草图创建。 问题 技术解决方案
The way you might choose technology in a world where choices are cheap: "pick the right tool for the job."
在技术选择成本低廉的世界里,你可能会这样选择技术:“为工作挑选合适的工具。”
But of course, the baggage exists. We call the baggage “operations” and to a lesser extent “cognitive overhead.” You have to monitor the thing. You have to figure out unit tests. You need to know the first thing about it to hack on it. You need an init script. I could go on for days here, and all of this adds up fast.
但当然,负担是存在的。我们称这种负担为“运维”,在较小程度上称为“认知开销”。你必须监控它。你必须弄清楚单元测试。你需要对它有所了解才能进行黑客攻击。你需要一个初始化脚本。我可以在这里说上好几天,而所有这些都会迅速累积。
Sane Created with Sketch. Problems Technical Solutions
理智 用草图创建。 问题 技术解决方案
The way you choose technology in the world where operations are a serious concern (i.e., "reality").
在运维是严肃问题的世界里(即“现实”),你选择技术的方式。
The problem with “best tool for the job” thinking is that it takes a myopic view of the words “best” and “job.” Your job is keeping the company in business, god damn it. And the “best” tool is the one that occupies the “least worst” position for as many of your problems as possible.
“为工作选择最佳工具”这种思维的问题在于,它对“最佳”和“工作”这两个词持一种短视的看法。你的工作是让公司活下去,天哪。而“最佳”工具是那个在尽可能多的你的问题中占据“最不差”位置的工具。
It is basically always the case that the long-term costs of keeping a system working reliably vastly exceed any inconveniences you encounter while building it. Mature and productive developers understand this.
基本上总是如此:保持系统可靠运行的长期成本,远远超过你在构建它时遇到的任何不便。成熟且高效的开发者明白这一点。
Choose New Technology, Sometimes.
有时,选择新技术。
Taking this reasoning to its reductio ad absurdum would mean picking Java, and then trying to implement a website without using anything else at all. And that would be crazy. You need some means to add things to your toolbox.
将这种推理推向极端,就意味着选择Java,然后尝试仅用Java来实现一个网站,而不使用任何其他东西。那将是疯狂的。你需要一些方法来为你的工具箱添加东西。
An important first step is to acknowledge that this is a process, and a conversation. New tech eventually has company-wide effects, so adding tech is a decision that requires company-wide visibility. Your organizational specifics may force the conversation, or they may facilitate developers adding new databases and queues without talking to anyone. One way or another you have to set cultural expectations that this is something we all talk about.
重要的第一步是承认这是一个过程,也是一场对话。新技术最终会影响整个公司,因此添加技术是一个需要全公司可见性的决策。你的组织具体情况可能会强制进行对话,或者它们可能会让开发者在不与任何人沟通的情况下添加新的数据库和队列。无论如何,你必须设定文化期望,即这是我们所有人都要讨论的事情。
One of the most worthwhile exercises I recommend here is to consider how you would solve your immediate problem without adding anything new. First, posing this question should detect the situation where the “problem” is that someone really wants to use the technology. If that is the case, you should immediately abort.
我在这里推荐的最有价值的练习之一是,考虑如何在不添加任何新东西的情况下解决你眼前的问题。首先,提出这个问题应该能检测到“问题”实际上是有人想使用这项技术的情况。如果是这样,你应该立即中止。
I just watched a webinar about this graph database, we should try it out.
我刚看了一个关于这个图数据库的网络研讨会,我们应该试试。
It can be amazing how far a small set of technology choices can go. The answer to this question in practice is almost never “we can’t do it,” it’s usually just somewhere on the spectrum of “well, we could do it, but it would be too hard” [4]. If you think you can’t accomplish your goals with what you’ve got now, you are probably just not thinking creatively enough.
一小套技术选择能走多远,这可能会令人惊讶。这个问题的答案在实践中几乎从来不是“我们做不到”,而通常只是在“嗯,我们可以做到,但太难了”这个范围内[4]。如果你认为用现有的东西无法实现你的目标,你可能只是没有足够创造性地思考。
It’s helpful to write down exactly what it is about the current stack that makes solving the problem prohibitively expensive and difficult. This is related to the previous exercise, but it’s subtly different.
写下当前技术栈中究竟是什么使得解决问题变得过于昂贵和困难,这会很有帮助。这与之前的练习相关,但略有不同。
New technology choices might be purely additive (for example: “we don’t have caching yet, so let’s add memcached”). But they might also overlap or replace things you are already using. If that’s the case, you should set clear expectations about migrating old functionality to the new system. The policy should typically be “we’re committed to migrating,” with a proposed timeline. The intention of this step is to keep wreckage at manageable levels, and to avoid proliferating locally-optimal solutions.
新技术选择可能纯粹是增量式的(例如:“我们还没有缓存,所以让我们添加memcached”)。但它们也可能与您已经在使用的东西重叠或替换。如果是这种情况,您应该对将旧功能迁移到新系统设定明确的期望。政策通常应该是“我们致力于迁移”,并附上提议的时间表。此步骤的目的是将破坏控制在可管理的水平,并避免扩散局部最优的解决方案。
This process is not daunting, and it’s not much of a hassle. It’s a handful of questions to fill out as homework, followed by a meeting to talk about it. I think that if a new technology (or a new service to be created on your infrastructure) can pass through this gauntlet unscathed, adding it is fine.
这个过程并不令人生畏,也不麻烦。它只是作为家庭作业填写几个问题,然后开会讨论。我认为,如果一项新技术(或要在您的基础设施上创建的新服务)能够毫发无损地通过这一考验,那么添加它是可以的。
Just Ship.
只管发布。
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力