From: Szymon Juraszczyk (no email)
Date: Mon Oct 01 2001 - 05:00:22 EDT
On Mon, 2001-10-01 at 17:27:58, Jeremy Howard wrote:
> Szymon Juraszczyk wrote:
> > OK, do not worry :-) We learn something each day. I had no sleep, it was
> > already dawn so I wrote some sharp words. Thanks for contributing the
> > software anyway!
> Can you post the patch that you made please? Any other suggestions for
> improving unix_notify? I haven't heard reports of anyone else using it in a
> production environment, so any feedback would be much appreciated :-)
I just changed
cnt = write(sock, messageToSend, strlen(messageToSend));
cnt += write(sock, message, strlen(message));
cnt += write(sock, &newline, 1);
and added declaration
char newline = '\n';
in function notify()
I asserted that those 4 variables won't exceed 2KB buffer :-) Quick and
dirty fix, nothing to base on but I'm sending this as you wish.
> PS: What kind of SMS daemon are you using? Preforking Perl daemon?
Actually I don't even prefork the listening (master) proces. The process
is listening alone on a socket and it spawns a child when it comes to
sending an SMS (first it looks up the user in the database to check whether
he/she has set up SMS notification). I did not see any need for preforking
as the time between accepting a connection, looking up the user in DB and
spawning a child is short enough to handle the load for some 5500 mailboxes.
So I use perl skeleton from the Cyrus source with preforking part cut out.
When the load increases I might fork right after accepting the connection.
However, fork() will be done even if no SMS will be actually sent, so at the
moment I've chosen the former model. Preforking processes on listening
socket are needed for really considerable load, when swift response
is required (webservers are good example).
For sending SMS I use LWP library and web2sms gateways provided by all of
the three mobile telecoms in Poland.
-- Szymon Juraszczyk, Surfland Computer Systems S.A. tel. +48 71 78-02-952, http://www.ssk.com.pl/