close Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": /usr/lib/python2.7/dist-packages/libsvn/_repos.so: failed to map segment from shared object: Cannot allocate memory). Look in the Trac log for more information.

Changes between Version 11 and Version 12 of jazz/Performance_Tuning


Ignore:
Timestamp:
May 11, 2010, 3:49:21 PM (14 years ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • jazz/Performance_Tuning

    v11 v12  
    1414== System Performance Tuning : File System ==
    1515
    16  * /etc/security/limits.conf - 每個程序(process)可以開啟檔案的個數(number limits of open files per process) - 像 HDFS 的 !DataNode 就需要調整這種參數([wiki:jazz/10-02-22#Hadoop:HDFS 2010-02-22])
     16 * 如何調整每個使用者可以開啟的檔案個數
     17   * [參考] [http://www.xenoclast.org/doc/benchmark/HTTP-benchmarking-HOWTO/node7.html Increasing the file descriptor limit]
     18   * [參考] [http://www.netadmintools.com/art295.html GNU/Linux - How Many Open Files?]
     19   * 注意:修改 /etc/security/limits.conf 中間必須確定是 TAB ,如果有設定 vim 的 softwaretab 的話,得特別當心!!!
     20   * /proc/sys/fs/file-max - 核心預設最多可以開啟的檔案個數
     21{{{
     22~$ cat /proc/sys/fs/file-max
     23743964
     24}}}
     25   * /proc/sys/fs/file-max - 目前已開啟檔案個數、可供開啟檔案個數、總開啟檔案上限
     26{{{
     27[root@srv-4 proc]# cat /proc/sys/fs/file-nr
     283391    969     52427
     29|        |       |
     30|        |       |
     31|        |       maximum open file descriptors
     32|        total free allocated file descriptors
     33total allocated file descriptors
     34(the number of file descriptors allocated since boot)
     35}}}
     36   * /etc/security/limits.conf - 每個程序(process)可以開啟檔案的個數(number limits of open files per process) - 像 HDFS 的 !DataNode 就需要調整這種參數([wiki:jazz/10-02-22#Hadoop:HDFS 2010-02-22])
    1737{{{
    1838#!diff
     
    2343 #@student        -       maxlogins       4
    2444 
    25 +*      soft        nofile        8192
     45+*      soft        nofile        4096
     46+*      hard        nofile        743964
    2647+
    2748 # End of file
    2849}}}
    29  * [參考] [http://www.xenoclast.org/doc/benchmark/HTTP-benchmarking-HOWTO/node7.html Increasing the file descriptor limit]
     50   * /etc/pam.d/login - 告訴系統要用 /etc/security/limits.conf 來設定一些上限
     51{{{
     52# Sets up user limits according to /etc/security/limits.conf
     53# (Replaces the use of /etc/limits in old login)
     54session    required   pam_limits.so
     55}}}
     56   * 指令: ulimit - 可以告訴你一些系統限制,並且設定想要的値
     57{{{
     58jazz@Wdebian:~$ ulimit -a
     59core file size          (blocks, -c) 0
     60data seg size           (kbytes, -d) unlimited
     61scheduling priority             (-e) 0
     62file size               (blocks, -f) unlimited
     63pending signals                 (-i) 72704
     64max locked memory       (kbytes, -l) 32
     65max memory size         (kbytes, -m) unlimited
     66open files                      (-n) 1024
     67pipe size            (512 bytes, -p) 8
     68POSIX message queues     (bytes, -q) 819200
     69real-time priority              (-r) 0
     70stack size              (kbytes, -s) 8192
     71cpu time               (seconds, -t) unlimited
     72max user processes              (-u) 72704
     73virtual memory          (kbytes, -v) unlimited
     74file locks                      (-x) unlimited
     75}}}
     76 * 假設 /proc/sys/fs/file-max 跟 /etc/security/limits.conf 都有設定上限為 743964,且 /etc/pam.d/login 也有打開,但是 ulimit -a 指令仍顯示 1024 (預設),可以修改 /etc/rc.local 或 /etc/profile 強制用 ulimit -n 743964 來提高開檔個數。
     77{{{
     78~$ ulimit -n 743964
     79}}}
     80 * [備註] 如果 ulimit 超出可容許範圍,會顯示 Operation not permitted,此時請檢查相關設定値
     81{{{
     82~$ ulimit -n 7439640
     83-bash: ulimit: open files: cannot modify limit: Operation not permitted
     84}}}
    3085
    3186== I/O Performance Tuning : NFS ==