linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* very slow parallel read performance
@ 2001-08-23 21:35 Lehmann 
  2001-08-24  7:35 ` [resent PATCH] " Roger Larsson
  0 siblings, 1 reply; 112+ messages in thread
From: Lehmann  @ 2001-08-23 21:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: oesi

I tested the following under linux-2.4.8-ac8, linux-2.4.8pre4 and
2.4.5pre4, all had similar behaviour.

I have written a webserver that serves many large files, and thus, the
disks are the bottleneck. To get around the problem of blocking reads
(this killed thttpd's performance totally, for example) I can start one or
more reader threads. And strace of them under load looks like this:

     0.000400 read(6, "\300g#\v", 4)    = 4 <0.000091>
     0.000315 lseek(1129, 70376488, SEEK_SET) = 70376488 <0.000088>
     0.000287 read(1129, "\212\266\233^\250\23\256D\21E\'#c\242\351pp`:Q[\22/:\27"..., 65536) = 65536 <0.047408>
     0.051059 write(9, "\300g#\v", 4)   = 4 <0.000052>
     0.000222 read(6, "@\3755\r", 4)    = 4 <0.000036>
     0.000187 lseek(946, 26180056, SEEK_SET) = 26180056 <0.000035>
     0.000162 read(946, "\0\20\24\0\330\6\30\264\345\263\247\213\264\0\274\4\340"..., 65536) = 65536 <0.029500>
     0.029976 write(9, "@\3755\r", 4)   = 4 <0.000098>
     0.000331 read(6, "\300\373j\r", 4) = 4 <0.000088>
     0.000309 lseek(944, 33816188, SEEK_SET) = 33816188 <0.000090>
     0.000287 read(944, "\210]\360C\340\200\315\363@\205\203\250\316\256\"\34,E"..., 65536) = 65536 <0.043455>
     0.043885 write(9, "\300\373j\r", 4) = 4 <0.000042>
     0.000200 read(6, "\0\227M\r", 4)   = 4 <0.000035>
     0.000191 lseek(315, 1310720, SEEK_SET) = 1310720 <0.000034>
     0.000162 read(315, "\7\17\376\250\37\312m\210\24\215s\257v\246\354\272\253"..., 65536) = 65536 <0.025821>
     0.026236 write(9, "\0\227M\r", 4)  = 4 <0.000040>

filehandles 6 and 9 are request / result filehandles, i.e. the thread(s)
read the request on filehandle 6, execute it (e.g. lseek/read) and then
write the result back to fh 9.

as you can see, the read-request/lseek/write-result syscalls are very
fast, while the read-from-file-call totally dominates the runtime, which
is sensible, since the disks can only seek so-and-so-many times per
second. under this config the server steadily delivers about 23mbits/s.

Now I thought I'd start more threads to give the kernel elevator more
chances to optimize reads, however, it gets much slower. when I start 128
threads, the strace of one thread now looks like this:

     0.002181 read(6, "\300\311\205\f", 4) = 4 <0.000091>
     0.000351 lseek(857, 12798664, SEEK_SET) = 12798664 <0.000087>
     0.000292 read(857, "^0\260\274\363\3078\314\373\343\254h\360\276\347\332\305"..., 65536) = 65536 <28.176472>
    28.177062 write(9, "\300\311\205\f", 4) = 4 <0.000039>
     0.000200 read(6, "@\2\265\10", 4)  = 4 <0.000033>
     0.000480 lseek(471, 6553600, SEEK_SET) = 6553600 <0.000033>
     0.000182 read(471, "\244\t*\\\225`+\270@\210\206\367\10\261\4m\32\206\377x"..., 65536) = 65536 <36.023682>
    36.025902 write(9, "@\2\265\10", 4) = 4 <0.000107>
     0.000422 read(6, "\0A\235\r", 4)   = 4 <0.000107>
     0.000335 lseek(1239, 7143424, SEEK_SET) = 7143424 <0.000088>
     0.000309 read(1239, "\'\213\315\372\331+x\271\234Bx\255\274\"G\202\264L+>\266"..., 65536) = 65536 <0.154575>
     0.155760 write(9, "\0A\235\r", 4)  = 4 <0.000093>
     0.000337 read(6, "@G\235\r", 4)    = 4 <0.000387>
     0.000676 lseek(998, 4989944, SEEK_SET) = 4989944 <0.000093>
     0.000357 read(998, "\214P\325|k\226\260\31\351\260\10\10:\23d`\271Tu\32\252"..., 65536) = 65536 <36.512863>
    36.513243 write(9, "@G\235\r", 4)   = 4 <0.002407>

as you can see, read request now can take about ten times longer than they
should (30 / 128 = 0.2). as a result, webserver thruput decreases to a
mere 4mbits/s.

I would have expected a slight slowdown at most (more processing, maybe
cache effects), but not that much. any ideas why this is so and what could
be done against it?

-- 
      -----==-                                             |
      ----==-- _                                           |
      ---==---(_)__  __ ____  __       Marc Lehmann      +--
      --==---/ / _ \/ // /\ \/ /       pcg@goof.com      |e|
      -=====/_/_//_/\_,_/ /_/\_\       XX11-RIPE         --+
    The choice of a GNU generation                       |
                                                         |

^ permalink raw reply	[flat|nested] 112+ messages in thread

end of thread, other threads:[~2001-08-28  3:13 UTC | newest]

Thread overview: 112+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-23 21:35 very slow parallel read performance Lehmann 
2001-08-24  7:35 ` [resent PATCH] " Roger Larsson
2001-08-24 17:43   ` Rik van Riel
2001-08-24 18:28     ` Roger Larsson
2001-08-24 19:02       ` Rik van Riel
2001-08-24 20:37         ` Gérard Roudier
2001-08-24 23:12           ` Rik van Riel
2001-08-25  8:02             ` Gérard Roudier
2001-08-25  9:26               ` Roger Larsson
2001-08-25 11:49                 ` Gérard Roudier
2001-08-25 17:56                   ` Roger Larsson
2001-08-25 19:13                     ` Gérard Roudier
2001-08-25 13:17               ` Rik van Riel
2001-08-24 22:29         ` Daniel Phillips
2001-08-24 23:10           ` Rik van Riel
2001-08-25  0:42             ` Daniel Phillips
2001-08-27  7:08           ` Helge Hafting
2001-08-27 14:31             ` Daniel Phillips
2001-08-27 14:42               ` Alex Bligh - linux-kernel
2001-08-27 15:14                 ` Rik van Riel
2001-08-27 16:04                   ` Daniel Phillips
     [not found]                   ` <Pine.LNX.4.33L.0108271213370.5646-100000@imladris.rielhome.cone ctiva>
2001-08-27 19:34                     ` Alex Bligh - linux-kernel
2001-08-27 20:03                       ` Oliver Neukum
2001-08-27 20:19                         ` Alex Bligh - linux-kernel
2001-08-27 21:38                           ` Oliver.Neukum
2001-08-27 22:26                             ` Alex Bligh - linux-kernel
2001-08-27 21:29                       ` Daniel Phillips
2001-08-27 16:02                 ` Daniel Phillips
2001-08-27 19:36                   ` Alex Bligh - linux-kernel
2001-08-27 20:24                     ` Daniel Phillips
2001-08-27 16:55               ` David Lang
2001-08-27 18:54                 ` Daniel Phillips
2001-08-27 18:37               ` Oliver Neukum
2001-08-27 19:04                 ` Daniel Phillips
2001-08-27 19:43                   ` Oliver Neukum
2001-08-27 20:37                     ` Daniel Phillips
2001-08-27 22:10                       ` Oliver.Neukum
2001-08-27 21:44                     ` Linus Torvalds
2001-08-27 22:30                       ` Daniel Phillips
2001-08-27 23:00                       ` Marcelo Tosatti
2001-08-28  3:10                         ` Linus Torvalds
2001-08-27 19:55                 ` Richard Gooch
2001-08-27 20:09                   ` Oliver Neukum
2001-08-27 21:06                   ` Daniel Phillips
2001-08-24 20:18     ` Daniel Phillips
2001-08-24 20:19       ` Rik van Riel
2001-08-24 21:11         ` Daniel Phillips
2001-08-24 23:03           ` Rik van Riel
2001-08-25  0:41             ` Daniel Phillips
2001-08-25  1:34               ` Rik van Riel
2001-08-25 15:49                 ` Daniel Phillips
2001-08-25 15:50                   ` Rik van Riel
2001-08-25 16:28                     ` Lehmann 
2001-08-25 16:34                       ` Rik van Riel
2001-08-25 16:41                         ` Lehmann 
2001-08-26 16:55                       ` Daniel Phillips
2001-08-26 18:39                         ` Rik van Riel
2001-08-26 19:46                           ` Daniel Phillips
2001-08-26 19:52                             ` Rik van Riel
2001-08-26 20:08                               ` Daniel Phillips
2001-08-26 22:33                                 ` Russell King
2001-08-26 23:24                                   ` Daniel Phillips
2001-08-26 23:24                                     ` Russell King
2001-08-27  0:07                                     ` Rik van Riel
2001-08-27  0:02                                 ` Rik van Riel
2001-08-27  0:42                                   ` Daniel Phillips
2001-08-25 16:43                     ` Daniel Phillips
2001-08-25 19:15                       ` Alan Cox
2001-08-25 19:35                         ` Lehmann 
2001-08-25 20:52                           ` Rik van Riel
2001-08-26  1:38                             ` Daniel Phillips
2001-08-26  2:49                               ` Lehmann 
2001-08-26 17:29                                 ` Daniel Phillips
2001-08-26 17:37                                   ` Craig I. Hagan
2001-08-26 18:56                                   ` Rik van Riel
2001-08-26 19:18                                   ` Lehmann 
2001-08-26 21:07                                     ` Daniel Phillips
2001-08-26 22:12                                       ` Rik van Riel
2001-08-26 23:24                                       ` Lehmann 
2001-08-26 20:26                                   ` Gérard Roudier
2001-08-26 21:20                                     ` Daniel Phillips
2001-08-26  3:32                               ` Rik van Riel
2001-08-26 13:22                                 ` Lehmann 
2001-08-26 13:48                                   ` Rik van Riel
2001-08-26 14:55                                     ` Lehmann 
2001-08-26 15:06                                       ` Rik van Riel
2001-08-26 15:25                                         ` Lehmann 
2001-08-25 21:33                           ` Alan Cox
2001-08-25 23:34                             ` Lehmann 
2001-08-26  2:02                               ` Rik van Riel
2001-08-26  2:57                                 ` Lehmann 
2001-08-26  0:46                           ` John Stoffel
2001-08-26  1:07                             ` Alan Cox
2001-08-26  3:30                               ` Rik van Riel
2001-08-26  3:40                             ` Rik van Riel
2001-08-26  5:28                               ` Daniel Phillips
2001-08-24 23:23         ` Lehmann 
     [not found]           ` <200108242344.f7ONi0h21270@mailg.telia.com>
2001-08-25  0:28             ` Lehmann 
2001-08-25  3:09           ` Rik van Riel
2001-08-25  9:13             ` Gérard Roudier
2001-08-26 16:54           ` Daniel Phillips
2001-08-26 18:59             ` Victor Yodaiken
2001-08-26 19:38               ` Rik van Riel
2001-08-26 20:05                 ` Victor Yodaiken
2001-08-26 20:34                   ` Rik van Riel
2001-08-26 20:45                     ` Victor Yodaiken
2001-08-26 21:00                       ` Alan Cox
2001-08-26 20:42               ` Daniel Phillips
2001-08-26 19:31             ` Lehmann 
2001-08-24 19:42   ` Lehmann 
2001-08-24 21:42     ` Gérard Roudier
2001-08-25  0:05   ` Craig I. Hagan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).