自從上次 Acer REVO 小主機的硬碟壞掉,就臨時拿了個隨身碟當作硬碟使用。雖然使用上少了傳統硬碟的發熱跟噪音,但是跟 SSD 比起來,寫入速度還是相當的杯具。很明顯的,一起動 Firefox 就有很明顯的頓挫感。當然,Ubuntu 上 SSD 相關的最佳化都用上了,主要的問題,在執行 iotop 之後就明瞭了:Firefox 每分鐘會寫入數十 MB 的資料。
經過一陣子 google 之後,知道問題是出在 crash recovery 的紀錄,竟然預設每 15 秒會回寫一次。再加上我習慣同時開的 tab 數量很大,每次都有幾 MB 的紀錄。如果有使用 session-saver 這個 addon,使用的也是同一個參數:browser.sessionstore.interval。個人可以視自己對瀏覽記錄損失的容忍度來調整這個參數,甚至不需要的話可以完全關閉。
Since the hard drive of my small form-factor desktop crashed, I'm using a flash USB drive as the storage. The is similar to people using SSD nowadays, but with a slower performance and lower price.
The same issues arise, the disk writes are lethal as the flash blocks have limited lifetime. One should move all disk caches to ram drives. Under linux, you can easily done with tmpfs:
tmpfs 1.6G 197M 1.4G 13% /tmp
tmpfs 316M 364K 315M 1% /run
tmpfs 1.6G 676K 1.6G 1% /var/log
tmpfs 2.0G 36K 2.0G 1% /var/tmp
One can move the cache directory to tmpfs:
key | value |
browser.cache.memory.enable | false |
browser.cache.offline.enable | false |
browser.cache.disk.enable | true |
browser.cache.disk.capacity | 262144 |
browser.cache.disk.parent_directory | /dev/shm/firefox |
Another one is the browser that I would use heavily on this machine. People notice that Firefox could cause huge writes due to the crash recovery:
http://superuser.com/questions/399473/firefox-writes-megabytes-of-data-per-minute-to-disk-why
The frequency of backing up session can be tuned:
key | value |
browser.sessionstore.interval | 30000 |
For people do not want to use crash recovery at all, he or she can set:
key | value |
browser.sessionstore.enabled | false |