$Id: performance,v 1.6 2021/11/23 02:53:38 nanons Exp $

Improving performance
=====================

By default, OpenBSD heavily restricts processes from using the CPU.
These restrictions can be adjusted with apmd(8).

To enable apmd(8) and set automatic performance adjustment mode:

	# rcctl enable apmd
	# rcctl set apmd flags -A
	# rcctl restart apmd

In automatic performance adjustment mode, CPU frequency is kept at its
lowest and increases whenever there is high load.  To print the current
CPU frequency (in MHz):

	$ sysctl hw.cpuspeed

CPU frequency can be adjusted manually with apmd(8)'s -L and -H flags.
The apm(8) utility can also be used with the same flags to control a
running apmd(8).

Pitfalls
========

Some users recommend increasing login.conf(5) or sysctl(2) limits or
adding users to the "staff" class.  On modern OpenBSD the default limits
are often high enough that increasing them won't make a difference.

Soft updates (see "softdep" in mount(8)) do help with disk performance,
but increase attack surface and have a history of corrupting data.
See also:

	https://marc.info/?t=142164016900001&r=1&w=2
	https://marc.info/?t=143769840000001&r=1&w=2
	https://marc.info/?l=openbsd-misc&m=147546995023909&w=2
