PHP Execution times causing response delays [close

2020-05-07 02:47发布

I am intentionally running a php script that last up to 60 seconds on my server with a delay between each run. The issue is that any other requests sent to the server while the script is executing are delayed until the script finishes.

Is there anyway to 'thread'(?) php to allow apache to take requests that require php while the script is running?

1条回答
Evening l夕情丶
2楼-- · 2020-05-07 03:20

Apache and PHP will by default serve many concurrent connections just fine. I'll take a stab into the dark and guess that you are starting a session. The default session handler is file based, and will acquire an exclusive lock on the session file, which blocks all concurrent requests that try to use that same session file. Close the session before you go off doing long-running tasks with session_write_close.

查看更多
登录 后发表回答