Our alogf log function prefixes logged messages with a timestamp, which is very useful. Unfortunately, that requires two printf statements, which we don't want to get split up by concurrent writes. Right now we're using flockfile(3) which makes logging even slower than usual.
Possible approaches:
- Do all logging on a single thread
- Use
fputs_unlocked(3) to write without locking
- Use
write(2) (or libuv's equivalent) to write without locking
Not sure what the best (simplest/fastest) solution is.
Performance does in fact matter for traffic logging.
Our
alogflog function prefixes logged messages with a timestamp, which is very useful. Unfortunately, that requires two printf statements, which we don't want to get split up by concurrent writes. Right now we're usingflockfile(3)which makes logging even slower than usual.Possible approaches:
fputs_unlocked(3)to write without lockingwrite(2)(or libuv's equivalent) to write without lockingNot sure what the best (simplest/fastest) solution is.
Performance does in fact matter for traffic logging.