Percona 對 mysql_query_cache 的測試 (以 Magento 為例)

Percona 的人以現在的觀點來看 mysql_query_cache:「The MySQL query cache: Worst enemy or best friend?」。

起因主要也是懷疑 query cache 是 global mutex 在現在的硬體架構 (主要是 CPU 數量成長) 應該是個負面的影響,但不確定影響多少:

The query cache is well known for its contentions: a global mutex has to be acquired for any read or write operation, which means that any access is serialized. This was not an issue 15 years ago, but with today’s multi-core servers, such serialization is the best way to kill performance.

這邊就有點怪了,PK search 應該是個位數 ms 等級才對 (一般 EC 網站的資料量都應該可以 memory fit),不知道他是怎麼測的:

However from a performance point of view, any query cache hit is served in a few tens of microseconds while the fastest access with InnoDB (primary lookup) still requires several hundreds of microseconds. Yes, the query cache is at least an order of magnitude faster than any query that goes to InnoDB.

anyway,他實際測試兩個不同的 configuration,首先是打開 query cache 的:

再來是關閉 query cache 的:

測試的方式在原文有提到,這邊就不抄過來了。測試的結果可以看到關閉 query cache 得到比較好的 thoughput:

Throughput scales well up to somewhere between 10 and 20 threads (for the record the server I was using had 16 cores). But more importantly, even at the higher concurrencies, the overall throughput continued to increase: at 20 concurrent threads, MySQL was able to serve nearly 3x more queries without the query cache.

跟預期的差不多,硬體的改變使得演算法也必須跟著改,不然就會遇到問題...

Amazon SWF 可以透過 AWS Lambda 做事了...

Amazon Simple Workflow 先前會需要開一台機器起來做事,現在則可以透過 AWS Lambda 來處理了:「Trigger AWS Lambda Functions Using Amazon Simple Workflow」。

這樣有兩個好處,一個是 AWS Lambda 啟動速度快太多,最慢應該是在數秒內,相較於透過 Amazon EC2 的啟動快太多。

另外一個當然是成本考量,開一台機器的成本還是要算成一個小時,而 AWS Lambda 是以 100ms 計費。如果做的事情很少,用 AWS Lambda 的成本低太多。

對於輕量級的處理來說算是個很棒的改善... 當然本來就是要轉檔之類吃大量 CPU 的,還是要開機器比較好。

nginx 宣佈了 Early Alpha 版本的 HTTP/2 支援

nginx 宣佈了 Early Alpha 的 HTTP/2 支援:「Announcing an Early Alpha Patch for HTTP/2」。

除了警告這是早期版本不應該用在 production 上,另外也說明了目前的 patch 會讓 SPDY 失效:

Applying this patch removes the SPDY module from the NGINX codebase and replaces it with the HTTP/2 module. After applying this patch, you can no longer configure NGINX to use SPDY.

而在這之後也不會讓 HTTP/2 與 SPDY 同時並存:

This will also be the case for the production-ready release of the HTTP/2 implementation in both NGINX and NGINX Plus. SPDY is being deprecated by Google in early 2016, so there is no need to support both.

但從 HTTP/2 的支援度SPDY 的支援度來看,行動裝置都還不支援 HTTP/2,但 iOS 8.4 以及 Android 3+ 都已經支援 SPDY 了,這樣看起來非常的傷啊...

不知道到年底會有什麼其他解決方案出現...

AWS Device Farm 支援 iOS Device 了

AWS 前幾天宣佈將在 8/4 發表 AWS Device Farm 支援 iOS 的消息,剛剛看到了:「AWS Device Farm adds support for iOS – Test your iOS, Android and Fire OS apps against real devices in the AWS Cloud」。

在「Device List」這邊可以看到所有支援的機種,iOS 的部份包括了 iPadiPhoneiPod Touch,看起來只有比較新的機種有支援...

Amazon S3 的改善

在「Amazon S3 Introduces New Usability Enhancements」這邊提到了 Amazon S3 的兩個改善。

第一個是業務面的改善,以前應該是開 support ticket 請人調整 S3 bucket 數量上限,現在則是可以直接透過界面申請?(沒有遇過瓶頸,不知道以前是不是在界面上看不到...)

第二個才是重頭戲:Read-after-write Consistency。

With this enhancement, Amazon S3 now supports read-after-write consistency in all regions for new objects added to Amazon S3.

也就是說,Amazon S3 現在保證「新增的 object」「可以在建立後馬上被讀取」。之前還沒修正前,這個問題有多嚴重呢?可以看 2014 年時「Netflix 對 S3 的 Eventually Consistency 的補強...」這邊 Netflix 在跑 PigHive 遇到的問題。

Netflix 這邊舉的例子是兩個 Pig cluster 在跑,其中 Pig-2 需要 Pig-1 跑出來的資料,在這次公告前,如果 Pig-1 的資料寫回 Amazon S3 時不會馬上出現,那麼 Pig-2 就會拿不完整的資料執行:

Pig-2 is activated based on the completion of Pig-1 and immediately lists the output directories of the previous task. If the S3 listing is incomplete when the second job starts, it will proceed with incomplete data.

而現在總算是保證新的 object 可以馬上被讀取,所以 Netflix 可以利用一個檔案列出所有的 filename,確保知道所有的檔案名稱... (LIST 指令還是 eventually consistent,所以這部份還是要自己處理)

把 AWS 的紀錄串起來倒進 Elasticsearch,用 Kibana 呈現

在「CloudWatch Logs Subscription Consumer + Elasticsearch + Kibana Dashboards」這篇文章裡,AWS 官方給了很棒的 screenshot,用一堆服務包起來後可以得到這樣的效果,提供給有興趣的人:

InnoDB 的 checkpoint 問題,以及 RocksDB...

Percona 的「InnoDB checkpoint strikes back」這篇提到了 InnoDB 的 checkpoint 問題一直困擾著 MySQL 使用者,但其中讓我注意到的是,文中提到了 RocksDB 沒有這個困擾:

Interestingly enough, RocksDB, because it has a different architecture (I may write on it in future, but for now I will point to RocksDB Wiki), does not have this problem with checkpoints (it however has its own background activity, like level compactions and tombstone maintenance, but it is a different topic).

我記得 Facebook 的人有用 RocksDB 掛到 MySQL 上:「RocksDB Storage Engine for MySQL」,會整合到 WebScaleSQL 裡嗎?還是單純拋出來看看?:o

Linode 德國機房啟用

有在追蹤 LinodeTwitter @linode 就會知道前陣子 Linode 一直在測試德國機房,而最近正式公開啟用了:「Introducing Linodes in Frankfurt!」。

HiNetspeedtest.frankfurt.linode.com 測試有兩種不同的結果。

一種是 IPv4 的,會走 Sprint 交換,在美國轉入 TeliaSonera 後,一路到德國 Linode 機房。扣掉本地端的 latency 大約是 320ms。

另外一種是 IPv6,HiNet 會跟 Hurricane Electric 交換後一路跑 Hurricane Electric 骨幹,在德國進入 Linode 機房,一樣扣掉本地端的 latency 大約是 285ms,意外的快了不少?

然後是 Linode 的廣告詞:

Frankfurt is an important financial and Internet hub for Europe, with a third of Europe’s Internet traffic going through it. Frankfurt is home to DE-CIX, the largest Internet exchange in the world in terms of traffic. DE-CIX will no doubt provide abundant peering access opportunities for us, over time.

不知道有沒有機會再加開其他亞洲的機房... (東京滿了...)

BGPmon 推出 BGP Stream 警告異常的 BGP 流量劫持

也是兩個禮拜前的新聞,在「OpenDNS BGP Stream Twitter Feed」這邊提到了 BGPmon 將會推出 BGP Stream 服務,將偵測到的 BGP 異常變化發到 Twitter 上。

其中 BGPmon 在幾個月前被 OpenDNS 併購 (2015 年 3 月),而 Cisco 則在上上個月底併購了 OpenDNS (2015 年 6 月)。而在過幾天的 DefCon 23 上將會透露更多細節。

前陣子 Hacking Team 洩漏的資料中就用到了 BGP hijack 來取回控制權:

That nugget that emerged from the 400 Gb of stolen Hacking Team data posted online where Italian law enforcement used Hacking Team’s Remote Control System monitoring software to regain control over a number IP addresses it was watching that were already infected with Hacking Team software by hijacking BGP routes in order to redirect traffic and regain control over a target’s machines.

除了示警外,另外一方面 BGP 上的簽名技術也愈來愈重要了,只是不知道最終會怎麼做...

GitHub 上的 GeoJSON 資料將會使用 OpenStreetMap 的資料呈現

兩個禮拜前 GitHub 公佈的消息,透過 OpenStreetMap 的圖資,來強化 GitHub 上 GeoJSON 的呈現:「Improving map data on GitHub」。

官方給了個 GIF 動畫展示說明: