BytePower 技术周刊 - 027

2022/9/28

# BytePower 技术周刊 - 027

# 📘 封面

安赫尔瀑布,又被称为天使瀑布。 委内瑞拉玻利瓦尔(Bolivar)州圭亚那高原卡罗尼(Caroni)河支流丘伦河(Rio Churun)上的瀑布。 落差 979 米(3,212 英尺),为世界上落差第一大的瀑布。底宽 150 米(492 英尺)。瀑布被密林遮掩,宜从空中赏看。| 来自百度百科

# 📖 文章

# 搞懂异地多活,看这篇就够了 (opens new window)(中文)

  1. 一个好的软件架构,应该遵循高性能. 高可用. 易扩展 3 大原则,其中「高可用」在系统规模变得越来越大时,变得尤为重要
  2. 系统发生故障并不可怕,能以「最快」的速度恢复,才是高可用追求的目标,异地多活是实现高可用的有效手段
  3. 提升高可用的核心是「冗余」,备份. 主从副本. 同城灾备. 同城双活. 两地三中心. 异地双活,异地多活都是在做冗余
  4. 同城灾备分为「冷备」和「热备」,冷备只备份数据,不提供服务,热备实时同步数据,并做好随时切换的准备
  5. 同城双活比灾备的优势在于,两个机房都可以接入「读写」流量,提高可用性的同时,还提升了系统性能。虽然物理上是两个机房,但「逻辑」上还是当做一个机房来用
  6. 两地三中心是在同城双活的基础上,额外部署一个异地机房做「灾备」,用来抵御「城市」级别的灾害,但启用灾备机房需要时间
  7. 异地双活才是抵御「城市」级别灾害的更好方案,两个机房同时提供服务,故障随时可切换,可用性高。但实现也最复杂,理解了异地双活,才能彻底理解异地多活
  8. 异地多活是在异地双活的基础上,任意扩展多个机房,不仅又提高了可用性,还能应对更大规模的流量的压力,扩展性最强,是实现高可用的最终方案

# H.264 is Magic (opens new window)(英文)

H.264 is a video compression codec standard. It is ubiquitous - internet video, Blu-ray, phones, security cameras, drones, everything. Everything uses H.264 now.

H.264 is a remarkable piece of technology. It is the result of 30+ years of work with one single goal: To reduce the bandwidth required for transmission of full-motion video.

# 字节微服务 HTTP 框架:Hertz (opens new window)

Hertz[həːts] 是一个 Golang 微服务 HTTP 框架,在设计之初参考了其他开源框架 fasthttp、gin、echo 的优势,并结合字节跳动内部的需求,使其具有高易用性、高性能、高扩展性等特点,目前在字节跳动内部已广泛使用。如今越来越多的微服务选择使用 Golang,如果对微服务性能有要求,又希望框架能够充分满足内部的可定制化需求,Hertz 会是一个不错的选择。

# JavaScript’s Newest Framework: Bun. Will It Take Node’s Crown? (opens new window)(英文)

# What is Bun?

Bun is the newest addition to the JavaScript family. It has been making waves that rival those made by Deno when it came out in 2018. Bun sits in the space between Node and Deno. Bun, like Deno, supports TypeScript out of the box and offers developer-friendly features such as top-level awaits and built-in Web APIs. But, unlike Deno, Bun is intended to be a drop-in replacement for Node, Webpack, Babel, Yarn, and PostCSS — all in one neat package.

# Stop Using TODO for Everything (opens new window)(英文)

Stop using TODO for everything in your comments that requires you to do something later. It’s not that “comments are bad,” or that “you should just use an issue tracker instead.” It’s that there’s some handy, significantly more descriptive alternatives:

  • FIXME: something is broken
  • HACK/OPTIMIZE: the code is suboptimal and should be refactored
  • BUG: there is a bug in the code
  • CHECKME/REVIEW: the code needs to be reviewed
  • DOCME: the code needs to be documented (either in codebase or external documentation)
  • TESTME: the specified code needs to be tested or that tests need to be written for that selection of code

# Replication(下):事务,一致性与共识 (opens new window)(中文)

一致性(Consistency):这个名词有太多的重载,也就是说它在不同语境中含义会截然不同,但可能又有联系,这就可能让我们陷入混乱,比如:

  • 数据复制时,副本间具有一致性,这个一致性应该指上一章中提到的不同副本状态的一致。
  • 一致性 Hash,这是一种分区算法,个人理解是为了能够在各种情况下这个 Hash 算法都可以以一致的方式发挥作用。
  • CAP 定理中的一致性指的是后面要介绍的一个特殊的内部一致性,称为“线性一致性”。 我们稍后要介绍 ACID 中的一致性,指的是程序的某些“不变式”,或“良好状态”。 我们需要区分不同语境中一致性所表达含义的区别,也希望大家看完今天的分享,能更好地帮助大家记住这些区别。话说回来,这里的一致性只的是对于数据一组特定陈述必须成立,即“不变式”,有点类似于算法中的“循环不变式”当外界环境发生变化时,这个不变式一定需要成立。

# 🧰 工具

# iPreview (opens new window)

macOS 的预览是一个实用的功能,但是有些文件不支持。这一款效率应用,不仅仅解决了 macOS 上某些文件无法支持 Quick Look 的问题,还提供了更多个性化、实用性的功能。

# GitJournal (opens new window)

Mobile first Markdown Notes integrated with Git

# TreeSheets (opens new window)

独特的组织数据的方式。

# Gamma (opens new window)

上次更新: 2022/9/28 19:29:02