Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-7935

Create write lock levels & Introduce readPreferenceMode = avoidWriteLock

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.2.2
    • Replication
    • None

    Description

      Motivation

      In replica-set environments with high bulk inserts, where stale reads are acceptable and read performance is critical, it would be very useful to attempt to find a replica set member that is not holding or pending a write lock. Read performance is expected to improve.

      Please note that the below proposal is only an attempt at explaining one (of many) possible implementations of this feature.

      Prerequisite

      In order to facilitate the algorithm that is proposed below, a write lock level or similar construct is required to be introduced. In addition, each replica set member needs to be able to instantly respond on the current write lock level and with whether or not it is a write lock is pending. The write lock level may be determined by the duration of similar previous write operations, or through other heuristics.

      Read Preference Algorithm

      Scenario

      A client driver receives a read request where the readPreferenceMode has been specified as avoidWriteLock where n is the minimum write lock level to avoid.

      Algorithm (pseudo-code)

      Server getReadServerAvoidingWriteLock(int writeLockLevel)
      {
          foreach(Server m in ReplicaSetMembers)
          {
              if (!m.isHoldingOrPendingWriteLock(writeLockLevel))
              {
                  return m;
              }
          }
          return getReadServerSecondaryPreferred();
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            zaidmasud Zaid Masud
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: