Skip to content

perf: enable OPcache and Hyperloop B - #11

Open
anurag6569201 wants to merge 1 commit into
qa/agent-appwrite-appwrite/pr-11-13487/basefrom
qa/agent-appwrite-appwrite/pr-11-13487/head
Open

anurag6569201 wants to merge 1 commit into
qa/agent-appwrite-appwrite/pr-11-13487/basefrom
qa/agent-appwrite-appwrite/pr-11-13487/head

Conversation

@anurag6569201

Copy link
Copy Markdown

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

  • All 42 CI jobs passed on 48ecaccecd533424f194dc925df0e32a1388f530: image build, static checks, security scanning, unit tests, E2E suites and benchmark.
  • The existing parallel large-file upload E2E test was observed failing before the corrections (first a spurious 500, then a truncated download); it now passes its response, downloaded size and SHA-256 checks.
  • E2E suites pass with Swoole pools across HTTP, Realtime, workers and CLI tasks, including migrations and scheduled functions.
  • Runtime container checks confirmed CLI OPcache and tracing JIT are active, production timestamp validation is disabled, and development enables immediate timestamp revalidation.
  • Latest CI benchmark versus main: 235.45 requests/sec (+0.4%) and 166.09 ms P95 latency (-0.6%).
  • Greptile reviewed this commit with confidence 5/5 and no actionable findings.

Related PRs and Issues

Matches the configuration in Appwrite Cloud.

Checklist

  • Read the contributing guidelines.
  • No API metadata or SDK specification changes.

Source merge-base: c310a67837bc03727a7cb4c6c3664b6e16b11501
Source head: 48ecaccecd533424f194dc925df0e32a1388f530

@shipwright-agent

Copy link
Copy Markdown

⛔ Shipwright · Blocked

Recommendation: do not merge PR #11 · Tier T3
Checks: 0 total · 0 needing attention

Next step: resolve the blocking findings before merge.

Findings (2)

  • CRITICAL The new guard 'if (empty($chunksUploaded))' is placed before '$chunksUploaded' is assigned in the chunked-upload path. · src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php:358
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • CRITICAL The new guard 'if (empty($chunksUploaded))' is placed before '$chunksUploaded' is assigned in the chunked-upload path. · src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php:358
    • Fix: Fix the review finding before release.

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 /shipwright rerun to verify again.

}

$chunksUploaded = max($uploaded, $chunksUploaded, (int) ($metadata['chunks'] ?? 0));
// Another chunk may have finalized the upload and removed its parts

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant