Tản mạn về complexity
date
Jun 1, 2022
slug
tan-man-ve-complexity
status
Published
tags
system design
computer science
benchmark
summary
type
Post
Hôm nay dậy sớm rãnh đọc về Linkerd thì đọc được một đoạn thế này:
As a point of comparison, as of November 2020, the Envoy repo weighs in at 172 KLOC of C++ code, with a “complexity score” (measured in terms of branches and loops) of 19k.3 By contrast, Linkerd2-proxy comes in at 30 KLOC and has a complexity score of 1.5k. In other words: the Linkerd2-proxy codebase is 5 times smaller than Envoy and, by this measure, its complexity is ten times less than Envoy’s.4
This isn’t an apples-to-apples calculation, of course. It doesn’t capture the libraries or dependencies outside the repos; the complexity score numbers are not strictly portable across languages; and so on. But it should give you a general sense of the relative size of these projects: internally, Linkerd2-proxy is orders of magnitude smaller and simpler than Envoy
Is this complexity a moral failing in Envoy? No. Again, Envoy has a lot of complex code because it can do a lot of complex things. However, this complexity is a very difficult foundation upon which to build a project that is focused on simplicity, especially operational simplicity.5
Tl;dr: Envoy is a Swiss Army knife. Linkerd2-proxy is a needle
Thật là đằm thắm. Cuối cùng vẫn là người dùng quyết định chọn Envoy đa dụng hay Linkerd2-proxy chuyên dụng.