Repository navigation
Description
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 separate3.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()staysFalse): 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.15twheel (--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.mdand the template'sPythonVersion(3\.12\.[0-9]+) pin it, and every trial imports all DataFrame backends, including Polars and awswrangler, before its baseline.
Plan
- Add a benchmark environment for
3.15tand 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. - On one
c8gn.2xlargeSpot host, run the objects suite and the single-objectread,get,write, andputcases with the sync, aio, and s3fs APIs under3.15and3.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 andget_file()are concurrent. - 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
Pin a uv release that knows Python 3.15.2 (GH-1324)
Merge pull request #1409 from pyathena-dev/feat/1324-free-threaded-be…
laughingman7743 commentedon Nov 16, 2026
Plan items 2 and 3 ran in the re-measurement of #1332, at
1d9e5039on onec8gn.2xlargeSpot host, with thefs315andfs315tenvironments 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:
cat,get,put,pipe,copy)catinfo()With 40 workers, one 1 GiB object:
Little or no change at low concurrency.
s3fs. s3fs, which runs its requests on one event loop thread, did not gain:
rm(0.99) at concurrency 40;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.