=== zkriesse_ is now known as zkriesse === Liquid is now known as Guest91228 === fenris is now known as Guest20801 === Guest20801 is now known as ejat === yofel_ is now known as yofel [14:49] morning all === xx is now known as Guest14855 [15:49] i am ready for the upcoming session... [15:54] 6 more mins [15:58] Folks, special announcement. [15:58] Today is the_hydra's birthday! [15:58] And he's celebrating that by giving a session in -classroom! [15:58] * the_hydra bows to everyone [15:59] happy birthday the_hydra [15:59] by the way, we arent muted ;) [15:59] resno: thanks...I hope I do something meaningful [15:59] ok, is it now? [15:59] the_hydra: me too [16:00] its 11 am! [16:00] ok, let's begin, shall we? [16:01] hang on for a minute [16:01] k... [16:01] the classbot should kick in [16:02] whats the chat channel? [16:03] "ubuntu-classroom-chat" AFAIK [16:03] thanks [16:03] ok people, let's roll [16:03] today, I am gonna discuss about how to use monitoring tools in Linux to pinpoint system problems such as lack of RAM and so on [16:04] what we're gonna quickly observe here is top, vmstat and friends [16:04] "top" is a classic...you will likely find it in every UNIX flavour.... [16:05] if you look closer, "top" display almost everything, your CPU usage, memory usage, process statistics [16:05] they're either displayed as percentage or number...mostly.. [16:06] for example, CPU usage...are divided into user and system (marked as "us" and "sy") [16:06] anyone has idea what they mean? [16:07] us: processes that are controlled by user account [16:07] and don't have there system account (i guess) [16:07] other ideas? [16:07] well like you said us for user and sy for system [16:08] alright, "us" means time spent in user mode [16:08] user: processes that the user owns or runs [16:08] while "sy" is system [16:08] let's pick cp [16:08] when you copy a file with it, cp do two things actually: [16:08] 1. read the data from disk [16:09] 2. copy it to memory area, and write it somewhere [16:09] read and write to disk are example of system work [16:09] while pasting them to temporary buffer in RAM is user mode [16:10] or to make it simple, "sy" is anything where kernel is involved [16:10] the_hydra: What does it actually mean by user mode? [16:10] meaning, it could entirely done without kernel involved [16:10] ok [16:10] e.g: number operation (substract, multiplication) [16:11] so, let's bring this knowledge when observing top [16:11] high "us" means CPU is busy doing very likely number crunching [16:11] you guys got a figure what number crunching is? [16:11] sorry guys but aren't we supposed to ask questions in the chat section because i just asked there and see others ask here [16:12] ok wait [16:13] Q: obengdako : i realise for cpu there is also ni id wa hi si st what do they mean? [16:13] ni is a field that tells us how much CPU time is spent to work on "niced" jobs [16:14] nice means any process with priority higher than 0 [16:14] these jobs are likely to be scheduled less frequently...because CPU prioritize bigger ones [16:15] id --> idle... CPU idle a.k.a resting :) [16:15] wa--> ok this is interesting [16:15] ever wonder on event like waiting cp or rsync doing large files transfer? [16:16] although they spent time in user and system mode, but they spend more in waiting.... [16:16] why wait? because the data need to be read from the disk spindle [16:17] reading from disk are thousands time slower rather than from RAM...so you got the picture [16:17] other example are waiting data from network [16:17] so next time you see high number it %wa, go check if an application is sitting in background doing I/O [16:18] Q: when you say higher you mean greater than zero and meaning a lower priority? [16:18] in priority, bigger number means lower priority [16:18] so +5 vs -5, -5 wins :) [16:19] next: si and hi... [16:19] they are interrupts actually [16:20] if it's quite big, let's say 50%, then very likely a device is "interrupting" your CPU too much [16:20] it could be sending data, a damaged hardware and so on [16:21] lately, thanks to DMA (Direct Memory access), CPU is less likely involved in hardware operation, so you can be more relaxed in regards to CPU utilization [16:21] Q: so ni will be for the higher priority stuff that have figures less than zero eg. pulseaudio at -11 [16:22] nope, -11 isn't accounted in %ni [16:22] only if e.g pulse audio is marked as +5 [16:23] Q: so would si be system interrupt and hi be hardware interrupt? [16:23] nope, si is "soft interrupt" [16:23] while "hi" is hard interrupt [16:23] "hi" for example is interrupt coming from your keyboard received by the CPU [16:24] and "si"? you can think like this: Linux kernel splits the job of taking care your hardware in two "session"...initially, in "hard interrupt" mode [16:24] which is done as fast as possible [16:25] and later, the rest is done in "soft interrupt" [16:25] so both represents the job when system is handling hardware most of the times [16:25] let me pause briefly here... [16:26] note: likely you will just need to watch %id [16:26] because, by knowing it, you could have idea how busy the CPUs are :) [16:26] for example, %id is 99% [16:26] so CPU is only busy 1% [16:27] press "1" to get per core/ per physical CPU statistic [16:27] by default what you see there is the sum of all CPUs [16:28] Q: final about ni so desktopcouch-se with ni of 10 will be accounted for in %ni and not pulseaudio with -11 ? [16:28] correct obengdako [16:28] and if you suspect slowness but you think Linux is "doing nothing", check %wa [16:29] if it's bigger than 0, then.....it's doing I/O e.g reading your USB thumbdrive [16:29] Q: How to switch back to sum of all cpu? [16:30] simple, "1" again :D [16:30] it's a toggle :D [16:30] ok, slipped something... [16:30] see "zombie" field? [16:30] got idea what that is? [16:31] zombies are processes that havent quit yet [16:31] correct... [16:32] so, if you see that field is bigger than zero...very likely you see bugs in the current running applications [16:32] to pin point it, you can use "ps" or "top" in batch mode and look out for process with "Z" status [16:33] such as "ps auxww | grep Z" [16:33] AFAIK to get rid of it, you have to kill the "master" process [16:33] pstree could help locate the parent of the zombie [16:34] Q: how do i use top in batch mode? [16:34] use -b switch [16:34] please note that batch mode will use any setting you have written to ~/.toprc [16:35] for example, you have set that you only display 20 process (by pressing "n" in top"), then in batch mode you will only see 20 process listed too [16:36] batch mode is an alternative way to continously monitor your system but in non interactive mode :) [16:36] ok, may I move to memory part? [16:37] you will likely think "great, all my RAM are used?" [16:37] "all are my app that hungry" [16:37] most likely no...check buffers and cached field [16:38] the bigger they are, meaning Linux is caching some of recently accessed files in your RAM [16:38] the purpose? to speed up the next access toward those files [16:39] Q: the_hydra: did you talk about st? [16:39] st is "steal" [16:39] what is stealed? [16:39] it's introduced in this virtualization hype era [16:40] it means some of your CPU time are accounted for doing something for the virtual machine [16:40] so if you run plenty virtual machines (be it KVM, Xen, Qemu in KVM mode etc), you will see this field increased [16:41] swap used is bigger than 0? meaning: you need more RAM... :) [16:42] seriously: swapping should be avoided actually...so if you have budget and can afford for bigger RAM, buy them..it will make your machine runs faster [16:42] these days, 2 GiB is the lowest amount of RAM you should have IMHO === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Current Session: How to use top and similar tools to pinpoint system problems - Instructors: the_hydra [16:43] doh [16:46] resno asked: Is there a way to tell when the CPU is not keeping up. As in when more RAM wont help. [16:47] while %sy and %us are nice clue, for better indication use load average field [16:47] those three number represents loads during the last 5, 10 and 15 minutes respectively [16:47] but what is "load"? [16:48] the simplest meaning is: the average number of process running per core [16:48] so if you have quad core and you see -/+ 4.0, it means per core are fairly constantly running 1 process [16:49] obengdako asked: so if my swap is never used according to top can i delete the swap partition? [16:49] better not..think swap like the emergency room [16:50] if you have no swap and suddenly your application need more "memory", you will ended with situation called OOM (out of memory) [16:50] the effect? your app will be killed....:D [16:50] must be hurry :) [16:50] There are 10 minutes remaining in the current session. [16:51] process field....you can sort them here..press "M" to sort them by memory usage [16:51] and "P [16:51] for CPU usage [16:52] so if you wanna get quick idea which one is hungry for RAM...press M...then kazaam...you know it :) [16:53] pay attention that for finer grained statistics, you need to lower the update...press "s" and make it somewhere between 3 and 5 [16:53] anything higher will make top update quite slow [16:54] but if it is lower than that, you will make top itself one of top CPU consumer :) [16:54] VSZ or RSS, which one represents memory usage? [16:54] correct answer is RSS [16:55] you can think VSZ like the final plan construction of a building [16:55] while RSS is current progress of building construction itself [16:55] There are 5 minutes remaining in the current session. [16:56] effectively use "P" and "M" will help you to find out question like "machine feels slow, ok who's the suspect?" [16:56] again, questions? [16:56] obengdako asked: sorry but where from RSS and VSZ are they in top? or should i google? [16:57] oh sorry, I mean RES and VIRT [16:57] VIRT=virtual size (final plan construction" [16:57] RES= current construction progress [16:58] i think we got 2-3 minutes left [16:58] btw, press "f" in top...you have plenty choice of fields there [16:59] perhaps another time,I shall discuss them [16:59] obengdako asked: so is that like the maximum possible allocation for an app (virt) and res the current allocation? [16:59] not really...virt itself can expand [17:00] but compared to RSS, it is likely to change too frequently [17:00] it is not, I mean [17:01] Logs for this session will be available at http://irclogs.ubuntu.com/2011/01/27/%23ubuntu-classroom.html === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || [17:01] wow great session the_hydra [17:02] Thanks for the wonderful session the_hydra and Happy birthday again! [17:03] sorry if the time feels too narrow, guys === tubadaz_ is now known as tubadaz === Raist is now known as Guest98867