Tachyon: 97% error rate

Hello,

I am testing the new sampling profiler Tachyon. For my workload, I am consistently seeing error-rates exceeeding 97%, producing poor quality results. Is this due to me using Tachyon incorrectly, or is something about my particular workload throwing it off?

I am using python 3.15.0 beta 2, built with pyenv:

PYTHON_CONFIGURE_OPTS=‘–enable-optimizations --with-lto’ PYTHON_CFLAGS=‘-march=native -mtune=native -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer’ ~/.pyenv/bin/pyenv install -v 3.15.0b2

The target is a pure-python webserver:

git clone https://github.com/9001/copyparty/; cd copyparty; ~/.pyenv/versions/3.15.0b2/bin/python -m profiling.sampling run --heatmap -o a.html -d 10 -r 1khz --blocking -a -m copyparty -q --no-htp --hash-mt=0 --mtag-mt=1 --th-mt=1 -v srv::ra

Load is generated by sending http-requests from another terminal:

while true; do curl -s 127.1:3923/?ls{,,,,,,,,,,,,,,,,,,,,,,,,,,,,}{,,,,,,,,,,,,,,,,,,,,,,,,,,,,} >/dev/null; done

I have tried with/without `–blocking`, and various sampling-rates (1k through 20k), all with no difference. The arguments given to the profiling target (`–no-htp --hash-mt=0 --mtag-mt=1 --th-mt=1`) are to reduce the number of threads, but there is still 8 threads at idle, listed at http://127.0.0.1:3923/?stack .

With --realtime-stats I get:

Stats: 1,000.2Hz (999.8µs) Min: 930.8Hz Max: 1,082.5Hz N=9003 Cache: 98.7% (2135+82/30)
Captured 10,001 samples in 10.00 seconds
Sample rate: 1,000.09 samples/sec
Error rate: 97.52
Unwinder Statistics:
  Frame Cache:
    Total samples:    10,001
    Full hits:        2,309 (94.8%)
    Partial hits:     95 (3.9%)
    Misses:           32 (1.3%)
  Frame Reads:
    From cache:       9,924 (74.6%)
    From memory:      3,375 (25.4%)
  Code Object Cache:
    Hits:             16,236 (59.9%)
    Misses:           10,851 (40.1%)
  Batched Reads:
    Attempts:         12,187
    Successes:        12,167 (99.8%)
    Misses:           20 (0.2%)
    Segments read:    34,171/34,191 (99.9%)
  Memory:
    Read operations:  51,643 (13.6 MB)

if I attach to a running process rather than run it directly under tachyon, the error rate drops to 80%, however the output is still confusing; I know that almost all of the cpu-time is spent in httpcli.run, yet that does not get a single hit.

That aside, I really like everything else about Tachyon so far! The UI looks awesome, and I’m certain it’ll be a fantastic way to see where the cycles are going, as soon as I can get it to sing :slight_smile:

Alexander,

What a nice issue! No, it’s completely not your fault. I’ve created a Github issue detailing what happened:

Please drop by there, if you want :slight_smile:

Thank you again for creating such a detailed report. It was delightful to reproduce.

Have a great Saturday!

Alexander,

I hope that everything is going well!

Pablo has just merged a great fix by Goutam Adwant: gh-151022: Fix remote debugging linetable reads by goutamadwant · Pull Request #151036 · python/cpython · GitHub

Do you want to give it a try?

I tried to reproduce it again, and the error rate on my machine went to around 0,1%.

Thank you once again for a great bug report.

Have a great Monday :slight_smile:

Hello again :>

Good news; tried 3.15.0-rc1 just now, and can confirm it’s looking great now – the numbers look realistic, and already spotted a tiny optimization too :grin:

Just some quick observations, probably nothing important:

I compared blocking vs. non-blocking; they largely agree, but I noticed some functions had notably more hits in one mode compared to the other. Likely to be expected due to sampling bias, but some examples (number of samples) just in case:

function block nonblk
util.py: def _quotep3b 6339 1324
util.py: def absreal 4653 8779
util.py: def humansize 484 1119

As for error rates and missed samples,
With blocking: 0.1% error and 24.4% missed
Nonblocking: 10.7% error and 0.0% missed