Hi Monks
I hope someone can give me some advice on the following. Right now
I'm writing a program which will be used for load-test purposes on
one of our mailservers here.
The program can be configured to send a certain amount of messages
over a configurable number of sessions to another system. (No, this
is not for spam-purposes ..... just to make sure ;-)
At first I wrote the program in a kind of way that it would open the
preferred number of sessions and then it would send the messages over
these sessions. This would happen then, more or less, sequentially
I didn't take me long to figure out that it would definitely be a
lot quicker if I were to fork the same number of processes as there
needed to be sessions. Which would then, each start it's own session
to the mailserver
After that came the problem. The program had to have a progress-counter
which would state the number of messages that had been sent. The first
thing I tried was having all the child processes write a '.' to a text-
file, which would then be read by the parent (every 5 seconds or so) for
as long as the number of dots was less than the number of messages that
had need to be sent.
This worked perfectly although it wasn't a very elegant way of doing this,
I think. Then someone proposed to use signals ... which is what I did.
Every child would send a SIGUSR2 to the parent each time a message was sent.
But strange enough the total of signals sent to the parent never came close
to the actual number of messages sent. Not knowing how this signalling stuff
actually worked, someone told me a signal was nothing more than some flag in a
register. Which perfectly explained the fact that there were 'messages missing'
... this was ofcourse because of the fact that some signals were send simulta-
neously.
So I hope someone can give me some advice on this timing/signalling problem ...
or should I just stick with the
Dot-solution ? Which, I must confess,
doesn't have my preference
Any advice is more than welcome !
Thanks, Leon
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.