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.

[1] https://github.com/cloudant-labs/dreyfus/pull/46/commits/75d86c49c86f4e7e299d2d05a741c4ef68a144fb
2 files changed
tree: b49bb5670a5cbf47f6d668c1a26aff1e82281fee
  1. include/
  2. priv/
  3. src/
  4. test/
  5. .gitignore
  6. IOQ2.md
  7. operator_guide.md
  8. README.md
  9. rebar.config.script
README.md

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.