ÔõÑù¾ÙÐÐLinuxϵͳµÄÍøÂçÐÔÄÜÓÅ»¯ºÍ¸ºÔØƽºâ
ÔõÑù¾ÙÐÐLinuxϵͳµÄÍøÂçÐÔÄÜÓÅ»¯ºÍ¸ºÔØƽºâ
ÍøÂçÐÔÄÜÓÅ»¯ºÍ¸ºÔØƽºâÔÚÏÖ´úµÄÍøÂçÇéÐÎÖÐÊÎÑÝ×ÅÖ÷ÒªµÄ½ÇÉ«¡£LinuxϵͳÆÕ±éÓ¦ÓÃÓÚЧÀÍÆ÷ºÍÍøÂç×°±¸ÖУ¬Òò´ËÏàʶÔõÑù¶ÔLinuxϵͳ¾ÙÐÐÍøÂçÐÔÄÜÓÅ»¯ºÍ¸ºÔØƽºâÊǺÜÊÇÓмÛÖµµÄ¡£±¾ÎĽ«ÏÈÈÝһЩ³£ÓõÄÍøÂçÐÔÄÜÓÅ»¯ºÍ¸ºÔØƽºâµÄÊÖÒÕ£¬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£
Ò»¡¢ÍøÂçÐÔÄÜÓÅ»¯
ʹÓøßÐÔÄܵÄÍøÂçÇý¶¯³ÌÐò
ʹÓøßÐÔÄܵÄÍøÂçÇý¶¯³ÌÐò¿ÉÒÔÏÔÖøÌáÉýÍøÂçÐÔÄÜ¡£³£ÓõĸßÐÔÄÜÍøÂçÇý¶¯³ÌÐò°üÀ¨IntelµÄixgbeºÍi40eÇý¶¯£¬ÒÔ¼°BroadcomµÄbnx2xÇý¶¯µÈ¡£ÒÔÏÂÊÇÒ»¸öʹÓÃixgbeÇý¶¯µÄʾÀý£º
# ×°Öà ixgbe Çý¶¯ yum install ixgbe # ¼ì²éÇý¶¯ÊÇ·ñ¼ÓÔØ lsmod | grep ixgbe
µÇ¼ºó¸´ÖÆ
µ÷½âÍøÂçÕ»²ÎÊý
µ÷½âÍøÂçÕ»²ÎÊý¿ÉÒÔÌáÉýÍøÂç´«ÊäÐÔÄÜ¡£³£ÓõÄÍøÂçÕ»²ÎÊý°üÀ¨TCP´°¿Ú¾Þϸ¡¢ÓµÈû¿ØÖÆËã·¨¡¢ÎüÊպͷ¢ËÍ»º³åÇø¾ÞϸµÈ¡£ÒÔÏÂÊÇÒ»¸öµ÷½âTCP´°¿Ú¾ÞϸµÄʾÀý£º
# Éó²éÄ¿½ñµÄTCP´°¿Ú¾Þϸ cat /proc/sys/net/ipv4/tcp_window_scaling # ÐÞ¸ÄTCP´°¿Ú¾ÞϸΪ4096 echo "4096" > /proc/sys/net/ipv4/tcp_window_scaling
µÇ¼ºó¸´ÖÆ
ʹÓøßÐÔÄܵÄÍøÂçÐÒéÕ»
LinuxϵͳÖÐÓÐÐí¶à¸ßÐÔÄܵÄÍøÂçÐÒéÕ»¿É¹©Ñ¡Ôñ£¬ÀýÈçDPDK£¨Data Plane Development Kit£©ºÍXDP£¨eXpress Data Path£©µÈ¡£ÕâЩÐÒéÕ»¿ÉÒÔÖ±½Ó²Ù×÷ÍøÂç½Ó¿Ú£¬Èƹý¹Å°åµÄÍøÂçÐÒéÕ»£¬ÌáÉýÍøÂçÐÔÄÜ¡£ÒÔÏÂÊÇÒ»¸öʹÓÃDPDKµÄʾÀý£º
# ×°ÖÃDPDK ./configure --prefix=/usr/local/dpdk make make install # ʹÓÃDPDKÆô¶¯ÍøÂçÓ¦ÓóÌÐò ./usr/local/dpdk/sbin/dpdk-app start
µÇ¼ºó¸´ÖÆ
¶þ¡¢¸ºÔØƽºâ
IPVS¸ºÔØƽºâ
IPVS£¨IP Virtual Server£©ÊÇÒ»¸öÔÚLinuxÄÚºËÖÐʵÏֵĸºÔØƽºâ»úÖÆ¡£Ëü¿ÉÒÔ½«µÖ´ïЧÀÍÆ÷µÄÇëÇó·Ö·¢µ½ºó¶ËµÄ¶à¸öЧÀÍÆ÷ÉÏ£¬´Ó¶øʵÏÖ¸ºÔØƽºâ¡£ÒÔÏÂÊÇÒ»¸öʹÓÃIPVSµÄʾÀý£º
# ×°ÖÃipvsadm yum install ipvsadm # Ìí¼ÓIPVS¹æÔò ipvsadm -A -t 192.168.1.1:80 -s rr ipvsadm -a -t 192.168.1.1:80 -r 192.168.1.2:80 -g -w 1 ipvsadm -a -t 192.168.1.1:80 -r 192.168.1.3:80 -g -w 1 # Éó²éIPVS¹æÔò ipvsadm -L -n
µÇ¼ºó¸´ÖÆ
LVS¸ºÔØƽºâ
LVS£¨Linux Virtual Server£©ÊÇÒ»¸öÔÚLinuxϵͳÉÏʵÏֵĸßÐÔÄܸºÔØƽºâ½â¾ö¼Æ»®¡£ËüÄܹ»½«µÖ´ï¸ºÔØƽºâÆ÷µÄÇëÇó·Ö·¢µ½ºó¶ËµÄ¶à¸öЧÀÍÆ÷ÉÏ£¬ÒÔʵÏÖ¸ºÔØƽºâ¡£ÒÔÏÂÊÇÒ»¸öʹÓÃLVSµÄʾÀý£º
# ×°ÖÃLVS yum install ipvsadm # Ìí¼ÓLVS¹æÔò ipvsadm -A -t 192.168.1.1:80 -s rr ipvsadm -a -t 192.168.1.1:80 -r 192.168.1.2:80 -g -w 1 ipvsadm -a -t 192.168.1.1:80 -r 192.168.1.3:80 -g -w 1 # Éó²éLVS¹æÔò ipvsadm -L -n
µÇ¼ºó¸´ÖÆ
×ܽá
ÍøÂçÐÔÄÜÓÅ»¯ºÍ¸ºÔØƽºâ¹ØÓÚÌáÉýϵͳµÄÎȹÌÐÔºÍÐÔÄÜÊÇÖÁ¹ØÖ÷ÒªµÄ¡£±¾ÎÄÏÈÈÝÁËһЩ³£ÓõÄÍøÂçÐÔÄÜÓÅ»¯ºÍ¸ºÔØƽºâµÄÊÖÒÕ£¬²¢ÌṩÁËÏêϸµÄ´úÂëʾÀý¡£Ï£Íû¶ÁÕßÄܹ»Í¨¹ýÕâЩÊÖÒÕºÍʾÀýÕÆÎÕÔõÑù¶ÔLinuxϵͳ¾ÙÐÐÍøÂçÐÔÄÜÓÅ»¯ºÍ¸ºÔØƽºâ¡£
ÒÔÉϾÍÊÇÔõÑù¾ÙÐÐLinuxϵͳµÄÍøÂçÐÔÄÜÓÅ»¯ºÍ¸ºÔØƽºâµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡