php / php/frankenphp

Access control / semaphores

Open
#2,386 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
11.3k
Forks
488
Avg merge
4d 10h
Merged PRs (30d)
11

Description

Describe your feature request

While thinking some more about cases where servers get stuck on external resources like #1796, I realized that you don't necessarily need a connection pool to limit access, some kind of semaphore would be enough.

Not sure how this would look like exactly, maybe something like this:

frankenphp_guard (
  key: 'slow-api-request',
  block_count: 10, # block on more than 10 parallel requests
  reject_count: 20, # throw on more than 20
  callback: function(){
    # slow IO to external API
  }
);

Doing this with files/apcu is actually pretty hard, mainly due to fatal errors and resulting deadlocks.
It would be easy to do on the FrankenPHP since we have full control over all threads.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the external-resource scenario referenced in #1796 and the proposed frankenphp_guard entry point. The issue names no files or tests, so first clarify the API and semaphore behavior, including blocking and rejection thresholds. Done means the design and implementation scope are agreed for FrankenPHP's server threads.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, php
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.