Eduardo, as we mentioned in the Chatterbox, I think the problem with this benchmark lies with process creation, not TCP vs. PIPEs. With your PIPE code, you are spawning a new process of sendmail each time, however with your TCP code, sendmail is already running.
Additionally, I have a test case on my computer at home (which I cannot get to easily at the moment), with a GO client/server program. Before I separated the two programs, the run time was about 25 seconds, full CPU usage. Once I moved to TCP my run time jumped to almost 2 minutes with CPU never topping over 30-40%. Changing my code once more to use UNIX sockets, I regained full CPU usage and an average run time of 29 seconds. I did not implement a PIPE solution, but I believe UNIX sockets are implemented as a PIPE so the number should between 25-29 seconds if I did, no? :)
Anyway I just wanted to post officially something before everyone ran off making all there PIPE'd programs TCP! :)
Ciao,
Gryn
(p.s. By GO client/server I mean the board game GO, the server sends a 19x19 text array to the client and the client responds back with a move
in this case two random numbers. in the test cases mentioned above this was repeated for about 1,000 moves)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.