Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-177542

Chunk loading and saving is extremely slow when sync-chunk-writes=true

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.16 Pre-release 3
    • 20w14a, 20w15a, 20w16a, 20w17a, 20w18a, 20w19a, 20w20a, 20w21a, 20w22a, 1.16 Pre-release 1, 1.16 Pre-release 2
    • None
    • OS: Kubuntu 18.04 64-bit
      Linux 4.15.0-46-generic
      Java: OpenJDK 1.8.0_242 64-bit
    • Plausible
    • Performance
    • Important

      The sync-chunk-writes server option added in 20w14a, when enabled, causes massive server lag when loading and saving chunks; both in singleplayer and multiplayer. This is most easily noticed when generating new terrain and traveling through portals, and is so severe that merely flying with elytra through new chunks easily brings the server to a halt, leaving the player suspended over a void while the chunks are being generated. Saving chunks also takes much longer (~10-20 times slower) and causes lengthy loading screens when e.g. changing dimensions or returning to the main menu.

      Choice of storage medium has an effect; worlds stored in faster media, such as SSDs, experience less severe (but still very noticeable) effects than those in slower media, such as HDDs. Overall, opening region files in synchronous mode seems to limit the game speed more directly to the (slower) underlying disk speed.

      This option is enabled by default and cannot be changed in singleplayer, rendering the game nearly unplayable when traveling long distances. Disabling it in a dedicated server by setting sync-chunk-writes to false in server.properties resolves the issue.

      I've attached a video demonstrating the issue in singleplayer, a corresponding server log excerpt (notice the "Can't keep up!" messages and the time gap between "Saving chunks for level" and "All chunks are saved"), and a crash report from holding F3+C while flying over the unloaded chunks.

      I have only tested this on Linux (Ubuntu), need confirmation on other OSes.

      Update: I've attempted to reproduce this on Windows (64-bit, Java 1.8.0_51), but it does not seem to occur. Saving does still take slightly longer, but it's not much of an issue. This might have to do with driver differences between the two OSes. Other users have reported this issue to occur on Windows; the severity of this issue may be setup-dependent.

      Update 2: Attempted running 20w15a on Linux with Oracle Java (1.8.0_241 64-bit) instead of OpenJDK, issue persists.

        1. 2020-04-24_15.30.23.png
          853 kB
          phigraz
        2. 2020-04-24_15.32.13.png
          339 kB
          phigraz
        3. chunklag.mp4
          8.77 MB
          phigraz
        4. crash-2020-04-05_15.33.25-client.txt
          3 kB
          phigraz
        5. log.txt
          5 kB
          phigraz
        6. profile-results-2020-04-24_15.32.12.txt
          113 kB
          phigraz

            boq [Mojang] Bartosz Bok
            phigraz phigraz
            Votes:
            19 Vote for this issue
            Watchers:
            18 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: