Recently, I was working on something. I wrote it in python and deployed the wsgi interface in sae. The server of sae should be nginx. of course, the solution may not be python or php, but never tell me to implement a server. Now it's nginx and nginx .... the situation is as follows :... recently, I was working on something. I wrote it in python and deployed the wsgi interface in sae. The server of sae should be nginx. of course, the solution may not be python or php, but never tell me to implement a server. Now it's nginx and nginx ....
The situation is as follows: two concurrent requests are recorded as A and B, which are two threads for the server. A is half executed and blocked until B sends A signal to.
It seems that there is a very intuitive method: Set a Boolean in the cache or database and use it as mutex. however, when I block the database, I need to poll the database constantly, which consumes too many resources. so I thought, is there a way to save the country and call the mutex API in the system (the slag wave system is probably Linux, or pthread. if two requests are sent to the same process, you may be able to save the mutex address to the database ...... okay, I thought about it too much.
Do not use an endless loop (even if + sleep) for Round-Robin. I will do everything.
Reply content:
Recently, I was working on something. I wrote it in python and deployed the wsgi interface in sae. The server of sae should be nginx. of course, the solution may not be python or php, but never tell me to implement a server. Now it's nginx and nginx ....
The situation is as follows: two concurrent requests are recorded as A and B, which are two threads for the server. A is half executed and blocked until B sends A signal to.
It seems that there is a very intuitive method: Set a Boolean in the cache or database and use it as mutex. however, when I block the database, I need to poll the database constantly, which consumes too many resources. so I thought, is there a way to save the country and call the mutex API in the system (the slag wave system is probably Linux, or pthread. if two requests are sent to the same process, you may be able to save the mutex address to the database ...... okay, I thought about it too much.
Do not use an endless loop (even if + sleep) for Round-Robin. I will do everything.
Can I use a named pipe?
Can posix_kill in the process control extension in PHP official documents be checked?
===! I don't understand the subject too well. It may be that A and B run together. A does not run until half of it is executed and then waits for B's notification to be executed. Does that mean that?
In this case, I think you can split A into two parts: a' and C. A' is the code before receiving B notification, and C is the code after receiving B notification. After running a' and B, the system jumps to C to execute the code. C code first needs to check whether the content processed by a' and B is complete. if the content is incomplete, it stops running. Of course, the processed data should be stored in external storage. I think this should be the simplest implementation method.
In addition, if it is SAE, you should not think about it. If there are too many limits, it is unlikely that you will be exposed to system-level interfaces.