Skip to content

Measure the S3 filesystems on free-threaded Python 3.15t #1324

Closed

Description

@laughingman7743

Related to #1315, #1322, and #1323.

Summary

Measure S3FileSystem, AioS3FileSystem, and s3fs on the free-threaded build of Python 3.15 (3.15t) against the default build, to learn whether removing the GIL changes the comparison of #1318.

Background

PyAthena's filesystems run one blocking boto3 request per thread: the synchronous filesystem's executor and AioS3FileSystem's thread pools (52 to 54 threads at 40 workers in #1318). s3fs runs every request as a coroutine on fsspec's single IO thread (13 threads in every case of #1318).

With the GIL, socket I/O, TLS, zlib.crc32, and hashing of large buffers already run in parallel: PyAthena's 1 GiB read took 5.9 seconds of CPU time in 1.7 seconds. The Python-level work of each request does not: botocore's request building and signing, response parsing, urllib3's read loop, and joining parts. A free-threaded interpreter can run that work in parallel across PyAthena's threads, while s3fs keeps it on one thread. The difference should matter most where requests are small and many, as in the objects suite and #1322, and it has to be measured, since the free-threaded build also has its own single-thread overhead.

Findings so far

  • The default build of Python 3.15.0 keeps the GIL (Py_GIL_DISABLED=0); the free-threaded build is the separate 3.15t (uv: cpython-3.15.0+freethreaded).
  • On macOS arm64 with 3.15t, these install from wheels and import without re-enabling the GIL (sys._is_gil_enabled() stays False): boto3 1.43.118 with botocore and urllib3, fsspec, tenacity, psutil 7.2.2, numpy 2.5.4, pyarrow 26.0.0, pandas 3.1.0, and s3fs 2026.9.0 with aiohttp 3.14.5 (multidict, yarl, frozenlist, propcache).
  • Polars has no 3.15t wheel (--only-binary :all: finds no solution). awswrangler, the locked pyarrow 25.0.1, and Linux aarch64 wheels for the benchmark hosts were not checked.
  • The benchmark runs on Python 3.12: benchmarks/README.md and the template's PythonVersion (3\.12\.[0-9]+) pin it, and every trial imports all DataFrame backends, including Polars and awswrangler, before its baseline.

Plan

  1. Add a benchmark environment for 3.15t and its default-build counterpart that runs only the filesystem and objects suites, without importing the DataFrame backends that lack free-threaded wheels, and let the template install it.
  2. On one c8gn.2xlarge Spot host, run the objects suite and the single-object read, get, write, and put cases with the sync, aio, and s3fs APIs under 3.15 and 3.15t, preferably after Run the batch operations of S3FileSystem concurrently #1322 and Download in parallel ranges in get_file() #1323, so that the synchronous batch operations and get_file() are concurrent.
  3. Record a history entry with throughput, CPU time, and thread counts per interpreter, and whether any import re-enabled the GIL on the host.

Out of scope: supporting or testing PyAthena itself on free-threaded builds in CI.

Activity

  1. added 2 commits that reference this issue on Nov 13, 2026
  2. laughingman7743 commented on Nov 16, 2026

    @laughingman7743
    MemberAuthor

    Plan items 2 and 3 ran in the re-measurement of #1332, at 1d9e5039 on one c8gn.2xlarge Spot host, with the fs315 and fs315t environments of #1409; the history entry is in #1420.

    • GIL. Every 3.15t trial recorded the GIL as disabled after its measurement, and every other trial recorded it as enabled.

    • Speed-ups at high concurrency. At concurrency 40, both PyAthena APIs ran faster on 3.15t than on 3.15:

      Operation 3.15t / 3.15 Highest throughput on 3.15t
      transfers of the medium set (cat, get, put, pipe, copy) 1.16 to 2.70
      cat 1.91 to 2.12 930 objects/s
      downloads 2.57 to 2.70 680 objects/s
      info() 2.22 to 2.24

      With 40 workers, one 1 GiB object:

      Operation 3.15t / 3.15 Highest throughput on 3.15t
      read 1.96 to 2.20 1,217 MiB/s
      download 1.46 to 1.98 1,048 MiB/s
      write and put 1.37 to 1.47 1,212 MiB/s
    • Little or no change at low concurrency.

      • At concurrency 8, PyAthena on 3.15t ran within 0.94 to 1.09 times of 3.15.
      • With 8 workers, it ran within 0.96 to 1.26 times, except three 64 MiB cases of the aio API, at 0.54 to 0.81.
    • s3fs. s3fs, which runs its requests on one event loop thread, did not gain:

      • 0.81 to 0.94 times its throughput on 3.15 in every operation but rm (0.99) at concurrency 40;
      • 0.91 to 1.01 times at concurrency 8.
    • CPU time. 3.15t took 0.89 to 1.52 times the CPU time of 3.15 for the PyAthena transfers, and 1.12 to 1.22 times for s3fs's.

    • 3.15 against 3.12. Python 3.15 with the GIL ran the medium set's transfers within 0.92 to 1.09 times of Python 3.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions