Repository navigation
feat: per-deployment concurrency (30 req/account) - #142
Conversation
51cf343 to
c3cb171
Compare
|
Thanks for pushing on throughput — but I need to push back on the core premise here before this can merge. There's a footgun hiding in the "one deployment = one account" assumption. The issueApps Script's "30 simultaneous executions" limit is per owner account, not per deployment. From Google's Apps Script quotas table under Script runtime:
The "per user" there means the Google user account that owns the script project. If I'm signed in as Your code assumes: But for the majority setup (one user with multiple deployments under their single Google account), the actual behaviour is: What breaks in practiceCurrent code (post-#131): N deployments = N concurrent batches. For the common N=3 single-account case, that's 3 concurrent — well under Google's 30 cap, no errors. After this PR: N=3 → up to 90 concurrent potential. Google's cap fires somewhere past request 30 with Also in the diffFallback semaphore at let sem = sems
.get(&script_id)
.cloned()
.unwrap_or_else(|| Arc::new(Semaphore::new(CONCURRENCY_PER_DEPLOYMENT)));That README table: with the new math, 12 deployments = 360 concurrent. Even if 30×N were correct, 360 req / 2s round-trip = 180 req/s sustained. The 20k/day cap is hit in under 2 minutes at that rate. The 12-row number feels worth re-grounding against the realistic ceiling. Merge state: the PR is What would unblock thisOne of these reframings, any of them would work: Option A — Config-time account hint. Add Option B — Safer default. Drop Option C — Keep per-deployment 30 but add a global cap. Happy to merge any of these with a clear comment explaining the assumption. As-is, the math is sound only for the multi-account case and actively harmful for the single-account case, so I can't take it. Also: the claim that this matches "the Apps Script per-account execution limit" in the code comment and README should be corrected — it's the per-user/owner-account limit, and multiple deployments under one account share it. That framing matters because it's the premise the whole design rests on. Thanks again for the work — this is a real optimization for the setup you have in mind, and I want to land it in a shape that doesn't backfire for the single-account majority. [reply via Anthropic Claude | reviewed by @therealaleph] |
|
Double-checked the premise against official + community sources before landing on my review. Here's the evidence for the "shared per-account, not per-deployment" claim, verbatim from the sources: 1. Google's Apps Script quotas table — two separate caps exist:
The 30 is the one that bites here, and it's per user account, not per deployment. The per-script 1,000 would only matter if you had 1,000+ different client users invoking one web app — not our case, because 2. Google's web-app deployment docs — when
All invocations of any deployment of that script count against the owner's per-user 30-bucket. 3. Apps Script community consensus on the multi-deployment case:
So the actual math for the common setups:
Only the third case holds — which is a valid power-user setup, but it's not the modal user. And there's nothing in the current code that distinguishes these setups (deployment IDs are opaque — mhrv-rs doesn't know which deployments share an owner). Happy to merge this once it's reshaped so the default doesn't regress the single-account majority. The three options from my earlier comment still stand; Option A (explicit [reply via Anthropic Claude | reviewed by @therealaleph] |
…ipeline depth Apps Script enforces 30 concurrent executions per account. The old pipeline used a single global semaphore sized to the number of deployments, meaning 1 in-flight batch per deployment. Now each deployment ID gets its own semaphore with 30 permits — matching the actual per-account limit. With N deployments the system can sustain 30×N concurrent batch requests instead of N. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
c3cb171 to
d85f3aa
Compare
|
wow this turned out to be quite a mess but it seems that @therealaleph got it figured out this seems pretty logical. so basically if we want more speed we have to have more accounts not just deployments right? and every single account should get 30 executions |
|
Thanks for the fast turnaround. ✅ What I checked on the force-push:
Merging. Two small things to keep in mind for a follow-up (not blockers):
Neither needs to hold this PR. Thanks again. [reply via Anthropic Claude | reviewed by @therealaleph] |
Rolls up the four post-v1.2.14 commits on main into a single tagged release. Highlights: - Per-deployment concurrency (#142): each deployment ID gets its own 30-permit semaphore, so setups with deployments across multiple Google accounts get a genuine 30×N throughput ceiling. Single-account setups still cap at Google's per-account 30-simultaneous limit — docs (EN + FA) updated to call that out. - Android app-splitting ONLY-mode bug fix (#143): the previous code called both addAllowedApplication and addDisallowedApplication, which Android documents as mutually exclusive. ONLY mode was silently failing establish(). Now fixed. - Per-ABI Android APKs (#136): ships four split APKs (arm64-v8a ~21 MB, armeabi-v7a ~18 MB, x86_64 ~23 MB, x86 ~22 MB) alongside the ~53 MB universal. Huge distribution win for users on unreliable censorship-tunnel paths — the 21 MB arm64-v8a download succeeds where the universal doesn't. - Honest IP-exposure note in Security Posture (#148): clarified that v1.2.9's forwarded-header stripping only covers the client-side leg; what Google's own infrastructure may add on the UrlFetchApp.fetch() second leg is outside this client's control. Full Tunnel mode is the recommendation for threat models where that matters. - Telegram release-post format: added Persian preambles above both links (GitHub repo + full Persian guide; release page + desktop/ router builds) so channel readers see the intent at a glance. 82 tests pass. Desktop + Android builds both verified clean locally across the v1.2.15+ commit series. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
feat: per-deployment concurrency (30 req/account)
Rolls up the four post-v1.2.14 commits on main into a single tagged release. Highlights: - Per-deployment concurrency (#142): each deployment ID gets its own 30-permit semaphore, so setups with deployments across multiple Google accounts get a genuine 30×N throughput ceiling. Single-account setups still cap at Google's per-account 30-simultaneous limit — docs (EN + FA) updated to call that out. - Android app-splitting ONLY-mode bug fix (#143): the previous code called both addAllowedApplication and addDisallowedApplication, which Android documents as mutually exclusive. ONLY mode was silently failing establish(). Now fixed. - Per-ABI Android APKs (#136): ships four split APKs (arm64-v8a ~21 MB, armeabi-v7a ~18 MB, x86_64 ~23 MB, x86 ~22 MB) alongside the ~53 MB universal. Huge distribution win for users on unreliable censorship-tunnel paths — the 21 MB arm64-v8a download succeeds where the universal doesn't. - Honest IP-exposure note in Security Posture (#148): clarified that v1.2.9's forwarded-header stripping only covers the client-side leg; what Google's own infrastructure may add on the UrlFetchApp.fetch() second leg is outside this client's control. Full Tunnel mode is the recommendation for threat models where that matters. - Telegram release-post format: added Persian preambles above both links (GitHub repo + full Persian guide; release page + desktop/ router builds) so channel readers see the intent at a glance. 82 tests pass. Desktop + Android builds both verified clean locally across the v1.2.15+ commit series. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Changes
src/tunnel_client.rs: per-deploymentHashMap<String, Semaphore>instead of single global semaphore;fire_batchpicks a deployment, acquires its slot, then fires viatunnel_batch_request_tosrc/domain_fronter.rs: exposenext_script_id()andscript_id_list(); addtunnel_batch_request_to()that targets a specific deploymentREADME.md: updated pipeline docs for both EN and FA sectionsTest plan
cargo buildpassesmhrv-rs test) passes with single deployment🤖 Generated with Claude Code