尊龙凯时人生就是博

³¬È«ÕûÀí – LinuxÐÔÄÜÆÊÎö¹¤¾ß»ã×ܺϼ¯

³öÓÚ¶ÔLinux²Ù×÷ϵͳµÄÐËȤ£¬ÒÔ¼°¶Ôµ×²ã֪ʶµÄÇ¿ÁÒÓûÍû£¬Òò´ËÕûÀíÁËÕâƪÎÄÕ¡£±¾ÎÄÒ²¿ÉÒÔ×÷ΪĥÁ·»ù´¡ÖªÊ¶µÄÖ¸±ê£¬ÁíÍâÎÄÕº­¸ÇÁËÒ»¸öϵͳµÄ·½·½ÃæÃæ¡£ÈôÊÇûÓÐÍêÉƵÄÅÌËã»úϵͳ֪ʶ£¬ÍøÂç֪ʶºÍ²Ù×÷ϵͳ֪ʶ£¬ÎĵµÖеŤ¾ß£¬ÊDz»¿ÉÄÜÍêÈ«ÕÆÎյģ¬ÁíÍâ¶ÔϵͳÐÔÄÜÆÊÎöºÍÓÅ»¯ÊÇÒ»¸öºã¾ÃµÄϵÁС£

±¾ÎĵµÖ÷ÒªÊÇÍŽáLinux ´óÅ££¬Netflix ¸ß¼¶ÐÔÄܼܹ¹Ê¦ Brendan Gregg ¸üРLinux ÐÔÄܵ÷ÓŹ¤¾ßµÄ²©ÎÄ£¬ËѼ¯LinuxϵͳÐÔÄÜÓÅ»¯Ïà¹ØÎÄÕÂÕûÀíºóµÄһƪ×ÛºÏÐÔÎÄÕ£¬Ö÷ÒªÊÇÍŽᲩÎĶÔÉæ¼°µ½µÄÔ­ÀíºÍÐÔÄܲâÊԵŤ¾ßÕö¿ªËµÃ÷¡£

Å侰֪ʶ£º¾ß±¸Å侰֪ʶÊÇÆÊÎöÐÔÄÜÎÊÌâʱÐèÒªÏàʶµÄ¡£ºÃ±ÈÓ²¼þ cache£»ÔٺñȲÙ×÷ϵͳÄںˡ£Ó¦ÓóÌÐòµÄÐÐΪϸ½ÚÍùÍùÊǺÍÕâЩ¹¤¾ßÏ໥ǣÉæµÄ£¬ÕâЩµ×²ãµÄ¹¤¾ß»áÒÔÒâÏë²»µ½µÄ·½·¨Ó°ÏìÓ¦ÓóÌÐòµÄÐÔÄÜ£¬ºÃ±ÈijЩ³ÌÐòÎÞ·¨³ä·ÖʹÓà cache£¬´Ó¶øµ¼ÖÂÐÔÄÜϽµ¡£ºÃ±È²»ÐëÒªµØŲÓùý¶àµÄϵͳŲÓã¬Ôì³ÉƵÈÔµÄÄÚºË / Óû§Çл»µÈ¡£ÕâÀïÖ»ÊÇΪ±¾ÎĵĺóÐøÄÚÈÝ×öһЩÆ̵棬¹ØÓÚµ÷ÓÅÉÐÓÐÐí¶à¹¤¾ß£¬ÎÒËù²»ÖªµÀµÄ±ÈÖªµÀµÄÒª¶àµÄ¶à£¬Ï£Íû¸÷ÈËÄÜÅäºÏѧϰǰ½ø¡£

¡¾ÐÔÄÜÆÊÎö¹¤¾ß¡¿

Ê×ÏÈÀ´¿´Ò»ÕÅͼ£º

ÉÏͼÊÇBrendan Gregg µÄÒ»´ÎÐÔÄÜÆÊÎöµÄ·ÖÏí£¬ÕâÄÚÀïµÄËùÓй¤¾ß¶¼¿ÉÒÔͨ¹ýmanÀ´»ñµÃËüµÄ×ÊÖúÎĵµ£¬ÏÂÎʼòÆÓÏÈÈÝÏÈÈÝÒ»ÏÂͨÀýµÄÓ÷¨£º

¡ø vmstat–ÐéÄâÄÚ´æͳ¼Æ

vmstat(VirtualMeomoryStatistics,ÐéÄâÄÚ´æͳ¼Æ) ÊÇLinuxÖмà¿ØÄÚ´æµÄ³£Óù¤¾ß,¿É¶Ô²Ù×÷ϵͳµÄÐéÄâÄÚ´æ¡¢Àú³Ì¡¢CPUµÈµÄÕûÌåÇéÐξÙÐмàÊÓ¡£

vmstatµÄͨÀýÓ÷¨£ºvmstat interval times¼´Ã¿¸ôintervalÃë²ÉÑùÒ»´Î£¬¹²²ÉÑùtimes´Î£¬ÈôÊÇÊ¡ÂÔtimes,ÔòÒ»Ö±ÊÕÂÞÊý¾Ý£¬Ö±µ½Óû§ÊÖ¶¯×èֹΪֹ¡£

¼òÆÓ¾Ù¸öÀý×Ó£º

¿ÉÒÔʹÓÃctrl+c×èÖ¹vmstatÊÕÂÞÊý¾Ý¡£

µÚÒ»ÐÐÏÔʾÁËϵͳ×ÔÆô¶¯ÒÔÀ´µÄƽ¾ùÖµ£¬µÚ¶þÐÐ×îÏÈÏÔʾÏÖÔÚÕýÔÚ±¬·¢µÄÇéÐΣ¬½ÓÏÂÀ´µÄÐлáÏÔʾÿ5Ãë¾àÀ뱬·¢ÁËʲô£¬Ã¿Ò»ÁеļÄÒåÔÚÍ·²¿£¬ÈçÏÂËùʾ£º

▪ procs£ºrÕâÒ»ÁÐÏÔʾÁ˼¸¶àÀú³ÌÔÚÆÚ´ýcpu£¬bÁÐÏÔʾ¼¸¶àÀú³ÌÕýÔÚ²»¿ÉÖÐÖ¹µÄÐÝÃߣ¨ÆÚ´ýIO£©¡£

▪ memory£ºswapdÁÐÏÔʾÁ˼¸¶à¿é±»»»³öÁË´ÅÅÌ£¨Ò³Ãæ½»Á÷£©£¬Ê£ÏµÄÁÐÏÔʾÁ˼¸¶à¿éÊÇ¿ÕÏеģ¨Î´±»Ê¹Óã©£¬¼¸¶à¿éÕýÔÚ±»ÓÃ×÷»º³åÇø£¬ÒÔ¼°¼¸¶àÕýÔÚ±»ÓÃ×÷²Ù×÷ϵͳµÄ»º´æ¡£

▪ swap£ºÏÔʾ½»Á÷Ô˶¯£ºÃ¿ÃëÓм¸¶à¿éÕýÔÚ±»»»È루´Ó´ÅÅÌ£©ºÍ»»³ö£¨µ½´ÅÅÌ£©¡£

▪ io£ºÏÔʾÁ˼¸¶à¿é´Ó¿é×°±¸¶ÁÈ¡£¨bi£©ºÍд³ö£¨bo£©,ͨ³£·´Ó¦ÁËÓ²ÅÌI/O¡£

▪ system£ºÏÔʾÿÃëÖÐÖ¹(in)ºÍÉÏÏÂÎÄÇл»£¨cs£©µÄÊýÄ¿¡£

▪ cpu£ºÏÔʾËùÓеÄcpuʱ¼äÆÆ·ÑÔÚÖݪֲÙ×÷µÄ°Ù·Ö±È£¬°üÀ¨Ö´ÐÐÓû§´úÂ루·ÇÄںˣ©£¬Ö´ÐÐϵͳ´úÂ루Äںˣ©£¬¿ÕÏÐÒÔ¼°ÆÚ´ýIO¡£

ÄÚ´æȱ·¦µÄÌåÏÖ£ºfree  memory¼±¾çïÔÌ­£¬½ÓÄÉbufferºÍcacherÒ²ÎÞ¼ÃÓÚÊ£¬´ó×ÚʹÓý»Á÷·ÖÇø£¨swpd£©,Ò³Ãæ½»Á÷£¨swap£©ÆµÈÔ£¬¶Áд´ÅÅÌÊýÄ¿£¨io£©Ôö¶à£¬È±Ò³ÖÐÖ¹£¨in£©Ôö¶à£¬ÉÏÏÂÎÄÇл»£¨cs£©´ÎÊýÔö¶à£¬ÆÚ´ýIOµÄÀú³ÌÊý£¨b£©Ôö¶à£¬´ó×ÚCPUʱ¼äÓÃÓÚÆÚ´ýIO£¨wa£©

¡øiostat–ÓÃÓÚ±¨¸æÖÐÑë´¦ÀíÆ÷ͳ¼ÆÐÅÏ¢

iostatÓÃÓÚ±¨¸æÖÐÑë´¦ÀíÆ÷£¨CPU£©Í³¼ÆÐÅÏ¢ºÍÕû¸öϵͳ¡¢ÊÊÅäÆ÷¡¢tty ×°±¸¡¢´ÅÅÌºÍ CD-ROM µÄÊäÈë/Êä³öͳ¼ÆÐÅÏ¢£¬Ä¬ÈÏÏÔʾÁËÓëvmstatÏàͬµÄcpuʹÓÃÐÅÏ¢£¬Ê¹ÓÃÒÔÏÂÏÂÁîÏÔʾÀ©Õ¹µÄ×°±¸Í³¼Æ£º

µÚÒ»ÐÐÏÔʾµÄÊÇ×ÔϵͳÆô¶¯ÒÔÀ´µÄƽ¾ùÖµ£¬È»ºóÏÔʾÔöÁ¿µÄƽ¾ùÖµ£¬Ã¿¸ö×°±¸Ò»ÐС£

³£¼ûlinuxµÄ´ÅÅÌIOÖ¸±êµÄËõдϰ¹ß£ºrqÊÇrequest,rÊÇread,wÊÇwrite,quÊÇqueue£¬szÊÇsize,aÊÇverage,tmÊÇtime,svcÊÇservice¡£

▪rrqm/sºÍwrqm/s£ºÃ¿ÃëºÏ²¢µÄ¶ÁºÍдÇëÇ󣬡°ºÏ²¢µÄ¡±Òâζ×ŲÙ×÷ϵͳ´ÓÐÐÁÐÖÐÄóö¶à¸öÂß¼­ÇëÇóºÏ²¢ÎªÒ»¸öÇëÇóµ½ÏÖʵ´ÅÅÌ¡£

▪r/sºÍw/s£ºÃ¿Ãë·¢Ë͵½×°±¸µÄ¶ÁºÍдÇëÇóÊý¡£

▪rsec/sºÍwsec/s£ºÃ¿Ãë¶ÁºÍдµÄÉÈÇøÊý¡£

▪avgrq ¨Csz£ºÇëÇóµÄÉÈÇøÊý¡£

▪avgqu ¨Csz£ºÔÚ×°±¸ÐÐÁÐÖÐÆÚ´ýµÄÇëÇóÊý¡£

▪await£ºÃ¿¸öIOÇëÇóÆƷѵÄʱ¼ä¡£

▪svctm£ºÏÖʵÇëÇó£¨Ð§ÀÍ£©Ê±¼ä¡£

▪%util£ºÖÁÉÙÓÐÒ»¸ö»îÔ¾ÇëÇóËùռʱ¼äµÄ°Ù·Ö±È¡£

¡ødstat–ϵͳ¼à¿Ø¹¤¾ß

dstatÏÔʾÁËcpuʹÓÃÇéÐΣ¬´ÅÅÌioÇéÐΣ¬ÍøÂç·¢°üÇéÐκͻ»Ò³ÇéÐΣ¬Êä³öÊDzÊÉ«µÄ£¬¿É¶ÁÐÔ½ÏÇ¿£¬Ïà¹ØÓÚvmstatºÍiostatµÄÊäÈëÔ½·¢ÏêϸÇÒ½ÏΪֱ¹Û¡£ÔÚʹÓÃʱ£¬Ö±½ÓÊäÈëÏÂÁî¼´¿É£¬ËäȻҲ¿ÉÒÔʹÓÃÌض¨²ÎÊý¡£

ÈçÏ£ºdstat ¨Ccdlmnpsy

¡øiotop–LINUXÀú³Ìʵʱ¼à¿Ø¹¤¾ß

iotopÏÂÁîÊÇרÃÅÏÔʾӲÅÌIOµÄÏÂÁ½çÃæÆøÑæÆøÑæÀàËÆtopÏÂÁ¿ÉÒÔÏÔʾIO¸ºÔØÏêϸÊÇÓÉÄĸöÀú³Ì±¬·¢µÄ¡£ÊÇÒ»¸öÓÃÀ´¼àÊÓ´ÅÅÌI/OʹÓÃ״̬µÄtopÀ๤¾ß£¬¾ßÓÐÓëtopÏàËƵÄUI£¬ÆäÖаüÀ¨PID¡¢Óû§¡¢I/O¡¢Àú³ÌµÈÏà¹ØÐÅÏ¢¡£

¿ÉÒÔÒԷǽ»»¥µÄ·½·¨Ê¹Óãºiotop ¨Cbod interval£¬Éó²éÿ¸öÀú³ÌµÄI/O£¬¿ÉÒÔʹÓÃpidstat£¬pidstat ¨Cd instat¡£

ËÑË÷ÃñÖÚºÅLinuxÖÐÎÄÉçÇøºǫ́»Ø¸´¡°Ë½·¿²Ë¡±£¬»ñÈ¡Ò»·Ý¾ªÏ²Àñ°ü¡£

¡øpidstat–¼à¿Øϵͳ×ÊÔ´ÇéÐÎ

pidstatÖ÷ÒªÓÃÓÚ¼à¿ØËùÓлòÖ¸¶¨Àú³ÌÕ¼ÓÃϵͳ×ÊÔ´µÄÇéÐÎ,ÈçCPU,ÄÚ´æ¡¢×°±¸IO¡¢Ê¹ÃüÇл»¡¢Ï̵߳È¡£

ʹÓÃÒªÁ죺pidstat ¨Cd interval£»pidstat»¹¿ÉÒÔÓÃÒÔͳ¼ÆCPUʹÓÃÐÅÏ¢£ºpidstat ¨Cu interval£»Í³¼ÆÄÚ´æÐÅÏ¢£ºPidstat ¨Cr interval¡£

¡øtop

topÏÂÁîµÄ»ã×ÜÇøÓòÏÔʾÁËÎå¸ö·½ÃæµÄϵͳÐÔÄÜÐÅÏ¢£º

1.¸ºÔØ£ºÊ±¼ä£¬ÉÏ°¶Óû§Êý£¬ÏµÍ³Æ½¾ù¸ºÔØ£»

2.Àú³Ì£ºÔËÐУ¬Ë¯Ãߣ¬×èÖ¹£¬½©Ê¬£»

3.cpu:Óû§Ì¬£¬½¹µã̬£¬NICE,¿ÕÏУ¬ÆÚ´ýIO,ÖÐÖ¹µÈ£»

4.Äڴ棺×ÜÁ¿£¬ÒÑÓ㬿ÕÏУ¨ÏµÍ³½Ç¶È£©£¬»º³å£¬»º´æ£»

5.½»Á÷·ÖÇø£º×ÜÁ¿£¬ÒÑÓ㬿ÕÏÐ

ʹÃüÇøÓòĬÈÏÏÔʾ£ºÀú³ÌID,ÓÐÓÃÓû§£¬Àú³ÌÓÅÏȼ¶£¬NICEÖµ£¬Àú³ÌʹÓõÄÐéÄâÄڴ棬ÎïÀíÄÚ´æºÍ¹²ÏíÄڴ棬Àú³Ì״̬£¬CPUÕ¼ÓÃÂÊ£¬ÄÚ´æÕ¼ÓÃÂÊ£¬ÀÛ¼ÆCPUʱ¼ä£¬Àú³ÌÏÂÁîÐÐÐÅÏ¢¡£

¡øhtop

htop ÊÇLinuxϵͳÖеÄÒ»¸ö»¥¶¯µÄÀú³ÌÉó²éÆ÷,Ò»¸öÎı¾Ä£Ê½µÄÓ¦ÓóÌÐò(ÔÚ¿ØÖÆ̨»òÕßXÖÕ¶ËÖÐ),ÐèÒªncurses¡£

³¬È«ÕûÀí - LinuxÐÔÄÜÆÊÎö¹¤¾ß»ã×ܺϼ¯

Htop¿ÉÈÃÓû§½»»¥Ê½²Ù×÷£¬Ö§³ÖÑÕÉ«Ö÷Ì⣬¿ÉºáÏò»ò×ÝÏòת¶¯ä¯ÀÀÀú³ÌÁбí£¬²¢Ö§³ÖÊó±ê²Ù×÷¡£

ÓëtopÏà±È£¬htopÓÐÒÔÏÂÓŵ㣺

▪ ¿ÉÒÔºáÏò»òÕß×ÝÏòת¶¯ä¯ÀÀÀú³ÌÁбí£¬ÒԱ㿴µ½ËùÓеÄÀú³ÌºÍÍêÕûµÄÏÂÁîÐС£

▪ ÔÚÆô¶¯ÉÏ£¬±Ètop¸ü¿ì¡£

▪ É±Àú³Ìʱ²»ÐèÒªÊäÈëÀú³ÌºÅ¡£

▪ htopÖ§³ÖÊó±ê²Ù×÷¡£

¡ømpstat

mpstat ÊÇMultiprocessor StatisticsµÄËõд£¬ÊÇʵʱϵͳ¼à¿Ø¹¤¾ß¡£Æ䱨¸æÓëCPUµÄһЩͳ¼ÆÐÅÏ¢£¬ÕâЩÐÅÏ¢´æ·ÅÔÚ/proc/statÎļþÖС£ÔÚ¶àCPUsϵͳÀÆä²»µ«ÄÜÉó²éËùÓÐCPUµÄƽ¾ù״̬ÐÅÏ¢£¬²¢ÇÒÄܹ»Éó²éÌض¨CPUµÄÐÅÏ¢¡£³£¼ûÓ÷¨£ºmpstat ¨CP ALL interval times¡£

¡ønetstat

NetstatÓÃÓÚÏÔʾÓëIP¡¢TCP¡¢UDPºÍICMPЭÒéÏà¹ØµÄͳ¼ÆÊý¾Ý£¬Ò»Ñùƽ³£ÓÃÓÚÄ¥Á·±¾»ú¸÷¶Ë¿ÚµÄÍøÂçÅþÁ¬ÇéÐΡ£

¡ø³£¼ûÓ÷¨£º 

netstat ¨Cnpl   ¿ÉÒÔÉó²éÄãÒª·­¿ªµÄ¶Ë¿ÚÊÇ·ñÒѾ­·­¿ª¡£

netstat ¨Crn    ´òӡ·ÓɱíÐÅÏ¢¡£

netstat ¨Cin    ÌṩϵͳÉϵĽӿÚÐÅÏ¢£¬´òӡÿ¸ö½Ó¿ÚµÄMTU,ÊäÈë·Ö×éÊý£¬ÊäÈë¹ýʧ£¬Êä³ö·Ö×éÊý£¬ÊäÍÉ»¯Î󣬳åÍ»ÒÔ¼°Ä¿½ñµÄÊä³öÐÐÁеij¤¶È¡£

¡øps–ÏÔʾĿ½ñÀú³ÌµÄ״̬  

ps²ÎÊýÌ«¶à£¬ÏêϸʹÓÃÒªÁì¿ÉÒԲο¼man ps£¬³£ÓõÄÒªÁ죺ps  aux  #hsserver£»ps ¨Cef |grep #hundsun

▪ É±µôijһ³ÌÐòµÄÒªÁ죺ps  aux | grep mysqld | grep ¨Cv grep | awk ¡®{print $2 }¡¯ xargs kill -9

▪ É±µô½©Ê¬Àú³Ì£ºps ¨Ceal | awk ¡®{if ($2 == ¡°Z¡±){print $4}}¡¯ | xargs kill -9

¡østrace

¸ú×Ù³ÌÐòÖ´ÐÐÀú³ÌÖб¬·¢µÄϵͳŲÓü°ÎüÊÕµ½µÄÐźÅ£¬×ÊÖúÆÊÎö³ÌÐò»òÏÂÁîÖ´ÐÐÖÐÓöµ½µÄÒì³£ÇéÐΡ£

¾ÙÀý£ºÉó²émysqldÔÚlinuxÉϼÓÔØÄÄÖÖÉèÖÃÎļþ£¬¿ÉÒÔͨ¹ýÔËÐÐÏÂÃæµÄÏÂÁstrace ¨Ce stat64 mysqld ¨Cprint ¨Cdefaults > /dev/null

¡øuptime

Äܹ»´òӡϵͳ×ܹ²ÔËÐÐÁ˶೤ʱ¼äºÍϵͳµÄƽ¾ù¸ºÔØ£¬uptimeÏÂÁî×îºóÊä³öµÄÈý¸öÊý×ֵļÄÒå»®·ÖÊÇ1·ÖÖÓ£¬5·ÖÖÓ£¬15·ÖÖÓÄÚϵͳµÄƽ¾ù¸ººÉ¡£

¡ølsof

lsof(list open files)ÊÇÒ»¸öÁгöÄ¿½ñϵͳ·­¿ªÎļþµÄ¹¤¾ß¡£Í¨¹ýlsof¹¤¾ßÄܹ»Éó²éÕâ¸öÁбí¶Ôϵͳ¼ì²â¼°ÅÅ´í£¬³£¼ûµÄÓ÷¨£º

Éó²éÎļþϵͳÛÕ±Õ  lsof /boot

Éó²é¶Ë¿ÚºÅ±»ÄĸöÀú³ÌÕ¼Óà   lsof  -i : 3306

Éó²éÓû§·­¿ªÄÄЩÎļþ   lsof ¨Cu username

Éó²éÀú³Ì·­¿ªÄÄЩÎļþ   lsof ¨Cp  4838

Éó²éÔ¶³ÌÒÑ·­¿ªµÄÍøÂçÁ´½Ó  lsof ¨Ci @192.168.34.128

¡øperf

perfÊÇLinux kernel×Ô´øµÄϵͳÐÔÄÜÓÅ»¯¹¤¾ß¡£ÓÅÊÆÔÚÓÚÓëLinux KernelµÄϸÃÜ͎ᣬËü¿ÉÒÔ×îÏÈÓ¦Óõ½¼ÓÈëKernelµÄnew feature£¬ÓÃÓÚÉó²éÈÈÃź¯Êý£¬Éó²écashe missµÄ±ÈÂÊ£¬´Ó¶ø×ÊÖú¿ª·¢ÕßÀ´ÓÅ»¯³ÌÐòÐÔÄÜ¡£

ÐÔÄܵ÷ÓŹ¤¾ßÈç perf£¬Oprofile µÈµÄ»ùÀ´Ô´Àí¶¼ÊǶԱ»¼à²â¹¤¾ß¾ÙÐвÉÑù£¬×î¼òÆÓµÄÇéÐÎÊÇƾ֤ tick ÖÐÖ¹¾ÙÐвÉÑù£¬¼´ÔÚ tick ÖÐÖ¹ÄÚ´¥·¢²ÉÑùµã£¬ÔÚ²ÉÑùµãÀïÅжϳÌÐòÆäʱµÄÉÏÏÂÎÄ¡£ÈôÊÇÒ»¸ö³ÌÐò 90% µÄʱ¼ä¶¼ÆÆ·ÑÔÚº¯Êý foo() ÉÏ£¬ÄÇô 90% µÄ²ÉÑùµã¶¼Ó¦¸ÃÂäÔÚº¯Êý foo() µÄÉÏÏÂÎÄÖС£ÔËÆø²»¿É×½Ãþ£¬µ«ÎÒÏëÖ»Òª²ÉÑùƵÂÊ×ã¹»¸ß£¬²ÉÑùʱ¼ä×ã¹»³¤£¬ÄÇôÒÔÉÏÍÆÂ۾ͽÏÁ¿¿É¿¿¡£Òò´Ë£¬Í¨¹ý tick ´¥·¢²ÉÑù£¬ÎÒÃDZã¿ÉÒÔÏàʶ³ÌÐòÖÐÄÄЩµØ·½×îºÄʱ¼ä£¬´Ó¶øÖصãÆÊÎö¡£

ÏëÒª¸üÉîµÄÏàʶ±¾¹¤¾ß¿ÉÒԲο¼£º

http://blog.csdn.net/trochiluses/article/details/10261339

»ã×Ü£ºÍŽáÒÔÉϳ£ÓõÄÐÔÄܲâÊÔÏÂÁî²¢ÁªÏµÎijõµÄÐÔÄÜÆÊÎö¹¤¾ßµÄͼ£¬¾Í¿ÉÒÔÆðÔ´Ïàʶµ½ÐÔÄÜÆÊÎöÀú³ÌÖÐÄĸö·½ÃæµÄÐÔÄÜʹÓÃÄÄ·½ÃæµÄ¹¤¾ß£¨ÏÂÁ¡£

¡¾³£ÓõÄÐÔÄܲâÊÔ¹¤¾ß¡¿

ÊìÁ·²¢ÐÑÄ¿Á˵ڶþ²¿·ÖµÄÐÔÄÜÆÊÎöÏÂÁ¾ß£¬ÒýÈ뼸¸öÐÔÄܲâÊԵŤ¾ß£¬ÏÈÈÝ֮ǰÏȼòÆÓÏàʶ¼¸¸öÐÔÄܲâÊÔ¹¤¾ß£º

▪ perf_events: Ò»¿îËæ Linux Äں˴úÂëһͬÐû²¼ºÍά»¤µÄÐÔÄÜÕï¶Ï¹¤¾ß£¬ÓÉÄÚºËÉçÇøά»¤ºÍÉú³¤¡£Perf ²»µ«¿ÉÒÔÓÃÓÚÓ¦ÓóÌÐòµÄÐÔÄÜͳ¼ÆÆÊÎö£¬Ò²¿ÉÒÔÓ¦ÓÃÓÚÄں˴úÂëµÄÐÔÄÜͳ¼ÆºÍÆÊÎö¡£

¸ü¶à²Î¿¼£ºhttp://blog.sina.com.cn/s/blog_98822316010122ex.html¡£

▪ eBPF tools: Ò»¿îʹÓÃbcc¾ÙÐеÄÐÔÄÜ×·×ٵŤ¾ß,eBPF map¿ÉÒÔʹÓö¨ÖƵÄeBPF³ÌÐò±»ÆÕ±éÓ¦ÓÃÓÚÄں˵÷ÓÅ·½Ã棬Ҳ¿ÉÒÔ¶ÁÈ¡Óû§¼¶µÄÒì²½´úÂë¡£Ö÷ÒªµÄÊÇÕâ¸öÍⲿµÄÊý¾Ý¿ÉÒÔÔÚÓû§¿Õ¼äÖÎÀí¡£Õâ¸ök-vÃûÌõÄmapÊý¾ÝÌåÊÇͨ¹ýÔÚÓû§¿Õ¼äŲÓÃbpfϵͳŲÓý¨Éè¡¢Ìí¼Ó¡¢É¾³ýµÈ²Ù×÷ÖÎÀíµÄ¡£more: http://blog.csdn.net/ljy1988123/article/details/50444693¡£

▪ perf-tools: Ò»¿î»ùÓÚ perf_events (perf) ºÍ ftrace µÄLinuxÐÔÄÜÆÊÎöµ÷ÓŹ¤¾ß¼¯¡£Perf-Tools ÒÀÀµ¿âÉÙ£¬Ê¹ÓüòÆÓ¡£Ö§³ÖLinux 3.2 ¼°ÒÔÉÏÄں˰汾¡£more: https://github.com/brendangregg/perf-tools¡£

▪ bcc(BPF Compiler Collection): Ò»¿îʹÓÃeBPFµÄperfÐÔÄÜÆÊÎö¹¤¾ß¡£Ò»¸öÓÃÓÚ½¨Éè¸ßЧµÄÄں˸ú×ٺͲÙ×÷³ÌÐòµÄ¹¤¾ß°ü£¬°üÀ¨¼¸¸öÓÐÓõŤ¾ßºÍʾÀý¡£Ê¹ÓÃÀ©Õ¹µÄBPF£¨²®¿ËÀûÊý¾Ý°ü¹ýÂËÆ÷£©£¬Õýʽ³ÆΪeBPF£¬Ò»¸öÐµĹ¦Ð§£¬Ê×Ïȱ»Ìí¼Óµ½Linux 3.15¡£¶àÓÃ;ÐèÒªLinux 4.1ÒÔÉÏBCC¡£

¸ü¶à²Î¿¼£ºhttps://github.com/iovisor/bcc#tools¡£

▪ ktap: Ò»ÖÖÐÂÐ͵Älinux¾ç±¾¶¯Ì¬ÐÔÄܸú×Ù¹¤¾ß¡£ÔÊÐíÓû§¸ú×ÙLinuxÄں˶¯Ì¬¡£ktapÊÇÉè¼Æ¸ø¾ßÓл¥²Ù×÷ÐÔ£¬ÔÊÐíÓû§µ÷½â²Ù×÷µÄ¿´·¨£¬É¨³ý¹ÊÕϺÍÑÓÉìÄں˺ÍÓ¦ÓóÌÐò¡£ËüÀàËÆÓÚLinuxºÍSolaris DTrace SystemTap¡£¸ü¶à²Î¿¼£ºhttps://github.com/ktap/ktap¡£

▪ Flame Graphs:ÊÇÒ»¿îʹÓÃperf,system tap,ktap¿ÉÊÓ»¯µÄͼÐÎÈí¼þ£¬ÔÊÐí×îƵÈԵĴúÂë·¾¶¿ìËÙ׼ȷµØʶ±ð£¬¿ÉÒÔÊÇʹÓÃgithub.com/brendangregg/flamegraphÖеĿªÆðÔ´´úÂëµÄ³ÌÐòÌìÉú¡£

¸ü¶à²Î¿¼£ºhttp://www.brendangregg.com/flamegraphs.html¡£

Ò»¡¢ Linux observability tools | Linux ÐÔÄÜÊӲ칤¾ß

³¬È«ÕûÀí - LinuxÐÔÄÜÆÊÎö¹¤¾ß»ã×ܺϼ¯

▪ Ê×ÏÈѧϰµÄBasic ToolÓÐÈçÏ£º

uptime¡¢top(htop)¡¢mpstat¡¢isstat¡¢vmstat¡¢free¡¢ping¡¢nicstat¡¢dstat¡£

▪ ¸ß¼¶µÄÏÂÁîÈçÏ£º

sar¡¢netstat¡¢pidstat¡¢strace¡¢tcpdump¡¢blktrace¡¢iotop¡¢slabtop¡¢sysctl¡¢/proc¡£

¸ü¶à²Î¿¼£ºhttp://www.open-open.com/lib/view/open1434589043973.html£¬ÏêϸµÄÏÂÁîʹÓÃÒªÁì¿ÉÒԲο¼man

¶þ¡¢Linux benchmarking tools | Linux ÐÔÄܲâÆÀ¹¤¾ß

³¬È«ÕûÀí - LinuxÐÔÄÜÆÊÎö¹¤¾ß»ã×ܺϼ¯

ÊÇÒ»¿îÐÔÄܲâÆÀ¹¤¾ß£¬¹ØÓÚ²î±ðÄ £¿éµÄÐÔÄܲâÊÔ¿ÉÒÔʹÓÃÏìÓ¦µÄ¹¤¾ß£¬ÏëÒªÉîÈëÏàʶ£¬¿ÉÒԲο¼×îÏÂÎĵĸ½¼þÎĵµ¡£

Èý¡¢Linux tuning tools | Linux ÐÔÄܵ÷ÓŹ¤¾ß

³¬È«ÕûÀí - LinuxÐÔÄÜÆÊÎö¹¤¾ß»ã×ܺϼ¯

ÊÇÒ»¿îÐÔÄܵ÷ÓŹ¤¾ß£¬Ö÷ÒªÊÇ´ÓlinuxÄÚºËÔ´Âë²ã¾ÙÐеĵ÷ÓÅ£¬ÏëÒªÉîÈëÏàʶ£¬¿ÉÒԲο¼ÏÂÎĸ½¼þÎĵµ¡£

ËÄ¡¢Linux observability sar | linuxÐÔÄÜÊӲ칤¾ß

³¬È«ÕûÀí - LinuxÐÔÄÜÆÊÎö¹¤¾ß»ã×ܺϼ¯

sar£¨System Activity ReporterϵͳÔ˶¯ÇéÐα¨¸æ£©ÊÇÏÖÔÚLINUXÉÏ×îΪÖÜÈ«µÄϵͳÐÔÄÜÆÊÎö¹¤¾ßÖ®Ò»£¬¿ÉÒԴӶ෽ÃæÁÙϵͳµÄÔ˶¯¾ÙÐб¨¸æ£¬°üÀ¨£ºÎļþµÄ¶ÁдÇéÐΡ¢ÏµÍ³Å²ÓõÄʹÓÃÇéÐΡ¢´ÅÅÌI/O¡¢CPUЧÂÊ¡¢ÄÚ´æʹÓÃ״̬¡¢Àú³ÌÔ˶¯¼°IPCÓйصÄÔ˶¯µÈ·½Ãæ¡£

sarµÄ³£¹éʹÓ÷½·¨£ºsar  [options] [-A] [-o file]  t [n]

ÆäÖУº

tΪ²ÉÑù¾àÀ룬nΪ²ÉÑù´ÎÊý£¬Ä¬ÈÏÖµÊÇ1£»

-o fileÌåÏÖ½«ÏÂÁîЧ¹ûÒÔ¶þ½øÖÆÃûÌôæ·ÅÔÚÎļþÖУ¬file ÊÇÎļþÃû¡£

options ΪÏÂÁîÐÐÑ¡Ïî

ÒÔÉϾÍÊdz¬È«ÕûÀí – LinuxÐÔÄÜÆÊÎö¹¤¾ß»ã×ܺϼ¯µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ