Skip to main content

pyspark-flame

A low-overhead profiler for Spark on Python

Pyspark-flame hooks into Pyspark's existing profiling capabilities to provide a low-overhead stack-sampling profiler, that outputs performance data in a format compatible with Brendan Gregg's FlameGraph Visualizer.

Because pyspark-flame hooks into Pyspark's profiling capabilities, it can profile the entire execution of an RDD, across the whole of the cluster, and provides RDD-level visibility of performance.

Unlike the cProfile-based profiler included with Pyspark, pyspark-flame uses stack sampling. It takes stack traces at regular (configurable) intervals, which allows its overhead to be low and tunable, and doesn't skew results, making it suitable for use in performance test environments at high volumes.

Installation

pip install pyspark-flame

Usage

from pyspark_flame import FlameProfiler
from pyspark import SparkConf, SparkContext

conf = SparkConf().set("spark.python.profile", "true")
conf = conf.set("spark.python.profile.dump", ".")  # Optional - if not, dumps to stdout at exit
sc = SparkContext(
    'local', 'test', conf=conf, profiler_cls=FlameProfiler,
    environment={'pyspark_flame.interval': 0.25}  # Optional - default is 0.2 seconds
)
# Do stuff with Spark context...
sc.show_profiles()
# Or maybe
sc.dump_profiles('.')

For convenience, flamegraph.pl is vendored in, so you can produce a flame graph with:

flamegraph.pl rdd-1.flame > rdd-1.svg

Release files for pyspark-flame 0.2.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyspark-flame 0.2.9
File Size Uploaded
pyspark-flame-0.2.9.tar.gz 17.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyspark-flame 0.2.9
File Interpreter ABI Platform
pyspark_flame-0.2.9-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 32.3 kB

Release files / pyspark-flame-0.2.9.tar.gz

Download URL pyspark-flame-0.2.9.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b9b0ccb3e6a56bd433e6330f26ba60746b49e4505c1d934b9ec73a1f7c5f1c4a
BLAKE2b-256 checksum
How to use checksums
fe8d76e1d93a4c06e48a825e49557341b3e7d66844662be47a60e8c6bf289325
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release files / pyspark_flame-0.2.9-py2.py3-none-any.whl

Download URL pyspark_flame-0.2.9-py2.py3-none-any.whl
Size 15.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
69eb2ec93742d972fb96846cc7d69b5228c2f6c23464b7440f80137da34fcd2d
BLAKE2b-256 checksum
How to use checksums
5f9f45a7d2a4838b8c06595f7e7273317ee16aaefdfc58a26484ee8037b919ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release history Release notifications | RSS feed

This release

0.2.9 This release

2 release files

0.2.7

2 release files

0.2.6

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.0

1 release file

0.1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page