換成 t4g.small 後的一些整理

昨天在這邊提到因為 Amazon EC2t4g.small 提供了 free tier 方案 (到今年年底),blog 主機剛好從 t4g.micro 改成用 t4g.small,到年底前可以看看有沒有 t5g 或是類似的主機出來:「往上升級或是用 Unlimited mode 撐」。

除了換完後 CPU credit 給的量上升減緩了情況以外,我在檢查時才發現 PHPopcache 的 cache 使用量也超過預設值 128MB 了,改成 192MB 後看起來 CPU usage 也有下降一些:

這點算是先前沒注意到的,上面 PHP 跑兩個 WordPress 以及一個 MediaWiki (都掛了各式各樣的 plugin & extension),還有一個自己寫的小東西,這樣會超過 opcache 的 cache 大小...

現在換到 t4g.small 後總算又開始養的起 CPU credit 了:

另外也補上幾個 CloudWatch Alarms (看起來 free tier 是十個) 監控主機的 CPUCreditBalance,然後透過 AWS Chatbot 接到自己的 Slack 上,至少之後有狀況的時候會主動通知。

往上升級或是用 Unlimited mode 撐

這個 blog 跑在 Amazon EC2t4g.micro 上面,以往跑起來 baseline 是 10% CPU credit 也還算夠用,但最近的 loading 特別的大,發現是有 bot 在砍站砍的比較兇 (參考「t4g 的 CPU credit 被吃完了」這邊),雖然擋掉後有降不少,但看起來還是比之前高不少:(這邊是一天的平均,拉三個月資料來看)

以往這種一陣一陣的可以靠 CPU credit 頂過去,但因為先前 CPU credit 被 bot 砍完後沒了,就常常撞到底,只好先開 Unlimited mode 擋著了。

另外一方面,當初買的三年 RI 時間也快到了 (居然),這幾天差不多要處理了:

Start
February 9, 2021, 17:43 (UTC+8:00)

Expires
February 9, 2024, 17:43 (UTC+8:00)

升級到 t4g.small 剛好會符合 AWS 的免費方案,看起來可以先掙扎一陣子:

Until December 31, 2024, all AWS customers will be enrolled automatically in the T4g free trial as detailed in the AWS Free Tier. During the free-trial period, customers who run a t4g.small instance will automatically get 750 free hours per month deducted from their bill during each month.

我記得我算過但沒找到文章,所以這邊還是算一下... 如果 t4g.small 要錢的話,與 Unlimited mode 的消費差異大概是多少。

us-east-1t4g.small 是 $0.0168/hr,用 720 小時換算是 $12.096/mo。

假設 CPU 使用率平均在 15%,那用 t4g.micro 的 $0.0084/hr 會是 $6.408/mo,另外加上 5% * 2vCPU = 10% 的 Unlimited mode 費用 ($0.04/hr/vCPU),會是 $2.88/mo。

假設 CPU 使用率平均在 20% (剛好跟 t4g.small 的 baseline 相同的話),會是 $5.76/mo,所以如果用不到對應的記憶體的話,跑 Unlimited mode 會比較划算。

先開一張票。年底的時候再來看看當時的機種與優惠方案...

AWS 延長 t4g.small 的 free trial

Plurk 上看到朋友貼的「Announcing Amazon EC2 T4g Free Trial Extension」。

t4g.small 的 free trial 延長到明年年底了:

The Amazon Elastic Compute Cloud (Amazon EC2) T4g instance Free Trial is extended to December 31, 2024. All new and existing AWS customers can utilize the free trial to automatically deduct up to 750 hours per month with the t4g.small instances through December 31, 2024. You can start building on Graviton-based instances for no charge with the T4g free trial, though charges may apply for surplus CPU credits. Refer to Amazon EC2 FAQs for more details on the free-trial.

這台算是還蠻好用的 ARM-based 主機,t4g.small 是 2 vCPU + 2GB RAM 的規格,如果是自己會 tune 的話已經可以做不少事情了,再加上 EC2 在前 12 個月的 t3.micro (2 vCPU + 1GB RAM) 免費,就已經可以玩不少東西了:

750 hours per month of Linux, RHEL, or SLES t2.micro or t3.micro instance dependent on region

Mistral 推出新的 Mixtral 8x7B,另外也開始提供付費 API 服務

首先是「Mixtral of experts」這個公告,Mistral 推出了新的 model,叫做 Mixtral 8x7B。這是一個 46.7B 的 model,但計算每個 token 時只需要計算 12.9B 的值:

Concretely, Mixtral has 46.7B total parameters but only uses 12.9B parameters per token. It, therefore, processes input and generates output at the same speed and for the same cost as a 12.9B model.

這就可以大幅降低計算需要的量,卻可以達到與 Llama 2 70B 或是 GPT-3.5 同一個等級的品質:

另外在「Mistral: Our first AI endpoints are available in early access (mistral.ai)」這邊看到官方推出了 API,正式的公告在「La plateforme」這邊,同時價錢也已經出來了:「Pricing」。

依照官方的說明,Mistral Small 用的是上面提到的 Mixtral 8x7B,所以表現的數字是一樣的。另外一個 Mistral Medium 沒有提到太多細節,只丟出簡單的說明:

然後 API 看起來會相容 OpenAI 家的 API:

Our API follows the specifications of the popular chat interface initially proposed by our dearest competitor.

Hacker News 上面的 id=38599156 有整理出重點,把價格數字都換算成 1m output 的費用,可以看到表現相近的 Mistral Small (Mixtral 8x7B) 與 GPT-3.5 在價錢上也差不多:

Per 1 million output tokens:
Mistral-medium $8
Mistral-small $1.94
gpt-3.5-turbo-1106 $2
gpt-4-1106-preview $30
gpt-4 $60
gpt-4-32k $120

沒有拿 GPT-4 的數字來比,代表 Mistral Medium 與 GPT-4 有一定的差距,這點也可以從價錢上面看出來。

不過我更在意的是 Mistral Medium 的 model 會不會放出來?

4px 寬的字型

也是在 Hacker News Daily 上看到的:「a pretty sweet 4px wide pixel font.」,看 commit log 似乎很久了,字本身長這樣:

作者有提到可以用在解析度不夠的螢幕上,馬上想到的是「Waveshare 3.2 inch Raspberry Pi LCD 320X240 Resistive Touch Screen TFT Display SPI LCD for Raspberry Pi 3 Model B/3B+/2 B/B/A Raspbian IMG Provided」這種東西:

另外用在小顆 LCD 單色顯示似乎也是個方法,不過看了一下是 5px:

出自「Real Time Clock On 20x4 I2C LCD Display with Arduino - Electronics-Lab.com」。

先記起來...

把 blog 從 t4g.small 降到 t4g.micro

我在「把 blog 搬到 t4g.small 上」這邊有提到把這個 blog 搬到 Amazon EC2t4g.small 上 (2GB RAM + 20% CPU credit),跑了一陣子把 CPU usage 拉出來看:

當初估大約要 20% 的 CPU credit,結果發現 CPU credit 大概用 5% 就夠了。另外記憶體的部份大約要給 1GB,這個量可以看出來一些沒在用的 process 會被丟到 swap:

              total        used        free      shared  buff/cache   available
Mem:          952Mi       380Mi        79Mi       110Mi       492Mi       368Mi
Swap:         511Mi       152Mi       359Mi

把條件綜合起來計算,就往下降一階變成 t4g.micro 了 (1GB RAM + 10% CPU credit)。

另外新機種比較不用擔心淘汰速度,就看了一下 Reserved Instances 的價錢,一年 USD$44,三年 USD$84,看起來只要有用兩年就算是 OK,直接買三年解決掉...

把 blog 搬到 t4g.small 上

算了一下成本還可以接受 (機器 + 空間 + 流量),就把 blog 搬到 AWSt4g.small (ARM) 上,理論上頁面的速度應該會快不少,過幾天等穩定性沒問題後就來買 RI...

x86-64 轉到 ARM 上面,主要是 Percona Server 目前沒有提供 ARM binary 的 apt repository,所以就改用 MariaDB 了。

其他的倒是都差不多,目前的 Ubuntu + nginx + PHP 沒什麼問題,跑一陣子看看...

小企業的蘋果稅將從 30% 降到 15%

Apple 宣佈了小企業的 App Store 抽成將從明年起降價:「Apple announces App Store Small Business Program」。

新聞稿的副標先把重點拉出來了:

New program reduces App Store commission to 15 percent for small businesses earning up to $1 million per year

細節會在 12 月釋出,但蘋果先解釋了有哪些情況會符合 30% -> 15% 的條件,分成現有的帳戶與新的帳戶,基本上是以一百萬美金為標準:

While the comprehensive details will be released in early December, the essentials of the program’s participation criteria are easy and streamlined:

  • Existing developers who made up to $1 million in 2020 for all of their apps, as well as developers new to the App Store, can qualify for the program and the reduced commission.
  • If a participating developer surpasses the $1 million threshold, the standard commission rate will apply for the remainder of the year.
  • If a developer’s business falls below the $1 million threshold in a future calendar year, they can requalify for the 15 percent commission the year after.

不知道對蘋果的影響會有多少,但對於個人開發的 app 應該是可以拿到多一點,大企業的 app 主要都會超過而沒有什麼大影響。

感覺這應該跟最近一些內部文件與電子郵件被公開有關...

Amazon Aurora 支援更小的 t2.small

Amazon Aurora 本來最小台只支援到 t2.medium,現在則是多支援到 t2.small 了,對於更小的需求會更方便:「Amazon Aurora Cuts Entry-Level Pricing in Half With Support for T2.Small Instances」。

不過如果真的要小,而且不考慮會急速成長擴充的話,還是會往標準的 RDS 靠吧... 價錢上還是比較便宜。

各種有趣的小板子...

Slashdot 的「Ringing In 2015 With 40 Linux-Friendly Hacker SBCs」報導了「Ringing in 2015 with 40 Linux-friendly hacker SBCs」這篇文章,裡面介紹了不少可以跑 Linux 的小板子。

還蠻多有趣的板子,大多都是 ARM,不過還是有一些 x86 的板子可以玩,另外還有一張 MIPS 的板子...

另外翻了翻還看到 SAMA5D3 Xplained 這張有兩個網卡的板子 (不過是 GE + FE),好像可以拿來做些有趣的東西?

不過上次從 zonble 那邊弄來的 Raspberry Pi 好像都還沒動...