I’ve read about asynchronous HTTP and REST and how can you return a resource after POST-ing to initiate a long running task and then polling that resource to get the task’s status.
I wonder what happens if I have two machines that are load-balanced and one will receive the initial POST and the other a subsequent GET. The second will not be aware of what the first one started, unless I use a common storage to keep the task’s state.
How can I prevent that if I want to keep the state only on the client?
I’ve read about asynchronous HTTP and REST and how can you return a resource
Share
When you did the POST to initiate the long running task, you really should return a URI in the location header to point to the running task. e.g.
At that point, you have a URL to the resource that represents the running task. At that point the load balancing issue is the same as any other. You cannot create state on the server that is accessible by the client that does not have a URI.
However, as long as those two loadbalancing servers are directly accessible you could do