> [...] minor cleanups, not much interesting in themselves,
> but they are in preparation for merging some performance
> improvements I have in my private syslogd.
So how can syslogd performance be improved (without going
for one of the "new" syslogd systems)?
1. Use poll instead of select, and be smart about handling
different types of input source.
2. Be smarter about deciding which files messages are
written to. Currently syslogd loops through all the
output files checking if a message should be written
to each one. It's pretty easy to precompute a list
of files for each (facility,priority) pair.
3. copy recieved messages less often. Currently they
get read into a buffer, copied to another with various
translations, written to one or more files, and
copied to a "previous line" storage. Sometimes the
buffer is zero filled before being read into!
1107 memset(line, '\0', sizeof(line));
1108 i = recv(fd, line, MAXLINE - 2, 0);
...
1111 line[i] = line[i+1] = '\0';
1112 printchopped(LocalHostName, line, i + 2, fd);
...
printchopped()
1361 if ( parts[fd] != (char *) 0 )
...
1364 strcpy(tmpline, parts[fd]);
...
1377 strcat(tmpline, msg); /* length checked above */
1378 printline(hname, tmpline);
...
printline()
1444 memset (line, 0, sizeof(line));
...
1446 while ((c = *p++) && q < &line[sizeof(line) - 4]) {
...
1462 logmsg(pri, line, hname, SYNC_FILE);
logmsg()
1552 msglen = strlen(msg);
...
1638 if (msglen < MAXSVLINE) {
1639 f->f_prevlen = msglen;
1640 strcpy(f->f_prevline, msg);
1641 fprintlog(f, (char *)from, flags, NULL)
fprintlog()
1664 register struct iovec *v = iov;
...
1696 v->iov_base = f->f_prevline;
1697 v->iov_len = f->f_prevlen;
...
1823 if (writev(f->f_file, iov, 6) < 0)
At last!
This archive was generated by hypermail 2.1.2 : Fri Oct 26 2001 - 22:39:27 CEST