mirror of
https://github.com/mihawk-99/PS5_RetroArch.git
synced 2026-10-18 23:09:29 -05:00
Measured first: one libmicrohttpd thread with 64 KiB a connection held uploads to
13 MB/s, and four connections to 15.3, on a link where FTP reached 25 / 30.5 MB/s.
PS5-Suite's design was reviewed (persistent connection pool, small files per
connection, large files as pwrite ranges, big socket buffers) and an engine built
from scratch on the WebUI's HTTP (src/webui_transfer.{h,cpp}, docs/WEBUI.md):
- a pool of four server threads, 512 KiB a connection, 4 MiB socket buffers, writes
in 1 MiB blocks; non-transfer routes under one lock as on the single thread;
- PUT /api/upload/batch: many small files in one request (a framed stream), each
renamed into place when whole, existing names skipped and named unless replace;
- upload sessions (/api/upload/session, /part, /commit): a large file's ranges in
any order on any number of connections, committed once covered;
- Range downloads (206); every upload still atomic, never over an existing name;
- the page plans batches, sessions and single uploads onto six lanes.
Evidence: evidence/webui-transfer-engine (base PS5 13.40, PC on Wi-Fi 6). Uploads
26.0 MB/s on one connection and 29.9 MB/s for one file in six parts (FTP: 25 /
30.5); 400 x 32 KiB at 215 files/s (FTP 105). The page against the console: 605
files in 20.1 s, all equal by FTP readback, duplicates refused, a cancelled 200 MiB
file left nothing. ThreadSanitizer under a mixed parallel load: no report.
Command: build/tmp/transfer/bench.py; node tests/webui_transfer_browser.cjs;
tools/verify.sh: all five PASS.
22 lines
1.5 KiB
Python
22 lines
1.5 KiB
Python
"""Isolated native HTTP fixture for webui_update_browser.cjs (port 6770).
|
|
Run after the host tests and a title build; no console access or owner data.
|
|
"""
|
|
from pathlib import Path
|
|
import shutil, subprocess, json
|
|
import tempfile, os
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
os.chdir(ROOT)
|
|
work = tempfile.TemporaryDirectory(prefix='retroarch-webui-fixture-')
|
|
r = Path(work.name)
|
|
for folder in ['webui','webui/core-metadata','cores','info','system','config','content/PSP','content/Arcade','content/Saturn','config/PPSSPP']:(r/folder).mkdir(parents=True,exist_ok=True)
|
|
shutil.copytree('webui',r/'webui',dirs_exist_ok=True);shutil.copytree('build/webui-core-metadata',r/'webui/core-metadata',dirs_exist_ok=True)
|
|
(r/'webui/version.json').write_text(json.dumps({'release':'v0.5.7-alpha.5','build':'browser-fixture'}))
|
|
(r/'config/retroarch.cfg').write_text('audio_volume = "0"\ninput_rumble_gain = "100"\n')
|
|
for file in Path('dist/PPSA99169/cores').glob('*.so'):(r/'cores'/file.name).touch()
|
|
shutil.copytree('dist/PPSA99169/info',r/'info',dirs_exist_ok=True)
|
|
subprocess.run(['c++','-std=c++17','-pthread','-I.deps/webui/libmicrohttpd-1.0.10/src/include','-I.deps/native/zlib/zlib-1.3.2/contrib/minizip','-Ivendor/retroarch/deps/mbedtls','tests/webui_server_main.cpp','src/webui_ps5.cpp','src/webui_transfer.cpp','src/webui_update.cpp','build/webui-mhd-host/src/microhttpd/.libs/libmicrohttpd.a','build/webui-update-host/libupdate.a','-lz','-o',str(r/'server')],check=True)
|
|
try:
|
|
subprocess.run([str(r/'server'),str(r),'6770'],check=True)
|
|
finally:
|
|
work.cleanup()
|