ÔõÑùÔÚ÷è÷ë²Ù×÷ϵͳÉϾÙÐÐϵͳµÄ¸ß¼¶µ÷ÓźÍÉèÖã¿
ÔõÑùÔÚ÷è÷ë²Ù×÷ϵͳÉϾÙÐÐϵͳµÄ¸ß¼¶µ÷ÓźÍÉèÖã¿
СÐò£º
÷è÷ë²Ù×÷ϵͳÊÇÒ»¿î»ùÓÚLinuxµÄ²Ù×÷ϵͳ£¬¾ßÓи߶ȵÄÎȹÌÐÔºÍÇå¾²ÐÔ£¬ÆÕ±éÓ¦ÓÃÓÚЧÀÍÆ÷ºÍСÎÒ˽¼ÒµçÄÔ¡£È»¶ø£¬ÎªÁË»ñµÃ¸üºÃµÄÐÔÄܺÍ˳ӦÌض¨µÄÐèÇó£¬ÎÒÃÇÐèÒª¾ÙÐи߼¶µ÷ÓźÍÉèÖᣱ¾ÎĽ«ÏÈÈÝÔõÑùÔÚ÷è÷ë²Ù×÷ϵͳÉϾÙÐÐϵͳµÄ¸ß¼¶µ÷ÓźÍÉèÖ㬰üÀ¨Äں˲ÎÊýÓÅ»¯¡¢ÎļþϵͳÉèÖá¢IOµ÷Àí·½·¨¡¢Àú³ÌÓÅÏȼ¶¡¢ÄÚ´æÖÎÀíµÈ·½Ã棬²¢ÌṩÏìÓ¦µÄ´úÂëʾÀý¡£
Ò»¡¢Äں˲ÎÊýÓÅ»¯
÷è÷ë²Ù×÷ϵͳµÄÐÔÄܺÍÎȹÌÐÔ¶¼ÓëÄں˲ÎÊýµÄÉèÖÃϢϢÏà¹Ø¡£¿ÉÒÔͨ¹ýÐÞ¸Ä/sys»ò/procĿ¼ÏµÄÎļþÀ´¸ü¸ÄÄں˲ÎÊý¡£ÏÂÃæÊÇһЩ³£¼ûµÄÄں˲ÎÊýÉèÖõÄʾÀý´úÂ룺
£¨1£©µ÷½âTCP/IPÏà¹Ø²ÎÊý£º
sysctl -w net.core.somaxconn=65535
sysctl -w net.ipv4.tcp_max_syn_backlog=65535
sysctl -w net.ipv4.tcp_max_tw_buckets=65535
£¨2£©µ÷½âÎļþÐÎò·ûÏÞÖÆ£º
sysctl -w fs.file-max=65535
ulimit -n 65535
£¨3£©µ÷½âÄÚ´æ·ÖÅÉ»úÖÆ£º
sysctl -w vm.swappiness=10
sysctl -w vm.dirty_ratio=5
sysctl -w vm.dirty_background_ratio=3
¶þ¡¢ÎļþϵͳÉèÖÃ
ÎļþϵͳµÄÑ¡ÔñºÍÓÅ»¯¶ÔϵͳµÄÐÔÄÜÒ²ÓÐ×ÅÖ÷ÒªµÄÓ°Ïì¡£ÔÚ÷è÷ë²Ù×÷ϵͳÖУ¬Ä¬ÈÏʹÓõÄÊÇext4Îļþϵͳ¡£ÏÂÃæÊÇһЩÎļþϵͳÉèÖõÄʾÀý´úÂ룺
£¨1£©ÆôÓÃдÈ뻺´æ£º
tune2fs -o journal_data_writeback /dev/sda1
£¨2£©µ÷½â×î´ó·¿ªÎļþÊý£º
echo “* – nofile 65535” >> /etc/security/limits.conf
Èý¡¢IOµ÷Àí·½·¨
IOµ÷Àí·½·¨ÊÇÖ¸¶Ô´ÅÅÌIOÇëÇóµÄµ÷Àí·½·¨µÄÑ¡Ôñ£¬²î±ðµÄµ÷Àí·½·¨ÊÊÓÃÓÚ²î±ðµÄ³¡¾°¡£ÔÚ÷è÷ë²Ù×÷ϵͳÖУ¬Ä¬ÈÏʹÓõÄÊÇdeadlineµ÷Àí·½·¨¡£ÏÂÃæÊÇһЩIOµ÷Àí·½·¨ÉèÖõÄʾÀý´úÂ룺
£¨1£©¸ü¸Äµ÷Àí·½·¨£º
echo “deadline” > /sys/block/sda/queue/scheduler
£¨2£©É趨¶Áд±ÈÀý£º
echo “512” > /sys/block/sda/queue/iosched/writes_starved
ËÄ¡¢Àú³ÌÓÅÏȼ¶
¹ØÓÚÐèÒªÓÅÏÈ´¦Öóͷ£µÄÀú³Ì£¬¿ÉÒÔͨ¹ýµ÷½âÀú³ÌµÄÓÅÏȼ¶À´Ìá¸ßÆäÔËÐÐЧÂÊ¡£ÔÚ÷è÷ë²Ù×÷ϵͳÖУ¬Ä¬ÈϵÄÀú³ÌÓÅÏȼ¶¹æÄ£ÊÇ-20µ½19¡£ÏÂÃæÊÇһЩÀú³ÌÓÅÏȼ¶ÉèÖõÄʾÀý´úÂ룺
£¨1£©µ÷½âÀú³ÌÓÅÏȼ¶£º
renice -20 -p 12345
Îå¡¢ÄÚ´æÖÎÀí
¹ØÓÚϵͳÖеÄÄÚ´æÖÎÀí£¬¿ÉÒÔͨ¹ýµ÷½âÒ³ÃæÖû»Õ½ÂÔºÍÄÚ´æ·ÖÅÉ»úÖÆÀ´Ìá¸ßÐÔÄÜ¡£ÏÂÃæÊÇһЩÄÚ´æÖÎÀíÉèÖõÄʾÀý´úÂ룺
£¨1£©µ÷½âÒ³ÃæÖû»Õ½ÂÔ£º
echo “0” > /proc/sys/vm/swappiness
£¨2£©Ê¹ÓÃhugepages£º
echo “vm.nr_hugepages = 256” >> /etc/sysctl.conf
×ܽ᣺
±¾ÎÄÏÈÈÝÁËÔõÑùÔÚ÷è÷ë²Ù×÷ϵͳÉϾÙÐÐϵͳµÄ¸ß¼¶µ÷ÓźÍÉèÖá£Í¨¹ý¶ÔÄں˲ÎÊýÓÅ»¯¡¢ÎļþϵͳÉèÖá¢IOµ÷Àí·½·¨¡¢Àú³ÌÓÅÏȼ¶ºÍÄÚ´æÖÎÀíµÄµ÷½â£¬¿ÉÒÔʹϵͳÔÚ²î±ðµÄÓ¦Óó¡¾°Öеִï¸üºÃµÄÐÔÄܺÍ˳ӦÐÔ¡£È»¶ø£¬ÏÖʵµÄϵͳµ÷ÓźÍÉèÖÃÒÀÀµÓÚÏêϸµÄÐèÇóºÍÇéÐΣ¬ÐèҪƾ֤ÏÖÕæÏàÐξÙÐе÷½âºÍÓÅ»¯¡£
²Î¿¼×ÊÁÏ£º
[1] https://github.com/kunpengcompute/khanka/blob/master/tuning_guide.md
ÒÔÉϾÍÊÇÔõÑùÔÚ÷è÷ë²Ù×÷ϵͳÉϾÙÐÐϵͳµÄ¸ß¼¶µ÷ÓźÍÉèÖ㿵ÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡