hugozhu/async_php — explained in plain English
Analysis updated 2026-07-17 · repo last pushed 2012-04-25
Offload slow outbound API calls from PHP to an async Lua layer to serve more requests per second.
Benchmark how much throughput a site gains by moving blocking network calls out of PHP.
Reduce infrastructure costs for high-traffic sites that make many external API calls.
| hugozhu/async_php | bloodyhill/feather | f/pressmind | |
|---|---|---|---|
| Stars | 16 | 16 | 16 |
| Language | PHP | PHP | PHP |
| Last pushed | 2012-04-25 | — | — |
| Maintenance | Dormant | — | — |
| Setup difficulty | hard | easy | moderate |
| Complexity | 4/5 | 3/5 | 3/5 |
| Audience | developer | developer | writer |
Figures from each repo's GitHub metadata at analysis time.
Requires OpenResty, PHP-FPM, and the APC cache extension running together.
This project tests a way to speed up PHP web applications by offloading slow network calls to a different layer. The key insight is simple: when PHP makes a request to another server (like fetching data from an API), it has to sit and wait for that data to come back. During that wait time, the PHP process is blocked and can't handle other requests. This project measures how much faster you can serve users if you move those blocking calls elsewhere. The approach uses a web server called OpenResty, which includes a scripting layer called Lua that sits in front of PHP. Instead of having PHP make the slow network call directly, Lua makes the call asynchronously, meaning it doesn't block. The network request happens in the background while the web server continues handling other user requests. Once the data arrives, it gets combined with the PHP response and sent to the user. From the user's perspective, everything is faster because the server isn't wasting time sitting idle. The test results show real performance gains. When calling a backend server with 10 milliseconds of latency, the traditional PHP approach handles about 300 requests per second, while the Lua-based async approach handles 500, a 60% improvement. The difference is even more dramatic with higher latency backends: at 30ms latency, you go from 150 to 300 requests per second. This matters for anyone running a high-traffic website where every bit of efficiency counts, a faster application means serving more users with the same hardware, or spending less on servers. The tradeoff is architectural complexity. Instead of everything happening in one PHP process, you now have multiple layers (web server, Lua, PHP, and backend services) that need to coordinate. You also need OpenResty and PHP-FPM running together, plus the APC cache extension. For small sites this overhead might not be worth it, but for platforms handling thousands of concurrent users, particularly those making many external API calls, this pattern can significantly reduce infrastructure costs.
A benchmark showing how offloading slow network calls to OpenResty/Lua instead of blocking PHP can boost request throughput by 60% or more.
Mainly PHP. The stack also includes PHP, OpenResty, Lua.
Dormant — no commits in 2+ years (last push 2012-04-25).
Setup difficulty is rated hard, with roughly 1h+ to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.