Ticket #1656 (closed defect: fixed)
logging is slow
| Reported by: | quozl | Owned by: | erikos |
|---|---|---|---|
| Priority: | High | Milestone: | 0.88 |
| Component: | sugar-toolkit | Version: | 0.84.x |
| Severity: | Unspecified | Keywords: | r+ |
| Cc: | sascha_silbe | Distribution/OS: | Unspecified |
| Bug Status: | Assigned |
Description
Logging to .sugar/default/logs is quite slow; activities that emit more log lines are slower.
The effect is more easily observed on hardware that has a slow path to log storage, such as the XO-1 and XO-1.5. The effect is absent when logs are written to a temporary filesystem.
The effect is most apparent as a variability in the starting time of an activity, such as Terminal or Write. Terminal takes between 2 and 3 seconds to start on XO-1.5 hardware, but roughly one out of four starts takes up to 8 seconds.
The cause of the slowness is the blocking writes to the log, and these are caused by the explicit use of O_SYNC when the log file is opened.
dev.laptop.org ticket 9924 is where the problem was first reported. A patch that removes O_SYNC is attached to that ticket. Only that patch is proposed.
Reasons to continue using O_SYNC are:
- increase the chances of useful logs being available for post-event diagnosis, especially when a child may force a power fail or reset.
Reasons to avoid using O_SYNC are:
- activity startup time and responsiveness.
Monitoring logs with tail(1) or cat(1) while developing or testing is unaffected.
Reducing log output during normal operation of an activity would also reduce the effect of this symptom.

