Allow dynamic classes in is_valid_class

This adds support for dynamic classes in IOQ2. Before this change, the
allowed set of classes was fixed and hardcoded, with no way for 3rd
party IO traffic to be prioritized, and similarly, no way for 3rd party
IO traffic to bypass IOQ based on config settings. This change switches
to checking to see if there's a declared IO priority value in the
classes config, and if so it is treated as a valid value. It's worth
noting that because `ioq_config:set_class_config` uses the
`is_valid_class` check, you must use `config:set` directly to declare an
initial priority for the dynamic channel before being able to use the
`ioq_config` helpers.

This change was motivated by not being able to bypass search in the
Dreyfus project, as it piggy-backed off of `interactive` and
`view_update` channels. That was rectified in [1], and now Dreyfus uses
the `search` IOQ channel. As that is not used in CouchDB directly, this
commit adds the dynamic class support based off of config values, rather
than specifically hardcoding search, so that it can be used by any 3rd
party services running IO traffic through IOQ.

2 files changed
tree: b49bb5670a5cbf47f6d668c1a26aff1e82281fee
  1. .gitignore
  4. include/
  6. priv/
  7. rebar.config.script
  8. src/
  9. test/

IOQ classes

The following are the list of IOQ classes:

  • interactive
  • db_update
  • view_update
  • db_compact
  • view_compact
  • internal_repl
  • low

Bypassing IOQ

One can configure an ioq bypass, which removes an IO class from prioritization, as below:

config:set("ioq.bypass", "view_update", "true")

Note that setting an IOQ bypass can effectively trump all other classes, especially in the case of an interactive bypass v. compaction. This can lead to high disk usage.

Setting priorities

The priority for a class can also be set ala:

config:set("ioq", "compaction", "0.3")

Or globally, using snippet/rpc:

s:set_config("ioq", "compaction", "0.314", global)
rpc:multicall(config, set, ["ioq", "compaction", "0.217"])

As the interactive class is ‘everything else’ its priority cannot be directly set.