Op 8 jun 2010, om 15:45 heeft Paul J Stevens het volgende geschreven: > Erwin Lubbers wrote: > >> procs -----------memory---------- ---swap-- -----io---- --system-- >> ----cpu---- >> r b swpd free buff cache si so bi bo in cs us sy id wa >> 0 0 0 1979036 31396 43008 0 0 0 0 1011 7 0 0 100 >> 0 >> 0 0 0 1979036 31396 43008 0 0 0 0 1011 9 0 0 100 >> 0 >> 1 0 0 1979036 31396 43008 0 0 0 0 1025 12 28 1 71 >> 0 >> 1 0 0 1979036 31396 43008 0 0 0 0 1013 13 100 0 0 >> 0 >> 1 0 0 1979036 31396 43008 0 0 0 0 1011 9 100 0 0 >> 0 >> 1 0 0 1979036 31396 43008 0 0 0 0 1012 9 100 0 0 >> 0 >> 1 0 0 1979036 31396 43008 0 0 0 0 1011 7 100 0 0 >> 0 >> 1 0 0 1979036 31396 43008 0 0 0 0 1011 9 100 0 0 >> 0 >> 1 0 0 1979036 31396 43008 0 0 0 0 1011 9 100 0 0 >> 0 >> 1 0 0 1979036 31396 43008 0 0 0 0 1017 11 100 0 0 >> 0 >> 0 0 0 1979036 31396 43008 0 0 0 0 1031 20 18 0 82 >> 0 >> 0 0 0 1979036 31396 43008 0 0 0 0 1012 9 0 0 100 >> 0 >> 0 0 0 1979036 31396 43008 0 0 0 0 1011 7 0 0 100 >> 0 > > That's just plain nasty! Almost no context-switching, what is the cpu > doing??? > > Try running it through valgrind or strace on stdin/stdout: > > strace -o /tmp/trace /usr/sbin/dbmail-imapd -n >
I did a trace and tried all select statements that are send to the MySQL server directly and the all respond within 0.01-0.05s. The part of the trace between my SEARCH command and the completed row is attached (I turned on time logging, to see what part takes so much time). There is a gap of around 3 seconds directly after I entered the . SEARCH ALL UNDELETED command. And there is a very large (almost 14 seconds) gap after reading the results from MySQL of the SELECT that is done for the SEARCH command.
16:52:54.361088 read(0, ". SEARCH ALL UNDELETED\n", 4096) = 23 16:52:57.066856 alarm(0) = 3597 16:52:57.067093 time(NULL) = 1276008777 16:52:57.067254 poll([{fd=3, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) 16:52:57.067474 write(3, "\1\0\0\0\16", 5) = 5 16:52:57.067675 read(3, "\7\0\0\1\0\0\0\2\0\0\0", 16384) = 11 16:52:57.068641 poll([{fd=3, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) 16:52:57.068836 write(3, "A\0\0\0\3SELECT owner_idnr FROM dbmail_mailboxes WHERE mailbox_idnr = 119", 69) = 69 16:52:57.069103 read(3, "\1\0\0\1\1P\0\0\2\3def\6dbmail\20dbmail_mailboxes\20dbmail_mailboxes\nowner_idnr\nowner_idnr\f?\0\24\0\0\0\10)@\0\0\0\5\0\0\3\376\0\0\2\0\4\0\0\4\003121\5\0\0\5\376\0\0\2\0", 16384) = 115 16:52:57.069461 time(NULL) = 1276008777 16:52:57.069639 time(NULL) = 1276008777 16:52:57.069791 poll([{fd=3, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) 16:52:57.069960 write(3, "\1\0\0\0\16", 5) = 5 16:52:57.070156 read(3, "\7\0\0\1\0\0\0\2\0\0\0", 16384) = 11 16:52:57.070360 poll([{fd=3, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) 16:52:57.070525 write(3, "l\0\0\0\3SELECT message_idnr FROM dbmail_messages WHERE mailbox_idnr = 119 AND status IN (0,1) ORDER BY message_idnr", 112) = 112 16:52:57.070845 read(3, "\1\0\0\1\1R\0\0\2\3def\6dbmail\17dbmail_messages\17dbmail_messages\fmessage_idnr\fmessage_idnr\f?\0\24\0\0\0\10#B\0\0\0\5\0\0\3\376\0\0\2\0\t\0\0\4\01022624398\t\0\0\5\01022773334\t\0\0\6\01022898515\t\0\0\7\01022932384\t\0\0\10\01022943331\t\0\0\t\01022972186\t\0\0\n\01023023802\t\0\0\v\01023067869\t\0\0\f\01023161243\t\0\0\r\01023174528\t\0\0\16\01023201523\t\0\0\17\01023239400\t\0\0\20\01023241849\t\0\0\21\01023248420\t\0\0\22\01023257711\t\0\0\23\01023272447\t\0\0\24\01023293345\t\0\0\25\01023294166\t\0\0\26\01023299286\t\0\0\27\01023300296\t\0\0\30\01023315427\t\0\0\31\01023322370\t\0\0\32\01023328258\t\0\0\33\01023333119\t\0\0\34\01023338298\t\0\0\35\01023367845\t\0\0\36\01023387685\t\0\0\37\01023410411\t\0\0 \01023410860\t\0\0!\01023415559\t\0\0\"\01023433211\t\0\0#\01023435405\t\0\0$\01023436600\t\0\0%\01023442638\t\0\0&\01023444028\t\0\0'\01023446521\t\0\0(\01023467115\t\0\0)\01023483004\t\0\0*\01023484854\t\0\0+\01023485265\t\0\0,\01023492586\t\0\0-\01023493455\t\0\0.\01023496206\t\0\0/\01023506174\t\0\0000\01023517554\t\0\0001\01023522757\t\0\0002\01023540204\t\0\0003\01023541881\t\0\0004\01023581005\t\0\0005\01023591378\t\0\0006\01023614966\t\0\0007\01023617406\t\0\0008\01023646272\t\0\0009\01023646953\t\0\0:\01023689958\t\0\0;\01023726595\t\0\0<\01023736635\t\0\0=\01023738931\t\0\0>\01023862387\t\0\0?\01023867249\t\...@\01023908629\t\0\0a\01023940908\t\0\0b\01023942127\t\0\0c\01023947702\t\0\0d\01023948851\t\0\0e\01023949916\t\0\0f\01023955839\t\0\0g\01023968659\t\0\0h\01023997505\t\0\0i\01024006527\t\0\0j\01024036758\t"..., 16384) = 7240 16:52:57.079148 read(3, ")\01052042282\t\0\0*\01052076050\t\0\0+\01052169487\t\0\0,\01052192560\t\0\0-\01052193485\t\0\0.\01052195222\t\0\0/\01052210749\t\0\0000\01052296288\t\0\0001\01052296373\t\0\0002\01052347900\t\0\0003\01052373090\t\0\0004\01052397934\t\0\0005\01052459191\t\0\0006\01052460756\t\0\0007\01052490677\t\0\0008\01052644264\t\0\0009\01052683737\t\0\0:\01052733525\t\0\0;\01052736668\t\0\0<\01052840620\t\0\0=\01052985744\t\0\0>\01053027758\t\0\0?\01053043423\t\...@\01053057279\t\0\0a\01053067158\t\0\0b\01053071481\t\0\0c\01053092514\t\0\0d\01053101334\t\0\0e\01053116277\t\0\0f\01053170118\t\0\0g\01053180023\t\0\0h\01053181998\t\0\0i\01053233644\t\0\0j\01053254129\t\0\0k\01053282217\t\0\0l\01053282579\t\0\0m\01053291097\t\0\0n\01053293896\t\0\0o\01053294196\t\0\0p\01053294253\t\0\0q\01053294486\t\0\0r\01053294553\t\0\0s\01053296444\t\0\0t\01053297834\t\0\0u\01053323731\t\0\0v\01053325572\t\0\0w\01053416783\t\0\0x\01053532017\t\0\0y\01053584265\t\0\0z\01053608307\t\0\0[\01053618577\t\0\0\\\01053759012\t\0\0]\01053766791\t\0\0^\01053824473\t\0\0_\01053827137\t\0\0`\01053941869\t\0\0a\01054128005\t\0\0b\01054135903\t\0\0c\01054207043\t\0\0d\01054208520\t\0\0e\01054214594\t\0\0f\01054282054\t\0\0g\01054283089\t\0\0h\01054283830\t\0\0i\01054284340\t\0\0j\01054284363\t\0\0k\01054285026\t\0\0l\01054285969\t\0\0m\01054292069\t\0\0n\01054295012\t\0\0o\01054295814\t\0\0p\01054311223\t\0\0q\01054321294\t\0\0r\01054321313\t\0\0s\01054321339\t\0\0t\01054324593\t\0\0u\01054328132\t\0\0v\01054328184\t\0\0w\01054330256"..., 16384) = 6311 16:52:57.081253 time(NULL) = 1276008777 16:52:57.086865 gettimeofday({1276008777, 87035}, NULL) = 0 16:52:57.087241 gettimeofday({1276008777, 87317}, NULL) = 0 16:52:57.087429 gettimeofday({1276008777, 87488}, NULL) = 0 16:52:57.087778 gettimeofday({1276008777, 87837}, NULL) = 0 16:52:57.087941 gettimeofday({1276008777, 87996}, NULL) = 0 16:52:58.356323 brk(0x8ee2000) = 0x8ee2000 16:52:58.356555 brk(0x8ee1000) = 0x8ee1000 16:53:11.912487 gettimeofday({1276008791, 912614}, NULL) = 0 16:53:11.912736 gettimeofday({1276008791, 912792}, NULL) = 0 16:53:11.919049 gettimeofday({1276008791, 919298}, NULL) = 0 16:53:11.919524 time(NULL) = 1276008791 16:53:11.919705 poll([{fd=3, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) 16:53:11.919889 write(3, "\1\0\0\0\16", 5) = 5 16:53:11.920119 read(3, "\7\0\0\1\0\0\0\2\0\0\0", 16384) = 11 16:53:11.920381 poll([{fd=3, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) 16:53:11.920525 write(3, "\177\0\0\0\3SELECT message_idnr FROM dbmail_messages WHERE mailbox_idnr = 119 AND status IN (0,1) AND deleted_flag=0 ORDER BY message_idnr", 131) = 131 16:53:11.920767 read(3, "\1\0\0\1\1R\0\0\2\3def\6dbmail\17dbmail_messages\17dbmail_messages\fmessage_idnr\fmessage_idnr\f?\0\24\0\0\0\10#B\0\0\0\5\0\0\3\376\0\0\2\0\t\0\0\4\01022624398\t\0\0\5\01022773334\t\0\0\6\01022898515\t\0\0\7\01022932384\t\0\0\10\01022943331\t\0\0\t\01022972186\t\0\0\n\01023023802\t\0\0\v\01023067869\t\0\0\f\01023161243\t\0\0\r\01023174528\t\0\0\16\01023201523\t\0\0\17\01023239400\t\0\0\20\01023241849\t\0\0\21\01023248420\t\0\0\22\01023257711\t\0\0\23\01023272447\t\0\0\24\01023293345\t\0\0\25\01023294166\t\0\0\26\01023299286\t\0\0\27\01023300296\t\0\0\30\01023315427\t\0\0\31\01023322370\t\0\0\32\01023328258\t\0\0\33\01023333119\t\0\0\34\01023338298\t\0\0\35\01023367845\t\0\0\36\01023387685\t\0\0\37\01023410411\t\0\0 \01023410860\t\0\0!\01023415559\t\0\0\"\01023433211\t\0\0#\01023435405\t\0\0$\01023436600\t\0\0%\01023442638\t\0\0&\01023444028\t\0\0'\01023446521\t\0\0(\01023467115\t\0\0)\01023483004\t\0\0*\01023484854\t\0\0+\01023485265\t\0\0,\01023492586\t\0\0-\01023493455\t\0\0.\01023496206\t\0\0/\01023506174\t\0\0000\01023517554\t\0\0001\01023522757\t\0\0002\01023540204\t\0\0003\01023541881\t\0\0004\01023581005\t\0\0005\01023591378\t\0\0006\01023614966\t\0\0007\01023617406\t\0\0008\01023646272\t\0\0009\01023646953\t\0\0:\01023689958\t\0\0;\01023726595\t\0\0<\01023736635\t\0\0=\01023738931\t\0\0>\01023862387\t\0\0?\01023867249\t\...@\01023908629\t\0\0a\01023940908\t\0\0b\01023942127\t\0\0c\01023947702\t\0\0d\01023948851\t\0\0e\01023949916\t\0\0f\01023955839\t\0\0g\01023968659\t\0\0h\01023997505\t\0\0i\01024006527\t\0\0j\01024036758\t"..., 16384) = 5792 16:53:11.931592 read(3, "91\t\0\0\272\01048794907\t\0\0\273\01048809670\t\0\0\274\01048811751\t\0\0\275\01048817868\t\0\0\276\01048841794\t\0\0\277\01048922143\t\0\0\300\01048945397\t\0\0\301\01048984077\t\0\0\302\01049058929\t\0\0\303\01049072373\t\0\0\304\01049076691\t\0\0\305\01049079455\t\0\0\306\01049115626\t\0\0\307\01049140947\t\0\0\310\01049188295\t\0\0\311\01049251969\t\0\0\312\01049335599\t\0\0\313\01049343972\t\0\0\314\01049348112\t\0\0\315\01049369800\t\0\0\316\01049373129\t\0\0\317\01049506857\t\0\0\320\01049541701\t\0\0\321\01049569864\t\0\0\322\01049587187\t\0\0\323\01049629743\t\0\0\324\01049648187\t\0\0\325\01049680737\t\0\0\326\01049705700\t\0\0\327\01049745550\t\0\0\330\01049757152\t\0\0\331\01049791129\t\0\0\332\01049802492\t\0\0\333\01049818239\t\0\0\334\01049832620\t\0\0\335\01049847348\t\0\0\336\01049895499\t\0\0\337\01049899377\t\0\0\340\01049913450\t\0\0\341\01049924581\t\0\0\342\01049934311\t\0\0\343\01050456700\t\0\0\344\01050469085\t\0\0\345\01050469763\t\0\0\346\01050579319\t\0\0\347\01050601641\t\0\0\350\01050610120\t\0\0\351\01050612441\t\0\0\352\01050625745\t\0\0\353\01050626786\t\0\0\354\01050675780\t\0\0\355\01050709489\t\0\0\356\01050716098\t\0\0\357\01050734720\t\0\0\360\01050738777\t\0\0\361\01050757045\t\0\0\362\01050799279\t\0\0\363\01050800158\t\0\0\364\01050808121\t\0\0\365\01050824423\t\0\0\366\01050855119\t\0\0\367\01050858317\t\0\0\370\01050877366\t\0\0\371\01050881996\t\0\0\372\01050892100\t\0\0\373\01050894725\t\0\0\374\01050904065\t\0\0\375\01050906681\t\0\0\376\01050911165\t\0\0\377\01050965867\t\0\0\0\01050967591\t\0\0\1\01050969405\t\0\0\2\01051008608\t\0\0\3\01051047730\t\0\0\4\01051047763\t\0\0\5\01051062189\t\0\0\6\01051063829\t\0\0\7\01051064416\t\0\0\10\010510"..., 16384) = 7759 16:53:11.933104 time(NULL) = 1276008791 16:53:11.933792 brk(0x8f02000) = 0x8f02000 16:53:11.935726 gettimeofday({1276008791, 935784}, NULL) = 0 16:53:11.935973 gettimeofday({1276008791, 936037}, NULL) = 0 16:53:11.936678 gettimeofday({1276008791, 936742}, NULL) = 0 16:53:11.936924 gettimeofday({1276008791, 936975}, NULL) = 0 16:53:11.937154 gettimeofday({1276008791, 937209}, NULL) = 0 16:53:11.937814 gettimeofday({1276008791, 937878}, NULL) = 0 16:53:11.938064 gettimeofday({1276008791, 938119}, NULL) = 0 16:53:11.939816 gettimeofday({1276008791, 939873}, NULL) = 0 16:53:11.939972 gettimeofday({1276008791, 940021}, NULL) = 0 16:53:11.940140 gettimeofday({1276008791, 940190}, NULL) = 0 16:53:11.940705 lseek(4, 390, SEEK_SET) = -1 ESPIPE (Illegal seek) 16:53:11.940838 write(4, "* SEARCH 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281"..., 4073) = 4073 16:53:11.942318 lseek(4, 4463, SEEK_SET) = -1 ESPIPE (Illegal seek) 16:53:11.942451 write(4, ". OK SEARCH completed\r\n", 23) = 23 16:53:11.942803 gettimeofday({1276008791, 942855}, NULL) = 0 16:53:11.943063 gettimeofday({1276008791, 943118}, NULL) = 0 16:53:11.943286 gettimeofday({1276008791, 943336}, NULL) = 0 16:53:11.943455 gettimeofday({1276008791, 943504}, NULL) = 0 16:53:11.943622 gettimeofday({1276008791, 943672}, NULL) = 0 16:53:11.943776 poll([{fd=3, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) 16:53:11.943974 write(3, "\1\0\0\0\16", 5) = 5 16:53:11.944143 read(3, "\7\0\0\1\0\0\0\2\0\0\0", 16384) = 11 16:53:11.944347 alarm(3600) = 0 16:53:11.944492 read(0, ". LOGOUT\n", 4096) = 9
_______________________________________________ DBmail mailing list DBmail@dbmail.org http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail