ÔõÑùʹÓÃLinux¾ÙÐдÅÅÌIOÐÔÄܵ÷ÓÅ
ÔõÑùʹÓÃlinux¾ÙÐдÅÅÌioÐÔÄܵ÷ÓÅ
ÔÚʹÓÃLinuxϵͳ¾ÙÐдÅÅÌIOÐÔÄܵ÷ÓÅʱ£¬¿ÉÒÔͨ¹ýÓÅ»¯Îļþϵͳ¡¢µ÷½âIOµ÷ÀíÆ÷¡¢ºÏÀíÉèÖÃRAIDµÈ·½·¨À´ÌáÉý´ÅÅ̵ÄIOÐÔÄÜ¡£±¾ÎĽ«ÏÈÈÝÕâЩҪÁ죬²¢ÌṩÏìÓ¦µÄ´úÂëʾÀý¡£
Ò»¡¢ÓÅ»¯Îļþϵͳ
ʹÓÃext4Îļþϵͳ
ext4ÊÇLinuxϵͳÉÏ×î³£ÓõÄÎļþϵͳ֮һ£¬Ëü¾ßÓнϸߵÄÐÔÄܺÍÎȹÌÐÔ¡£¿ÉÒÔͨ¹ý½«ÎļþϵͳÃûÌû¯Îªext4À´ÌáÉý´ÅÅ̵ÄIOÐÔÄÜ¡£
ʾÀý´úÂ룺
# umount /dev/sdb1 # mkfs.ext4 /dev/sdb1 # mount -t ext4 /dev/sdb1 /mnt
µÇ¼ºó¸´ÖÆ
ÆôÓÃext4ÈÕ־дÈë·½·¨
ext4Ö§³ÖÁ½ÖÖÈÕ־дÈë·½·¨£ºdata=orderedºÍdata=writeback¡£ÆäÖУ¬data=writebackģʽÏ£¬Êý¾ÝдÈëÑӳٽϵͣ¬ÐÔÄܸü¸ß¡£¿ÉÒÔʹÓÃÈçÏÂÒªÁìÐ޸ģº
ʾÀý´úÂ룺
# tune2fs -o journal_data_writeback /dev/sdb1
µÇ¼ºó¸´ÖÆ
¶þ¡¢µ÷½âIOµ÷ÀíÆ÷
LinuxϵͳĬÈϵÄIOµ÷ÀíÆ÷ÊÇCFQ£¨Completely Fair Queuing£©£¬ËüÊÔͼƾ֤Àú³ÌµÄIOÇëÇó˳ÐòʵÏÖ¹«Õý·ÖÅÉ¡£µ«ÔÚһЩ¸ß¸ºÔس¡¾°Ï£¬¿ÉÄܻᵼÖ´ÅÅÌIOÐÔÄÜϽµ¡£Òò´Ë£¬¿ÉÒÔʵÑéʹÓøüÊʺϵÄIOµ÷ÀíÆ÷£¬Èçnoop¡¢deadlineºÍcfq¡£
ʹÓÃnoopµ÷ÀíÆ÷
noopµ÷ÀíÆ÷ûÓÐÈκε÷ÀíËã·¨£¬Ö»ÊÇƾ֤ÇëÇóµÄ˳Ðò¾ÙÐд¦Àí¡£ÊʺϸßÐÔÄܵÄSSD´ÅÅÌ»òÕßRAID¿¨£¬¿ÉÒÔͨ¹ýÈçÏÂÏÂÁîÐÞ¸ÄIOµ÷ÀíÆ÷£º
ʾÀý´úÂ룺
# echo noop > /sys/block/sdb/queue/scheduler
µÇ¼ºó¸´ÖÆ
ʹÓÃdeadlineµ÷ÀíÆ÷
deadlineµ÷ÀíÆ÷½«IOÇëÇó·ÖΪÁ½¸öÐÐÁУºÀú³ÌÌá½»µÄIOÇëÇóÐÐÁкÍÄں˷¢³öµÄIOºÏ²¢ÇëÇóÐÐÁС£ÊʺÏRAID×°±¸ºÍ½ÏΪͨË×µÄÓ²ÅÌ¡£
ʾÀý´úÂ룺
# echo deadline > /sys/block/sdb/queue/scheduler
µÇ¼ºó¸´ÖÆ
ʹÓÃcfqµ÷ÀíÆ÷
cfqµ÷ÀíÆ÷ÔÚ¸÷¸öÀú³ÌÖ®¼äƽºâµØ·ÖÅÉIO×ÊÔ´£¬Êʺ϶àʹÃü³¡¾°¡£¿ÉÒÔʹÓÃÈçÏÂÏÂÁîÐÞ¸ÄIOµ÷ÀíÆ÷£º
ʾÀý´úÂ룺
# echo cfq > /sys/block/sdb/queue/scheduler
µÇ¼ºó¸´ÖÆ
Èý¡¢ºÏÀíÉèÖÃRAID
¹ØÓÚÐèÒª½Ï¸ß´ÅÅÌIOÐÔÄܵÄÓ¦Óó¡¾°£¬¿ÉÒÔ˼Á¿Ê¹ÓÃRAIDÊÖÒÕ¡£RAID½«¶à¿éÓ²ÅÌ×éºÏ³ÉÒ»¸öÂß¼´ÅÅÌ£¬Í¨¹ýÊý¾ÝÂþÑܺÍÈßÓàÊÖÒÕÌáÉýIOÐÔÄܺͿɿ¿ÐÔ¡£
ʾÀý´úÂ룺
½¨ÉèRAID×°±¸
# mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1
µÇ¼ºó¸´ÖÆ
ÃûÌû¯RAID×°±¸
# mkfs.ext4 /dev/md0
µÇ¼ºó¸´ÖÆ
¹ÒÔØRAID×°±¸
# mount -t ext4 /dev/md0 /mnt
µÇ¼ºó¸´ÖÆ
ËÄ¡¢¼à¿Ø´ÅÅÌIOÐÔÄÜ
×îºó£¬Ïàʶ´ÅÅÌIOµÄÐÔÄÜÇéÐÎÊǾÙÐе÷ÓŵÄÒªº¦¡£¿ÉÒÔʹÓù¤¾ßÈçiostat¡¢sarµÈÀ´¼à¿Ø´ÅÅÌIOµÄ¶ÁдÐÔÄܵÈÖ¸±ê¡£
ʾÀý´úÂ룺
# iostat -x 1
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇÔõÑùʹÓÃlinux¾ÙÐдÅÅÌioÐÔÄܵ÷ÓŵÄÒªÁ죬ͨ¹ýÓÅ»¯Îļþϵͳ¡¢µ÷½âIOµ÷ÀíÆ÷ºÍºÏÀíÉèÖÃRAIDµÈ·½·¨£¬¿ÉÒÔÌáÉý´ÅÅ̵ÄIOÐÔÄÜ¡£Í¬Ê±£¬¼à¿Ø´ÅÅÌIOÐÔÄÜÇéÐοÉÒÔ×ÊÖúÎÒÃÇÆÀ¹Àµ÷ÓÅЧ¹û¡£Ï£Íû±¾ÎĵÄÄÚÈݶÔÄúÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇÔõÑùʹÓÃLinux¾ÙÐдÅÅÌIOÐÔÄܵ÷ÓŵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡