StackOverflow 上離開 Vim 方法的文章...

被拿出來當 PR 宣傳了:「Stack Overflow: Helping One Million Developers Exit Vim」。

由於 Vim 是 Unix-like 系統一定會內建的 editor,所以常常被拿來放在 tutorial 裡面 (考慮到普及性,但完全不熟的初學者就...),或是不小心在輸入 vipw 或是 visudo 之類的指令就中獎了:

可以看到 pageview 破一百萬次了 XDDD 而且流量也都很穩定:

依照地區來拆開的話:(不過沒有照人口數正規化...)

然後做交叉分析,看這些卡在 Vim 的人平常是看什麼其他的文章:

回到資料分析的角度來看,這些東西可以透過有 cookie 的 access log 做到。有 access log 後可以用 Google CloudBigQuery,也可以用 AWS 家的 Amazon Athena 做。

iOS 上 Spotlight Search 如果很慢...

看到「Disabling Slack Indexing Seems to Improve Spotlight Performance on iOS」這篇講 iOS 的 Spotlight Search 很慢的問題,作者後來找到與 Slack 有關?到這邊關掉就正常了:

Settings > General > Spotlight Search > toggle Slack off

我是沒遇到... 不過先寫起來,如果以後遇到時應該會有幫助。

又是 ImageMagick 出包...

ImageMagick 的 information leaking,然後 Yahoo! 很無奈的中獎,所以被稱為 Yahoobleed:「Yahoo! retires! bleeding! ImageMagick! to! kill! 0-day! vulnerability!」。發現問題的作者把問題寫在「*bleed continues: 18 byte file, $14k bounty, for leaking private Yahoo! Mail images」這邊。

作者利用 ImageMagick 的不當處理,取得 uninitialized memory 的資訊,藉以取得可能是上次轉檔的記憶體內容。而這個 jpeg 只有 18bytes (所以作者戲稱每個 byte 價值 USD$778):

A robust bounty of $14,000 was issued (for this combined with a similar issue, to be documented separately). $778 per byte -- lol!

目前的 workaround 也很簡單 (官方採用了),呼叫 ResetMagickMemory 避免 leaking (咦,這方法好像哪邊怪怪的):「Reset memory for RLE decoder (patch provided by scarybeasts)」。

Heroku CI 正式推出

月初才提到「Heroku 也要進入 CI 市場...」,前幾天就開放使用了:「Heroku CI Is Now Generally Available: Fast, Low Setup CI That’s Easy to Use」。

收費方式是依照 Heroku Pipelines 收費,一個 Heroku Pipelines 是 USD$10/month:

Each CI-enabled Heroku Pipeline is charged just $10/month for an unlimited number of test runs.

比起其他棚是無限量 Travis CI 的 $69/month (1 concurrent job,不限時間),或是 CircleCI 的 Free 方案 (1 concurrent job,限時每個月 1500 分鐘) 或是 USD$50/month (2 concurrent job,不限時間),感覺有些微妙...

感覺還是先繼續用 Travis CI 好了,目前 Open Source Project 的標準,路邊可以隨便檢到很多範例用... (像是用 Google".travis.yml" "language:php" site:github.com 就可以找到很多 PHP 的範例)

CockroachDB 1.0

CockroachDB 推出 1.0 版:「CockroachDB 1.0 is Production-Ready」。CockroachDB 是希望在分散式環境裡打造出有 ACID 特性的服務,這點類似於 GoogleSpanner 架構。

整個系統主要是用 Go 寫成,支援 PostgreSQL 協定,這讓許多現成的應用可以接上去:

Use existing PostgreSQL client drivers or supported ORMs.

而另外一邊有支援 MySQL 協定的 TiDB (剛好也是用 Go 寫的),整個 NewSQL 領域東西愈來愈多了...

zetcd:用 etcd 跑 ZooKeeper 架構

在「zetcd: running ZooKeeper apps without ZooKeeper」這邊介紹了用 etcd 當作 ZooKeeper 伺服器。程式碼在「Serve the Apache Zookeeper API but back it with an etcd cluster」這邊可以看到。

不過可以看到有不少 overhead:

但 etcd 用 Go 寫 (省下 JVM tuning?),可能是個不錯的誘因...

MySQL 8.0 對 4 bytes UTF-8 的效能改善

在「MySQL 8.0: When to use utf8mb3 over utf8mb4?」這邊提到了 MySQLutf8 以及 utf8mb4 的故事,以及在 MySQL 8.0 預期的效能提昇:

可以看到 Oracle 的團隊花了不少力氣提昇 utf8mb4 的效能。另外提到了在 5.7 的時候將 row format 的預設值轉成 DYNAMIC

MySQL 5.7 (2015) added some optimizations such as a variable length sort buffer, and also changed InnoDB’s default row format to DYNAMIC. This allows for indexes on VARCHAR(255) with utf8mb4; something that made migrations more difficult prior.

依照「14.11.3 DYNAMIC and COMPRESSED Row Formats」這邊的敘述,看起來 COMPRESSED 也應該支援一樣的特性,不過不確定... (因為通常不會完整 index 整個 VARCHAR(255),只會 index 某個 prefix length):

The COMPRESSED row format uses similar internal details for off-page storage as the DYNAMIC row format, with additional storage and performance considerations from the table and index data being compressed and using smaller page sizes.

Slack 的 Screen Sharing

Slack 付費版將有 Screen Sharing 的功能了,對於 Remote Work 的團隊又更方便了:「Screen sharing comes to Slack video calls」。

When you’re working with teammates over a Slack video call, you may have something — a document, a chunk of code, the latest designs — that you want to share with your team. Now you can. Screen sharing is now available across teams on Slack’s paid plans.

需要使用 Windows 與 Mac 版的 desktop 處理:

Screen sharing is rolling out over the next few days to paid teams on the latest versions of our Slack for Mac and Slack for Windows desktop apps.

用 Go 寫的 Badger

Dgraph 在推銷自家發展出來的 Badger:「Introducing Badger: A fast key-value store written natively in Go」。

標靶是 RocksDB,號稱比 RocksDB 快好幾倍:

Based on benchmarks, Badger is at least 3.5x faster than RocksDB when doing random reads. For value sizes between 128B to 16KB, data loading is 0.86x - 14x faster compared to RocksDB, with Badger gaining significant ground as value size increases. On the flip side, Badger is currently slower for range key-value iteration, but that has a lot of room for optimization.

不過我覺得有些重要的功能在 Badger 不提供,這比起來有種橘子比蘋果的感覺... 像是 RocksDB 提供了 Transaction,而 Badger 則是直接講明他們不打算支援 Transaction:

Keep it simple, stupid. No support for transactions, versioning or snapshots -- anything that can be done outside of the store should be done outside.

對於是否要用 Container (Docker) 的檢查表

這篇積的有點久,但很不錯的一篇文章 (以條列出來的東西來看):「Instead of containerization, give me strong config & deployment primitives」。

作者遇到了現在很多團隊「因為潮/因為好像可以解決問題,而想要用 Docker」,在沒有想清楚的情況跳下去用,發現沒解決本來的問題,反而製造了一堆問題。

如果你已經在用 AWS,那麼 Docker 相較於 AWS 大致上只有一個優點,也就是開啟速度很快 (因為是 container 的特性)。Docker 的另外幾個優點在 AWS 上是不存在的,包括了 immutable 以及隔離性。

在 AWS 上使用 Docker 反而有不少麻煩,像是要處理 AutoScaling + Service Discovery 時整合的問題,以及 storage 問題。這些都需要另外花力氣處理。

另外一個常聽到的是「讓開發環境與線上環境一致」的議題常常是假議題,對於有照 The Twelve-Factor App 避免寫出有 bad smell code 的程式,開發環境用 Docker,正式環境用標準的 EC2 其實不會有太大問題。

PS:雖然我覺得 The Twelve-Factor App 裡面有些想法有點走火入魔,但對於大多數情況,裡面寫的其實不錯。