Solved Tuning for Desktop Use

Well, I did some searches for the title both here and Google but only came up with a couple of things, mainly from "cool trainer" which is for FreeBSD 11 and who knows how valid or applicable on 12.x. I know there a bunch of tunable params (sysctl?) available in FreeBSD but are there any that are actually beneficial for desktop use? I see the shared memory one for Chrome, assume that also applies to www/chromium. Does this actually do anything? I try to keep my /etc/rc.conf, /etc/sysctl.conf and /boot/loader.conf fairly simple but I have seen some very lengthy additions to these files for network tuning, etc. I don't want to clutter up my configs with a bunch of meaningless entries that are not meant for my use case.

Any recommendations from folks using FreeBSD as a desktop? I am running x11-wm/fluxbox and the x11/drm-kmod driver for my HD630 Intel GPU. I have 64GB of ram, an i7 7700 and the system is all SSD: one for the OS and one for my user's /home. My main usage is web, graphics editing, possible video editing, playing streaming music and writing. I also game using emulators/wine.

I remember SirDice mentioning to a user that out of the box, FreeBSD is tuned pretty well, but I can't remember for what use case. Any pointers folks have would be greatly appreciated. Thanks.
 
"autotuned" FreeBSD works very well for desktop (even for a mobile desktop). Caveat: I haven't tested with zfs yet. Usually the only tuning I need to do is for applications or for functionality (vfs.usermount=1 in /etc/sysctl.conf for example).
 
Mostly you change /boot/loader.conf , /etc/rc.conf and /etc/sysctl.conf according to your specific needs , but these vary from to user ... No general rule apply but the most common are the defaults ...
In sysctl.conf i have :
kern.ipc.shmmax=1000000000
Giving me 1G shared memory if an application needs it.
When an application can't find the shared memory it needs it can, or work without using it, or terminate .
 
Well, basically these are the parameters I've changed regarding desktop usage:
In /boot/loader.conf:
Code:
# Shared memory, max process increases
kern.ipc.shmseg="1024"
kern.ipc.shmmni="1024"
kern.maxproc="100000"

## Graphics Card power saving (Intel GPUs)
# Skip unnecessary Mode Sets at boot time
compat.linuxkpi.i915_fastboot=1
# Enable power saving Display C-STATES
compat.linuxkpi.i915_enable_dc=2
# Enable Frame Buffer Compression
compat.linuxkpi.i915_enable_fbc=1
In /etc/sysctl.conf:
Code:
# Allow users to mount disks
vfs.usermount=1

# Autodetect the most recent sound card.
hw.snd.default_auto=1

# Enable shared memory
kern.ipc.shm_allow_removed=1

# Enhance desktop responsiveness under high CPU usage
kern.sched.preempt_thresh=224

# Increase VFS read-ahead (better disk performance - particularly for SSDs)
# FreeBSD Default: 64
vfs.read_max=128
Hope it turns out helpful for you and others
 
I have these but use at own risk :).

kern.randompid=1
kern.sched.preempt_thresh=200 #80 Maximal (lowest) priority for preemption
kern.coredump=0 #disable coredump
kern.msgbuf_show_timestamp=1 #show timestamp in messagebuf
kern.shutdown.poweroff_delay=2000 #5000 : Delay before poweroff to write disk caches (msec)
kern.shutdown.kproc_shutdown_wait=20 #60 : Max wait time (sec) to stop for each process
kern.vt.enable_bell=0 #disable bell
hw.syscons.bell=0 #disable bell
hw.syscons.kbd_reboot=0 #disable keyboard reboot
hw.usb.no_shutdown_wait=1 #No USB device waiting at system shutdown
kern.metadelay=2 # 28
kern.dirdelay=3 # 29
kern.filedelay=5 # 30
kern.cam.scsi_delay=2000 # 5000

security.bsd.see_other_uids=0 #Unprivileged processes may not see subjects/objects with different real uid
security.bsd.see_other_gids=0 #Unprivileged processes may not see subjects/objects with different real gid
security.bsd.see_jail_proc=0 #Unprivileged processes may not see subjects/objects with different jail ids

security.bsd.unprivileged_read_msgbuf=0 #Unprivileged processes may not read the kernel message buffer
security.bsd.unprivileged_proc_debug=0 #Unprivileged processes may use process debugging facilities

security.bsd.hardlink_check_gid=1 #Unprivileged processes cannot create hard links to files owned by other groups
security.bsd.hardlink_check_uid=1 #Unprivileged processes cannot create hard links to files owned by other users
security.jail.sysvipc_allowed=1 #Processes in jail can use System V IPC primitives (deprecated)

kern.ipc.shmmax=1000000000 #536870912 Maximum shared memory segment size
kern.ipc.shm_use_phys=1 #0 Enable locking of shared memory pages in core
kern.ipc.shmall=256000 #131072 Maximum number of pages available for shared memory

kern.maxvnodes=1000000 #213492 Target for maximum number of vnodes
kern.maxfiles=1000000 #259494 Maximum number of files
kern.maxfilesperproc=500000 #Maximum files allowed open per process
kern.maxprocperuid=500000 #12157
vfs.usermount=1 #Unprivileged users may mount and unmount file systems

net.local.stream.recvspace=65536
net.local.stream.sendspace=65536

net.inet6.ip6.use_tempaddr=1
net.inet6.ip6.prefer_tempaddr=1
net.inet6.ip6.temppltime=7200 # Maximum preferred lifetime for temporary addresses
net.inet6.ip6.tempvltime=14400 # Maximum valid lifetime for temporary addresses

net.inet6.icmp6.rediraccept=0
net.inet6.ip6.redirect=0

net.inet.sctp.blackhole=2
net.inet.udp.blackhole=1
net.inet.tcp.blackhole=2

net.inet.icmp.drop_redirect=1

net.inet.tcp.always_keepalive=0
net.inet.tcp.drop_synfin=1
net.inet.tcp.icmp_may_rst=1
net.inet.tcp.nolocaltimewait=1
net.inet.tcp.path_mtu_discovery=1
net.inet.tcp.icmp_may_rst=0

net.inet.ip.maxfragpackets=0
net.inet.ip.maxfragsperpacket=0
net.inet.ip.check_interface=1
net.inet.ip.process_options=0
net.inet.ip.random_id=1
net.inet.ip.redirect=0
net.inet.tcp.cc.algorithm=cubic
net.inet.tcp.icmp_may_rst=0

#net.inet6.ip6.use_deprecated=0 # Allow the use of addresses whose preferred lifetimes have expired
#net.inet6.ip6.accept_rtadv=1 # Default value of per-interface flag for accepting ICMPv6 RA messages

hw.snd.default_auto=0
hw.snd.default_unit=1
hw.snd.maxautovchans=16

dev.pcm.1.play.vchans=6
dev.pcm.1.rec.vchans=2

#attinutation, to prevent clipping
hw.snd.vpc_0db=1
hw.snd.vpc_mixer_bypass=1
hw.snd.latency=5
hw.snd.feeder_rate_quality=4

security.jail.allow_raw_sockets=1
 
Tuning is overrated. My personal settings are limited to the vfs.zfs.arc_max="2G" line in /boot/loader.conf and vm.disable_swapspace_pageouts=1 in /etc/sysctl.conf. The latter setting is only necessary because I don't have a swap partition/file.
 
In /boot/loader.conf i have :

autoboot_delay="0"
kernels="kernel kernel.old"
kern.vty=vt

security.bsd.allow_destructive_dtrace=0
kern.geom.label.disk_ident.enable=0
kern.geom.label.gptid.enable=0
kern.geom.label.ufsid.enable=0
kern.ipc.shmseg=10000 #128
kern.ipc.shmmni=10000 #192
kern.cam.boot_delay=10000

kern.vt.color.0.rgb="#210021"
kern.vt.color.7.rgb="#ffff10"
kern.vt.color.15.rgb="#10ffff"
hw.syscons.disable=1

cc_cubic_load="YES"
kern.randompid=1
kern.random.fortuna.minpoolsize=512
 
Any recommendations from folks using FreeBSD as a desktop?

I'm running FreeBSD practically out of the box and followed the Handbook and Cooltrainer for setup. Because I only do text editing, email and browsing my system demand is rather low, so I don't have any need (and knowledge) to tweak around that much.

In my /boot/loader.conf and /etc/rc.conf there are just a few lines to use the sc console with [ports]x11-drivers/xf86-video-nv[/ports] because the proprietary Nvidia driver didn't install well, and this just works fine for my purposes. Other additions that I made to the config are for printing, time sync and autofs.
 
I remember SirDice mentioning to a user that out of the box, FreeBSD is tuned pretty well, but I can't remember for what use case.
FreeBSD typically does a good job tuning itself (this is what's meant by "autotune"). Most of the time any way.

Rule of thumb, don't tune for the sake of tuning. Tune when you're running into a limitation.
 
Back
Top