{"id":737,"date":"2012-08-26T18:09:12","date_gmt":"2012-08-26T18:09:12","guid":{"rendered":"http:\/\/wp.neependra.net\/?p=737"},"modified":"2012-08-26T18:09:12","modified_gmt":"2012-08-26T18:09:12","slug":"linux-performance-analysis-and-tuning-talk-at-plug-and-university-of-pune","status":"publish","type":"post","link":"https:\/\/neependra.net\/index.php\/2012\/08\/26\/linux-performance-analysis-and-tuning-talk-at-plug-and-university-of-pune\/","title":{"rendered":"Linux Performance Analysis and Tuning talk at PLUG and University of Pune"},"content":{"rendered":"<p>On this month&#8217;s <a href=\"http:\/\/www.plug.org.in\/\">PLUG<\/a> session <a href=\"http:\/\/plug.org.in\/pipermail\/plug-mail\/2012-August\/009160.html\">I gave talk on<\/a>\u00a0<strong>Performance Analysis and Tuning on Linux,\u00a0<\/strong>which has good <a href=\"http:\/\/plug.org.in\/pipermail\/plug-mail\/2012-August\/009163.html\">feedback<\/a>. Then I got an invitation to do the similar lecture from <a href=\"http:\/\/cms.unipune.ac.in\/\">CMS (Centre for Modeling and Simulation) Department, University of Pune<\/a>. I accepted it and took a session on 25th of this month. I covered same topics in both sessions.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/neependra.net\/wp-content\/uploads\/2012\/08\/perfTalk.jpg\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"size-thumbnail wp-image-764 alignright\" title=\"perfTalk\" src=\"https:\/\/i0.wp.com\/neependra.net\/wp-content\/uploads\/2012\/08\/perfTalk.jpg?resize=150%2C150\" alt=\"Notice about the talk in UoP\" width=\"150\" height=\"150\" srcset=\"https:\/\/i0.wp.com\/neependra.net\/wp-content\/uploads\/2012\/08\/perfTalk.jpg?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/neependra.net\/wp-content\/uploads\/2012\/08\/perfTalk.jpg?resize=720%2C720&amp;ssl=1 720w, https:\/\/i0.wp.com\/neependra.net\/wp-content\/uploads\/2012\/08\/perfTalk.jpg?zoom=2&amp;resize=150%2C150 300w, https:\/\/i0.wp.com\/neependra.net\/wp-content\/uploads\/2012\/08\/perfTalk.jpg?zoom=3&amp;resize=150%2C150 450w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a><\/p>\n<p>I decided not to have any slides and just show output of commands like ps, top, sar and different settings in &#8220;\/proc&#8221; and &#8220;\/sys&#8221; filesystems. I tried to give information about differrent fields in the outputs and related that with performance issue,<br \/>\nlike &#8220;load average&#8221; in top output, Average request size in iostat ouput.<\/p>\n<p>To show the different subsystem I referred different figures from\u00a0<a href=\"http:\/\/www.redbooks.ibm.com\/redpapers\/pdfs\/redp4285.pdf\">http:\/\/www.redbooks.ibm.com\/redpapers\/pdfs\/redp4285.pdf<\/a><\/p>\n<p>Following are some commands and other details which I share<\/p>\n<p><strong><em>ps<\/em> command<\/strong><\/p>\n<p>[sourcecode language=&#8221;text&#8221; gutter=&#8221;false&#8221;]<br \/>\n$ ps aux<br \/>\nUSER PID %CPU %MEM VSZ RSS   TTY STAT START TIME COMMAND<br \/>\nroot  1  0.0  0.2 61988 5236  ?   Ss  Aug17 0:02 \/usr\/lib\/systemd\/systemd<br \/>\nroot  2  0.0  0.0  0    0     ?   S   Aug17 0:00 [kthreadd]<br \/>\nroot  3  0.0  0.0  0    0     ?   S   Aug17 0:05 [ksoftirqd\/0]<br \/>\n[\/sourcecode]<\/p>\n<p><strong><em>&#8211; top <\/em>Command<\/strong><\/p>\n<p>[sourcecode language=&#8221;text&#8221; gutter=&#8221;false&#8221;]<br \/>\n$top<br \/>\n[\/sourcecode]<\/p>\n<p>From the top command output we discussed :&#8211;<br \/>\n&#8211; What is load average and what does it high value means?<br \/>\n&#8211; What are different fields in line starting with &#8220;CpuX&#8221;?<br \/>\n&#8211; What is nice value and how it effects the priority for a process?<\/p>\n<p>&#8211; <strong><em>free<\/em> command<\/strong><\/p>\n<p>[sourcecode language=&#8221;text&#8221; gutter=&#8221;false&#8221;]<br \/>\n$ free -m<\/p>\n<p>                   total used \u00a0free \u00a0shared \u00a0    buffers    cached<br \/>\nMem: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 1962 \u00a01306 \u00a0 656 \u00a0 \u00a00 \u00a0 \u00a0 \u00a0 \u00a0 \u00a075 \u00a0 \u00a0 \u00a0 \u00a0 508<br \/>\n-\/+ buffers\/cache: \u00a0 \u00a0 \u00a0 \u00a0722 \u00a01240<br \/>\nSwap: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a02000 \u00a0   0 \u00a02000<\/p>\n<p>[\/sourcecode]<\/p>\n<div>\n<p>With above output I shared the concept of the &#8220;buffers&#8221; and &#8220;cached&#8221;. Generally we\u00a0consider &#8220;cached&#8221; memory as used memory and does not count it as free, which is not correct. Cache memory can be freed whenever needed. Later I demoed with the <em>drop_cache\u00a0<\/em>setting of the VM&#8217;s (Virtual Memory) configuration(\/proc\/sys\/vm)<\/p>\n<pre><strong>- SAR <\/strong>(System Activity Reporter)<\/pre>\n<p>It is used to collect, report, or save system activity information. It can report CPU, Disk, Memory, Network, paging and other information. If configured with cron then it collects information everyday and store the statistics in \u201c\/var\/log\/sa\u201d folder. The \u201csaX\u201d files are binary files and \u201csarX\u201d file are human readable data, where is day of the month. We can collect all those stats manually as well.<\/p>\n<p>Following command will collect Disk, CPU, Memory, paging, load average stats in every 5 mins and save it in \u201clogfile\u201d file in binary format:-<\/p>\n<p>[sourcecode language=&#8221;text&#8221; gutter=&#8221;false&#8221;]<br \/>\n$ sar -dp -u -r -B -q 5 -o<br \/>\n[\/sourcecode]<\/p>\n<div>\u00a0And with following the binary file can be coverted into CSV file:-[sourcecode language=&#8221;text&#8221; gutter=&#8221;false&#8221;]<br \/>\n$ sadf -d \u2014 -dp -u -r -B -q 5  &gt;<br \/>\n[\/sourcecode]<\/p>\n<div>Other than above I ran and discussed about output collected from following commands:-<\/div>\n<div><strong><em>&#8211;\u00a0dmesg<\/em><\/strong><\/div>\n<div><strong><em>&#8211; dmideode<\/em><\/strong><\/div>\n<div><strong><em>&#8211; lspci<\/em><\/strong><\/div>\n<div><strong><em>&#8211; lspci -nv<\/em><\/strong><\/div>\n<div><\/div>\n<div>I also showed content of the some of the files\/directories from <strong><em>\/proc filesystem\u00a0<\/em><\/strong>and showed different settings. Some of those are:-<\/div>\n<div>\n<p>&#8211; \u00a0\/proc\/meminfo<br \/>\n&#8211; \u00a0\/proc\/&lt;pid&gt;\/maps<br \/>\n&#8211; \u00a0\/proc\/diskstats<br \/>\n&#8211; \u00a0\/proc\/sys\/net\/ipv4<br \/>\n&#8211; \u00a0\/proc\/slabinfo<br \/>\n&#8211; \u00a0\/proc\/interrupts<\/p>\n<\/div>\n<div>\n<p>Then I showed \u00a0how to configure\u00a0<strong><em>sysRq\u00a0<\/em><\/strong>and, collect stack trace for each process and memory information of the system<\/p>\n<p>[sourcecode language=&#8221;text&#8221; gutter=&#8221;false&#8221;]<br \/>\necho 1 &gt; \/proc\/sys\/kernel\/sysrq<br \/>\necho t &gt; \/proc\/sysrq-trigger<br \/>\necho m &gt; \/proc\/sysrq-trigger<br \/>\n[\/sourcecode]<\/p>\n<\/div>\n<div>At the end I gave brief info about SystemTap and Ftrace.<\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<div>2 hours are very short time to talk about Linux performance. I tried to share as much as I can.<\/div>\n<div>Hope it was useful to some of the attendees.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>On this month&#8217;s PLUG session I gave talk on\u00a0Performance Analysis and Tuning on Linux,\u00a0which has good feedback. Then I got an invitation to do the similar lecture from CMS (Centre for Modeling and Simulation) Department, University of Pune. I accepted it and took a session on 25th of this month. I covered same topics in &#8230; <a title=\"Linux Performance Analysis and Tuning talk at PLUG and University of Pune\" class=\"read-more\" href=\"https:\/\/neependra.net\/index.php\/2012\/08\/26\/linux-performance-analysis-and-tuning-talk-at-plug-and-university-of-pune\/\" aria-label=\"Read more about Linux Performance Analysis and Tuning talk at PLUG and University of Pune\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[24,47,48],"tags":[90,107,121],"class_list":["post-737","post","type-post","status-publish","format-standard","hentry","category-geek","category-tricks","category-uncategorized","tag-geek","tag-linux","tag-performance"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/posts\/737","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/comments?post=737"}],"version-history":[{"count":0,"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/posts\/737\/revisions"}],"wp:attachment":[{"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/media?parent=737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/categories?post=737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/neependra.net\/index.php\/wp-json\/wp\/v2\/tags?post=737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}