Regular pipe vs. Named Pipe

Panos Tsirigotis panos at tigger.Colorado.EDU
Sat Jun 22 11:46:09 AEST 1991


In article <1991Jun21.142246.25245 at utstat.uucp> tg at utstat.uucp (Tom Glinos) writes:
>>
>>I have a better argument: System V message queues are an uni-UNIX abomination
>>that create a new name-space for no good reason, and should be avoided whenever
>>possible on political grounds. The single namespace created in the original
>>UNIX design is its greatest strength, and any attempt to confuse things by
>>creating objects that don't appear in it is evil, rude, and should be opposed
>>by all right thinking people.
>>
>>There's glory for you!
>>-- 
>>Peter da Silva; Ferranti International Controls Corporation; +1 713 274 5180;
>
>The glory of message queues is that they can be amazingly fast.
>
>When I looked into this several years ago I found that systems
>that when a system supports both message queues and named pipes
>the message queues are orders of magnitudes faster than named pipes.
>
>One is therefore tempted to submit oneself to evil!

Well, these days this is not always true. I compared message queues
with named pipes by having two processes transfer a certain amount
of data between them.
(the machine is a Sun 3/60 with 16M of memory, running SunOS 4.1).

MESSAGE QUEUES:

        DATA  Buffer_Size    REAL_TIME  SYSTEM_TIME    USER_TIME           BW
     (bytes)      (bytes)        (sec)        (sec)        (sec) (KB/real_sec)

    131072           16         4.62         2.26         0.28        28.37
    131072           64         1.24         0.48         0.14       105.70
    131072          256         0.38         0.12         0.00       344.93
    131072         1024         0.14         0.04         0.02       936.23
    131072         2048         0.10         0.00         0.00      1310.72

    524288           16        18.60         8.78         0.92        28.19
    524288           64         4.92         2.42         0.22       106.56
    524288          256         1.44         0.64         0.04       364.09
    524288         1024         0.56         0.24         0.00       936.23
    524288         2048         0.42         0.26         0.00      1248.30

   1048576           16        37.52        17.76         1.86        27.95
   1048576           64         9.60         4.40         0.46       109.23
   1048576          256         2.76         1.22         0.10       379.92
   1048576         1024         1.08         0.54         0.00       970.91
   1048576         2048         0.78         0.40         0.00      1344.33

   4194304           16       151.26        71.54         7.78        27.73
   4194304           64        39.00        18.32         1.82       107.55
   4194304          256        11.24         5.06         0.56       373.16
   4194304         1024         4.24         1.86         0.08       989.22
   4194304         2048         3.16         1.58         0.04      1327.31

------------------------------------------------------------

NAMED PIPES:

        DATA  Buffer_Size    REAL_TIME  SYSTEM_TIME    USER_TIME           BW
     (bytes)      (bytes)        (sec)        (sec)        (sec) (KB/real_sec)

    131072           16         5.46         2.52         0.22        24.01
    131072           64         1.42         0.72         0.02        92.30
    131072          256         0.44         0.22         0.00       297.89
    131072         1024         0.16         0.10         0.02       819.18
    131072         2048         0.10         0.06         0.00      1310.69

    524288           16        21.10         7.86         0.54        24.85
    524288           64         5.46         2.62         0.26        96.02
    524288          256         1.60         0.60         0.00       327.68
    524288         1024         0.58         0.30         0.02       903.94
    524288         2048         0.42         0.08         0.02      1248.30

   1048576           16        43.22        16.60         0.80        24.26
   1048576           64        11.02         4.94         0.30        95.15
   1048576          256         3.06         1.36         0.08       342.67
   1048576         1024         1.22         0.60         0.02       859.49
   1048576         2048         0.76         0.50         0.00      1379.70

   4194304           16       173.76        68.76         3.52        24.14
   4194304           64        44.18        19.78         1.10        94.94
   4194304          256        12.24         5.74         0.26       342.67
   4194304         1024         4.30         2.16         0.10       975.42
   4194304         2048         3.02         1.16         0.02      1388.84

------------------------------------------------------------

The above numbers indicate that at least on some OSs message queues 
and named pipes offer comparable bandwidths.
According to the Bach book, the System V R2 implementation of pipes
(and named pipes) was using the file system and that may be the
reason why named pipes were slower than message queues in the past.

Panos
-- 
-----------------------------------------------------------------------------
Panos Tsirigotis, CS grad                        
Computer Science Dept., U. of Colorado @ Boulder, Boulder, CO 80309
Email address: panos at boulder.colorado.edu



More information about the Comp.unix.internals mailing list