Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-15528

JRaft creates at least 4 threads for every raft group on a leader

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • None
    • 3.0.0-alpha4
    • None

    Description

      When we create a raft group on a leader, jraft creates at least 4 threads for every raft group: one thread for electionTimer, voteTimer, stepDownTimer, andĀ snapshotTimer. To be more precise, every timer is an instance of HashedWheelTimer, which creates one thread:

      private final Worker worker = new Worker();  
      ...
      workerThread = threadFactory.newThread(worker);
      

      This fact leads to restrictions on the number of partitions that might be created, as far as every partition is associated with a raft group. For example, one table with 1024 partitions leads to at least 4096 threads on a single node.

      Changing HashedWheelTimer to DefaultTimer with shared pool won't make any sense, as far as the workload of the shared executor likely will lead to instability of cluster because threads are timer threads (election timer, for example).

      A possible solution is to implement batched handling of raft groups requests, like appendEntriesRequest. In this approach, timers could be shared by raft groups. There is an issue in original JRaft repo with some close ideasĀ https://github.com/sofastack/sofa-jraft/issues/672

      Attachments

        Issue Links

          Activity

            People

              ascherbakov Alexey Scherbakov
              maliev Mirza Aliev
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h