找回密碼
 註冊
搜索
查看: 2672|回復: 0

[教學] Swappolube from extras-devel 系統內存優化 (10/1更新)

[複製鏈接]
發表於 18-10-2010 14:29:13 | 顯示全部樓層 |閱讀模式
文章出自: : F: m7 [! |. O
(sonarsu) http://www.maemoers.com/thread-6106-1-12.html+ N+ Y* T9 h7 k0 f( W
http://discussions.europe.nokia.com/t5/Maemo-Devices/Make-your-N900-faster-with-Swappolube/m-p/764001  c( p! y: ]: W9 e  X7 Q: W* {% F

/ b! b. U! u) Q1 p: G
$ L% y' j" i: c; n% I$ @  A! ~打開 x-terminal 執行:# i* |+ R" J% R2 s. |! P
sudo gainroot) x' q+ D7 S$ P7 K0 G2 ]6 Y& J$ n" J3 M
apt-get install swappolube 安裝這個軟件,但目錄底下還是請務必加上extras-devel這個來源
/ u6 B9 O: g. f( L5 T) i! S
! i7 A' S, L$ ]7 T+ ^第一次發帖,很多事情沒考慮清楚,請各位前輩多多見諒.
: G( X  I/ W& o+ H1.安裝完畢後,會出現這個程序 swappolube,您打開後您會發現原先是/ m- r: \4 j  H8 o
100 Swappiness2 C# N+ ]5 D) u) |
40 Dirty Ratio6 ]  K1 L4 p2 h7 h8 j2 V! Y& `. J
10 dirty BGD ratio) r8 B* W. M0 o4 ?- O
500 Dirty Expire Centisecs" Y' D% {. n# c# x- Z7 N# b' M  |
500 Dirty Writeback Centisecs
6 f: u+ X9 x! }' i) y2 T& c5 a3 d' v- ?& w5 Page-Cluster
3 L. [( X0 ?3 @* q+ B2 [右方顯示0等等資訊
4 d# h3 |4 O2 y% _2 L0 n
+ i! O) d% z4 x6 `: W
  j$ H* U# q  p: i最快速的調整參數請參照,這樣調整就可以了9 F4 C. i5 y4 E; ]3 t4 q8 C

0 g8 T5 _, }: `' x  [* Y* j順序為 1.proposed  2.apply  3.store  ,  4.開機後重新打開程序看有沒有跑掉參數" e7 [( k# `. q9 k7 G, b5 w  {
6 B4 w, I4 }( ~! B. g
圖中select是要改變時勾選
- e5 n; t6 R4 T2 I% F  R6 B( \! p7 ~) U( j5 Y" f
建議還是以NOKIA SUPPORT上面的參數來設定,簡單明瞭
$ S( n" b& Z' n7 ^# K6 [0 f& |: c4 k' h" B$ U
好處是:
" w8 N# {; q6 i1.不必超頻就可以讓系統內存最佳化,跑得飛快,不必那麼卡卡的,誰說N900笨重又慢的?& ?7 f( U% U  s! u# w6 y) Z
2.耗電量測試的結果,比起未安裝前只有多那麼一點點,也不會像是超頻這麼熱,效果卻是不錯的,沒跑3D Game的情況下,這個優化效果不錯,但是這裡需要強調是並非萬靈丹,有某些程式你不跑超頻光靠內存的排擠與優化還是跑不順,建議適當的超頻運用起來更好(2010-10-08修正)5 |+ ]* y% W9 u; u0 {; I* g
3.對網路瀏覽優化,一,系統會背地裡幫大家做好,瀏覽更順了
0 Z* N) m  Z8 G, P
* P: k: K) t; [% s疑問回答:
+ j1 i/ U- l# M& T1.電池的電力不會變得耗電,測試過三天跟之前無明顯變化,不會特別耗電
6 i2 o( W3 V7 w, L- }/ Z4 d7 v2.rootfs太低也不會使得系統快到哪裡去,只好期待新的韌體更新,多多用conky注意安裝軟件時佔用rootfs的狀況,沒依照規範寫的程式就別裝了,會拖慢系統2 ^2 V  C. R# `+ f  Z* |4 p! ]- i
3.更改後 apply->store 重開機再來看看有沒有儲存進去以下提供手動方法,利用xterm輸入或包裝成script執行
3 h: Z9 G: |+ |/ F( hecho "30" > /proc/sys/vm/swappiness        
2 n2 R8 M) [6 ]; d; {+ t/ |echo "0" > /proc/sys/vm/page-cluster        
" V4 u& U% r, V0 g/ }echo "1" > /proc/sys/vm/laptop_mode        + r4 D9 ^$ ?3 A  A9 C( ?: X
echo "1" > /proc/sys/vm/oom_kill_allocating_task        1 R0 i4 j0 A" Z6 ?
echo "0" > /proc/sys/vm/dirty_expire_centisecs        
7 `1 r0 i* F+ ^& j" C+ J( pecho "0" > /proc/sys/vm/dirty_writeback_centisecs      
, R3 e! o- z* S; M. |echo "60" > /proc/sys/vm/dirty_background_ratio        " A  x* v2 Q0 y9 }' r
echo "95" > /proc/sys/vm/dirty_ratio        
7 _2 q/ L& q8 P( v. f4 w8 \+ Decho "0" > /proc/sys/net/ipv4/tcp_timestamps        / r! \# V: I7 ^8 r; w/ t
echo "1" > /proc/sys/net/ipv4/tcp_no_metrics_save  W$ z3 C; \0 p0 f; E3 \
利用 cat指令 看看有沒有寫入 例如:cat  /proc/sys/vm/swappiness
" {  e) ?, a: b' V, g8 F" G' {$ H4.這個參數部分可以自己亂試,你愛改多少就改多少,可以去感受一下差異,並不會危及任何硬體及設定
2 M5 L7 ~$ m& i5.這個軟件是針對快取來優化,可以明顯感受速度的差異在於瀏覽時的捲動及關閉程序的速度
1 v2 x, {+ L! r& U針對很頻繁對硬碟快取得非常有效,前輩們可以去測試例如 word to go ,abiword等文書軟件,或針對瀏覽器的捲動及資料顯現來測試有無差異. W9 ?' R: C: ~+ r- B2 h0 R
6.有些軟件本身啟動上就很慢,例如firefox,測試後差異並不明顯,但資料上呈現還是快些,網路讀取還是要取決於當時網絡狀況
( i3 ?8 A9 r- S0 E7 T& f9 g" \我本身是使用台灣3.5G,狀況還可以,有感覺變快了,我很難回答大家有沒有對照測試,機器上大家的軟件都安裝的不同,甚至超頻情況有無都不同,僅能在此致歉:opera ,nokia網絡套件開啟時的速度變化來看看差異" W6 S: R! S. W2 G

- n* V  e) g/ v當然這個優化程序可以利用指令去修改,以下參數討論給大家參考用,讓高手可以進一步去討論與調整
' L% c9 I" f8 w, _" `8 vhere are the settings and what they are changed from (the default on the N900) and to(From Nokia Support :cpitchford)
' V+ k' g  m1 x0 X5 Q) ~3 f8 ^/ LFrom To Setting
7 q# X, i; q1 H8 u& s3 i7 ^100 30 /proc/sys/vm/swappiness4 I. L/ v- w, E! \; H2 G- e6 M4 h, o
5 0 /proc/sys/vm/page-cluster5 G- G3 Q) h, w5 c
0 1 /proc/sys/vm/laptop_mode* q9 i! v# I0 m( U* v
0 1 /proc/sys/vm/oom_kill_allocating_task
% p6 B3 ?) n; C& W500 0 /proc/sys/vm/dirty_expire_centisecs
; q' y* k6 }/ ]500 0 /proc/sys/vm/dirty_writeback_centisecs' U9 V5 y0 Y9 J6 Q" i( J( U; h
10 60 /proc/sys/vm/dirty_background_ratio0 x7 H2 f* O1 ^  l( E, \0 x
40 95 /proc/sys/vm/dirty_ratio
2 o* e& l/ ?  s5 @! O1 0 /proc/sys/net/ipv4/tcp_timestamps5 b" @( Y3 I# T0 {1 ^9 N) Y4 d
0 1 /proc/sys/net/ipv4/tcp_no_metrics_save
  w8 o3 [% a0 x/ G
5 x& r( O1 G2 R! G
" w8 V& u1 e: D# i
) k& I; W3 w  o$ i% t% OI believe this value changes how the system swaps. Memory is in use, in swap, free or disk-cache (more or less) if this value is high, it will push in use memory onto swap to keep the cache large.. if it is low, it will sacrifice cache to keep application in use memory available.. I think
* Y. R) G4 e$ s. I) D
5 j5 c3 [2 I( _6 j0 Y/proc/sys/vm/page-cluster
7 B0 N( ^0 Z) F% i6 C
! O. ?7 h" N7 w0 hThis controls how big a chunk of memory is moved into swap in one go. Changing from 5 to 0 reduces the size by 32! This means very small chunks can now be put into swap memory, which gives greater control over what is swapped out
0 v8 N# b9 l/ J8 q
- a2 X3 u' L7 G; P! n/proc/sys/vm/laptop_mode1 t, `) d# x; `+ `" _2 ^- Q$ Y* f

7 ~6 K8 Y! Q; j& CLaptop mode is about stopping a linux machine spinning up a laptop hard disk unncessarily. When this value is set to one, when something starts writing to the disk (actually the emmc) any page flushing will happen at the same time.. things get moved to swap when other stuff is writing to disk.. Since writing to disk introduces latency, its better to bunch this stuff up..
9 p6 T  ^) p  u, T2 I0 N8 H
1 U5 d2 c& v1 A% W/ E% o( Q/proc/sys/vm/oom_kill_allocating_task/ d1 W$ Z: r7 _# u. }, c2 t  {4 ?
/ \8 L1 F  z/ q: `5 T7 R% _
Seems a bit drastic.. When a process asks for more memory, if the system is full it would normally look for a process to kill (to free up its resources which can then be re-used). When this is change, the system will simply shoot ANY process that tries to request memory when the system is full.., n5 p0 ?3 S/ ^: D. i  L( c: f

/ B; W% \. a" N- q' z0 x/proc/sys/vm/dirty_expire_centisecs
; O+ F8 ]) E- Z0 b
" P  E" E3 P7 T& v, ^How long stuff can sit in the disk cache before it is written to disk.. 0 means NOW!
/ ^' C' L4 c+ z" |
- n3 {% l* b% f% W/proc/sys/vm/dirty_writeback_centisecs
- \; R3 e; C- V7 P; q& A
; y. G% f8 x+ w* _% UHow long stuff can sit in the disk cache before it writes stuff to disk.. kind of meaningless now since /proc/sys/vm/dirty_expire_centisecs is set to zero so nothing is going to sit there anyway
  g# W- ~0 h' I7 |9 A6 G* o1 @0 {  _  g' D  e
/proc/sys/vm/dirty_background_ratio
9 `8 F, y7 j3 z) n6 x. R/proc/sys/vm/dirty_ratio6 m$ A( x' I" T# P+ A% u
+ `0 ]. O& i' e
Stuff must be written to disk when 60% of the memory is used by disk write cache. Either after a delay or when the process running tries to writing to disk cache% D: j/ A& C9 o, W2 o
4 i9 |5 j/ e4 y, A, H+ g
/proc/sys/net/ipv4/tcp_timestamps+ W8 q( g5 k& y. _- S+ k* f9 p! k
TCP packets are sent include the time they are sent when this is enabled.. Turning it off allows more data to be sent in each packet (as none is now wasted by the timestamp) This is bad for very fast links..
) A* X. y$ T1 i* s% R3 h: ?) F. t$ B( B- [: X2 R" P4 Q9 g9 A0 U' n
/proc/sys/net/ipv4/tcp_no_metrics_save3 a/ P9 Z# F) }  j$ h% N
This stops the kernel remembering information about past TCP connections. As well as gaining free memory by disabling this, it also stops the kernel remembering details when the link was congested (eg you went out of 3G coverage for a moment) that might alter how the system communicates in the future..
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

Archiver|手機版|小黑屋|歡迎光臨 Julybee Club

GMT+8, 23-11-2024 06:33 , Processed in 0.297857 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回復 返回頂部 返回列表