Skip to content

Access control / semaphores #2386

@AlliBalliBaba

Description

@AlliBalliBaba

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions