perf: enable OPcache and Hyperloop B - #11
anurag6569201 wants to merge 1 commit into
Conversation
Source PR: appwrite#13487 Source head: 48ecacc
⛔ Shipwright · BlockedRecommendation: do not merge PR #11 · Tier
Findings (2)
Fireworks usage: 12,337 input · 389 output · 12,726 total tokens · $0.0030 · 8s · 0 fix iteration(s) Open the Shipwright check for full evidence and the audit bundle. Use |
| } | ||
|
|
||
| $chunksUploaded = max($uploaded, $chunksUploaded, (int) ($metadata['chunks'] ?? 0)); | ||
| // Another chunk may have finalized the upload and removed its parts |
There was a problem hiding this comment.
Shipwright · CRITICAL
The new guard 'if (empty($chunksUploaded))' is placed before '$chunksUploaded' is assigned in the chunked-upload path.
Impact: The new guard 'if (empty($chunksUploaded))' is placed before '$chunksUploaded' is assigned in the chunked-upload path. In the original code, '$chunksUploaded' was initialized from 'max($uploaded, $chunksUploaded, (int) ($metadata['chunks'] ?? 0))' before any check. The diff removes that initialization and instead checks 'empty($chunksUploaded)' first, so on the first chunk '$chunksUploaded' is still null/0 and the r…
Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
| } | ||
|
|
||
| $chunksUploaded = max($uploaded, $chunksUploaded, (int) ($metadata['chunks'] ?? 0)); | ||
| // Another chunk may have finalized the upload and removed its parts |
There was a problem hiding this comment.
Shipwright · CRITICAL
The new guard 'if (empty($chunksUploaded))' is placed before '$chunksUploaded' is assigned in the chunked-upload path.
Impact: The new guard 'if (empty($chunksUploaded))' is placed before '$chunksUploaded' is assigned in the chunked-upload path. In the original code, '$chunksUploaded' was initialized from 'max($uploaded, $chunksUploaded, (int) ($metadata['chunks'] ?? 0))' before any check. The diff removes that initialization and instead checks 'empty($chunksUploaded)' first, so on the first chunk '$chunksUploaded' is still null/0 and the r…
Suggested fix: Fix the review finding before release.
What does this PR do?
Enable Cloud's PHP OPcache configuration in the Appwrite image, including CLI caching, a 384 MiB cache and tracing JIT with a 128 MiB buffer. Production images disable timestamp validation. Development images enable timestamp validation with no revalidation delay so worker reloads pick up bind-mounted source changes.
Apply the HTTP adapter's Hyperloop B preset for coroutine hooks, FD-bound dispatch, send yielding and runtime tuning. Preserve Appwrite's configured worker count and 12 MiB payload/output limits. Select coroutine-aware Swoole connection pools in the HTTP entrypoint, through a fresh registry adapter per pool, including installations that still configure the legacy stack adapter; the stack adapter cannot wait when concurrent requests exhaust a pool.
Parallel chunk uploads finalize only after the merged metadata records every completed chunk write; files still being written must not count toward completion. They also check the completed file document under the existing lock before rejecting an empty chunk count. A concurrent finalizer can remove chunk files before another request counts them, which otherwise returns a spurious 500.
Test Plan
48ecaccecd533424f194dc925df0e32a1388f530: image build, static checks, security scanning, unit tests, E2E suites and benchmark.Related PRs and Issues
Matches the configuration in Appwrite Cloud.
Checklist
Source merge-base:
c310a67837bc03727a7cb4c6c3664b6e16b11501Source head:
48ecaccecd533424f194dc925df0e32a1388f530