A curl timeout has been encountered in the recent project, resulting in a failure of the user operation to write
1, Curl timeout how to track which step caused the timeout
PHP Timeout principle:
How do we determine which step timed out in the event of a request to invoke an API timeout.
1, network reasons, the request time-out, the server code is not executed, it is easy to judge, after the timeout, the service side without any action
2, the server execution timeout, the server code has been executed, but did not run out of time exceeded the set timeout
In the second case, to first analyze what steps the server code has performed, then look at what steps are being executed but not executed, analyze whether the step caused the timeout, and then optimize for that step, not forward analysis, to determine which of the previous steps was time-consuming, resulting in a later timeout.
2, one-time operation multiple calls to an asynchronous service processing mode
How to minimize the impact of service hangs on us when we need to call a TCP asynchronous service (with a connection timeout) multiple times in one operation
My understanding is to encapsulate these multiple calls into an API interface and then go asynchronously, so that even if the asynchronous service is hung, the connection will only expire once.
3, a service our subjective judgment is not good after the first reaction should be discarded.
At least I do not think so, I am more inclined to find out whether it is really bad to use or do not use their own good.
4, as a research and development, I have never thought of shirking responsibility
When in a team, there are some problems, the solution has not yet come out, but someone has begun to think of shirking responsibility, that moment
, I really want to get out of this team. But maybe we should think about how to solve this problem if I'm a team manager.