Is it possible to multiprocess/multithread in php from a http request.
Background
I am working on a project where I expect some data (not from a user so data upload is consistent) to be uploaded to an api.
I want to decouple the process such that if data upload is successful, I notify this client and disconnect it and process the data in another thread. Right now, the client waits for the data to be processed and on success is disconnected.
My research
I have looked into forking a process but it always came with a caveat of not using it over a web server and additionally I wanted a package/module that can scale with the project I am working on.
Pthreads: This is the php threading module. As noted above, it is not configured to work with a web server only on cli.
amphp: this is a module built with pthreads and it comes with the same caveat.
This prompts the question how best can one solve the problem? I understand the challenge, if you open a new thread for each connection you will have a 1000 threads for a 1000 connections and can easily overload the server if this increases but my case is unique in that I do not wish to multi thread for human connections and the number of connections can be easily anticipated.