DEV Community

Discussion on: Running non-blocking code in PHP with Amp

Collapse
 
askadar profile image
Антон Обрядин

Hey, somewhat old post, but still wanna question - why didn't you go further, e.g. serializing connection details, and having processing function connect to db? It would consume some of db pool, but 4 threads-etc still better than 1.

Collapse
 
shalvah profile image
Shalvah

Interesting suggestion. I'm not sure how much time it would have saved in this case though, because it turns out the bottleneck was waiting for a (failing) database connection. The complexity of trying to serialise and instantiate a be connection isn't worth it at this point.

I still have Amp at the back of my mind, though. There may be other places where it might help me improve speed.