Search

US-12621369-B2 - Handling timeouts of client requests to a server

US12621369B2US 12621369 B2US12621369 B2US 12621369B2US-12621369-B2

Abstract

A method and computer system for handling timeouts of client requests to a server. The method includes: accessing timeout metadata of a synchronous client request at a server queue; determining that the synchronous client request has a timeout risk; identifying a response storage location for a request processor to use to store a response to the synchronous client request when the response is provided after the timeout of the synchronous client request; responding to the synchronous client request indicating a user of a response storage location for asynchronous response retrieval; and providing the identifier of the response storage location as metadata in the synchronous client request when sending the synchronous client request to the request processor for processing.

Inventors

  • Anthony Philip Papageorgiou
  • IAN MARK HODGES
  • Andrew Alan Armstrong

Assignees

  • INTERNATIONAL BUSINESS MACHINES CORPORATION

Dates

Publication Date
20260505
Application Date
20240612
Priority Date
20240516

Claims (19)

  1. 1 . A computer-implemented method for handling timeouts of client requests to a server, the method carried out by the server, the method comprising: accessing timeout metadata of a synchronous client request at a server queue; determining that the synchronous client request has a timeout risk; identifying a response storage location for a request processor to use to store a response to the synchronous client request when the response is provided after a timeout of the synchronous client request; responding to the synchronous client request indicating a use of the response storage location for asynchronous response retrieval; and providing an identifier of the response storage location as metadata in the synchronous client request when sending the synchronous client request to the request processor for processing, wherein the identifier includes credentials of a client for authentication of the client when retrieving the response to the synchronous client request.
  2. 2 . The method of claim 1 , further comprising: monitoring a plurality of synchronous client requests in the server queue and ordering the plurality of synchronous client requests in the server queue based on a time remaining until the timeout of each of the synchronous client requests.
  3. 3 . The method of claim 1 , wherein determining that the synchronous client request has the timeout risk includes analyzing a current server response capability.
  4. 4 . The method of claim 1 , wherein responding to the synchronous client request indicating a use of a response storage request responds with the identifier of the response storage location for the asynchronous response retrieval.
  5. 5 . The method of claim 1 , further comprising: creating the response storage location with an authentication requirement for authentication of a client when retrieving an asynchronous response.
  6. 6 . The method of claim 1 , wherein the response storage location is provided on a separate server to a request processing server.
  7. 7 . The method of claim 1 , further comprising: updating a state of the response storage location between multiple different states of the response at the response storage location.
  8. 8 . The method of claim 1 , further comprising: deleting the response from the response storage location once retrieved by the client.
  9. 9 . The method of claim 1 , further comprising: monitoring the response storage location and deleting a response after a predetermined time.
  10. 10 . A computer-implemented method for handling timeouts of client requests to a server, said method carried out at a client, the method comprising: sending a synchronous client request to a server queue, wherein a client request includes timeout metadata; receiving a holding response to the client request, with the holding response including an indication of a use of a response storage location for the server to use to store a response to the client request when the response is provided after a timeout of the client request; obtaining an identifier of the response storage location, wherein the identifier includes credentials of a client for authentication of the client; authenticating the client at the response storage location in order to retrieve the response; and accessing the response storage location for asynchronous response retrieval.
  11. 11 . The method of claim 10 , further comprising: empowering the client to use the response storage location to retrieve the response in a predefined time window.
  12. 12 . The method of claim 10 , further comprising: repeatedly attempting to retrieve the response from the response storage location until it is available at the response storage location.
  13. 13 . A system for handling timeouts of client requests to a server, comprising: a server system including a processor and a memory configured to provide computer program instructions to the processor to execute a method of: accessing timeout metadata of a synchronous client request at a server queue; determining that the synchronous client request has a timeout risk; identifying a response storage location for a request processor to use to store a response to the synchronous client request when the response is provided after a timeout of the synchronous client request; responding to the synchronous client request indicating a user of the response storage location for asynchronous response retrieval; and providing an identifier of the response storage location as metadata in the synchronous client request when sending the synchronous client request to the request processor for processing, wherein the identifier includes credentials of a client for authentication of the client when retrieving the response to the synchronous client request.
  14. 14 . The system of claim 13 , wherein the method includes: monitoring the client requests in the server queue and ordering the client requests in the server queue based on a time remaining until each of the client requests timeouts.
  15. 15 . The system of claim 13 , wherein determining that the synchronous client request has the timeout risk includes analyzing a current server response capability.
  16. 16 . The system of claim 13 , wherein the method includes: creating the response storage location with client credentials for authentication of the client when retrieving the response.
  17. 17 . The system of claim 14 , wherein the method includes: monitoring the response storage location and deleting a response after a predetermined time.
  18. 18 . The system of claim 13 , further comprising: a client system including a processor and a memory configured to provide computer program instructions to the processor to execute a method of: sending the synchronous client request to the server queue, wherein the synchronous client request includes the timeout metadata; receiving a holding response to the synchronous client request, with the holding response including an indication of a use of the response storage location for the request processor to use to store a response to the synchronous client request when the response is provided after the timeout of the synchronous client request; obtaining an identifier of the response storage location; and accessing the response storage location for the asynchronous response retrieval.
  19. 19 . The system of claim 18 , wherein the method includes: empowering a client to use the response storage location to retrieve the response in a predefined time window.

Description

BACKGROUND The present invention relates to handling client requests to a server, and more specifically, to handling timeouts of client requests to a server. When possible synchronous interactions between a client and server are generally preferred to asynchronous interactions. Synchronous interactions only require one network request whereas asynchronous interactions require multiple network requests. Synchronous client server application models include Representational State Transfer (RESTful) application programming interfaces (APIs). Commonly, servers may have a limit on the number of client requests that can be processed in parallel, and servers may queue incoming client requests. Server queues present a strategy for coping with busy periods and client requests are held in the queue until the server has sufficient resources available to process them. The server queue may become so large, or delays may occur at the server side such that client requests may timeout before the requests reach the front of the queue. In existing solutions for synchronous interactions, it is complex for applications to recover when client requests timeout due to heavy server traffic or too short client timeout periods. This difficulty results in application complexity, excess server workload due to retries, and business level problems which have costs, risks, and damage to infrastructure. SUMMARY According to an aspect of the present invention there is provided a computer-implemented method for handling timeouts of client requests to a server, said method carried out by a server comprising: accessing timeout metadata of a synchronous client request at a server queue; determining that the client request has a timeout risk; identifying a response storage location for a request processor to use to store a response to the client request when the response is provided after the timeout of the client request; responding to the client request indicating a use of a response storage location for asynchronous response retrieval; and providing the identifier of the response storage location as metadata in the client request when sending the client request to the request processor for processing. This method has the advantage of using synchronous response patterns until such time as there is a timeout risk for a client and then moving to an asynchronous response pattern with the response payload being provided at a response storage location accessible to the request processor and the client. According to another aspect of the present invention there is provided a computer-implemented method for handling timeouts of client requests to a server, said method carried out at a client comprising: sending a synchronous client request to a server queue, wherein the client request includes timeout metadata; receiving a holding response to the client request, with the holding response including an indication of the use of a response storage location for the server to use to store a response to the client request when the response is provided after the timeout of the client request; obtaining an identifier of the response storage location; and accessing the response storage location for asynchronous response retrieval. According to a further aspect of the present invention there is provided a server system for handling timeouts of client requests to a server, comprising: a processor and a memory configured to provide computer program instructions to the processor to execute a method of: accessing timeout metadata of a synchronous client request at a server queue; determining that the client request has a timeout risk; identifying a response storage location for a request processor to use to store a response to the client request when the response is provided after the timeout of the client request; responding to the client request indicating a user of a response storage location for asynchronous response retrieval; and providing the identifier of the response storage location as metadata in the client request when sending the client request to a request processor for processing. According to a further aspect of the present invention there is provided a client system for handling timeouts of client requests to a server, comprising: a processor and a memory configured to provide computer program instructions to the processor to execute a method of: sending a synchronous client request to a server queue, wherein the client request includes timeout metadata; receiving a holding response to the client request, with the holding response including an indication of the use of a response storage location for a request processor to use to store a response to the client request when the response is provided after the timeout of the client request; obtaining an identifier of the response storage location; and accessing the response storage location for asynchronous response retrieval. According to a further aspect of the present invention there is provided a c