# Geom Scheduler - where better to use?



## nickolas (Feb 4, 2011)

Hello All!

I have some questions about geom scheduler.

1. gsched(8) says that there are two algorithms (_rr_ and _as_) and two kernel modules to implement them (gsched_rr and gsched_as). My system has only gsched_rr module and no gsched_as. Does it mean that _as_ algorithm is not implemented/unsupported?

2. Is there any benchmark results, comparison graphs while using _rr_ or _as_ scheduling algorithms and without geom_sched?

3. Are there any recommendations when better use _rr_ or _as_ IO-scheduling algorithms and when do not use geom scheduler at all? For example, which algorithm is better for web sever, DB (SQL) server, svn server, mail server, build server?


```
# uname -a
FreeBSD cloud 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #33 r218069: Sat Jan 29 19:47:39 EET 2011     root@cloud:/usr/obj/usr/src/sys/CLOUD  amd64
```


----------



## phoenix (Feb 4, 2011)

The "as" algorithm was removed from geom_sched a while ago.  The man page hasn't been updated to reflect that.

I remember reading about its removal when it was imported into the tree, but now I can't find the e-mail with the details.


----------



## nickolas (Feb 4, 2011)

phoenix said:
			
		

> The "as" algorithm was removed from geom_sched a while ago.  The man page hasn't been updated to reflect that.
> 
> I remember reading about its removal when it was imported into the tree, but now I can't find the e-mail with the details.



Than you, phoenix. Do you know if there plans to add more IO-scheduling algorithms?


----------



## Galactic_Dominator (Feb 4, 2011)

nickolas said:
			
		

> Do you know if there plans to add more IO-scheduling algorithms?



I doubt it, gsched was created as an intellectual exercise and the rr algo was meant as good general use default.  It falls on the community to contribute more to it's growth.  Since it's not a widely used option and the rr algo fulfills the general need it's not a high priority for many.  If you have a more specific need and can't write the extension yourself, you can contacting the original author inquiring what it would take to get the changes you want.  Or you can make a nice donation to the FreeBSD foundation and indicate you'd like to more algos put in.  Even try the geom@ list with a bounty, there may be some takers.


----------



## nORKy (Feb 5, 2011)

Hi,

Can someone explain what is a geom scheduler? When to use it? Is there a relation with the file system?

Thanks you


----------



## chrcol (Feb 9, 2011)

I only discovered its in FreeBSD 2 hours ago and now this thread popped up.

it appears to handle at the device level so I assume the filesystem has no bearing which raises the question does it conflict with things like zfs queuing and is it considered stable in FreeBSD 8?

Given it improves multithreaded i/o and random access (according to docs) I would assume it would be of benefit to web servers.

I would like to see the BFQ or CFQ scheduler in FreeBSD as well and given this is off by default with barely any mention in docs I am not surprised it has low usage levels.


----------



## nickolas (Feb 9, 2011)

Well, I've discovered some information, so wanna share it with community (hope it will be useful)

Looks like gsched_rr is combined analogue of linux CFQ/BFQ io-schedulers. 
It useful on systems with many concurrent disk io-operations.

See /sys/geom/sched/README for more information.


If you wanna start use geom scheduler on system startup, you may use this rc-script (/etc/rc.d/gsched):

```
#!/bin/sh

# PROVIDE: disks
# KEYWORD: nojail

. /etc/rc.subr

name="gsched"
start_cmd=gsched_start
stop_cmd=":"

gsched_start()
{
        for device in ${gsched_devices} ; do
                gsched insert -a ${gsched_policy} /dev/${device}
        done
}

load_rc_config $name
run_rc_command "$1"
```

So, you should put lines 

```
gsched_devices="ada0 ada1"
gsched_policy="rr"
```
into your /etc/rc.conf

As for me it's better to put line 
	
	



```
gsched_policy="rr"
```
 into /etc/defaults/rc.conf file.


Whom I should wrote to commit this script into base system?


----------



## DutchDaemon (Feb 9, 2011)

nickolas said:
			
		

> [...] into /etc/defaults/rc.conf file.



This file is not supposed to be edited, as it a) contains defaults (who would have guessed?) b) can be replaced when upgrading the system.

Only use /etc/rc.conf, which overrides and/or adds to the defaults in /etc/defaults/rc.conf.


----------

