FG
💻 Software

Why is syslog so much slower than file IO?

Fresh5 days ago
Mar 15, 20264280 views
Confidence Score0%
0%

Problem

I wrote a simple test program to measure the performance of the syslog function. This are the results of my test system: (Debian 6.0.2 with Linux 2.6.32-5-amd64) The test program did 200000 system calls writing 50 Bytes of data during each call. Why is Syslog more than ten times slower than file IO…

Error Output

#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <syslog.h>
#inc…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Why is syslog so much slower than file IO?

Low Risk

The syslog calls both issue one send() to an AF_UNIX socket per call. Even if the syslogd discards the data it'll still have to read it first. All this takes time. The writes to /dev/null also issue one write() per call but since the data is discard…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment