Running vshard routers on application threads

Open Beginner friendly
#5,756 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Active
Tech stack
lua
Domain
documentation

Research direction

Start by finding the vshard router configuration documentation and the section for sharding.router_thread_group. Explain that the group must be defined in threads.groups, and document the application thread notes about IPROTO exports, lua_call privileges, and per-thread bootstrap behavior. Done when users can configure and operate routers on application threads using the documented guidance.

Written by the indexing model from the issue text.

Description

The new configuration option sharding.router_thread_group specifies
the name of the thread group where the vshard router module will be
loaded and configured. The group must be defined in threads.groups.
The default value is "tx" (run the router on the main thread).

Using an alternative thread group is the way to scale the vshard router
performance within the same process, without spawning extra Tarantool
instances.

Notes about using vshard in application threads:

  • Adding a function to the global Lua namespace _G in an application
    thread does not export the function in IPROTO. Instead you should use
    box.iproto.export(), which works both in the main and application
    threads.
  • To grant a user a permission to execute a function exported in an
    application thread over IPROTO, you should add the corresponding
    lua_call privilege to the config file. The execute access to
    the universe or the super role won't work.
  • Each application thread acts as an independent router although they
    all take requests from the same IPROTO port. In particular, this
    means that vshard.router.bootstrap should be called once or
    if_not_bootstrapped option should be used, just like with routers
    running on different Tarantool instances.
    Requested by @locker in https://github.com/tarantool/tarantool/commit/68fe9c1da2cf4f4a2d83ce7356faf30cd1c9d250.
Dominant language
CSS
Stars
16
Forks
49
Avg merge
5d 18h
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tarantool/doc

All issues in tarantool/doc

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.