concept request in category streaming

appears as: Request, request, requests, requests
Streaming Data: Understanding the real-time pipeline

This is an excerpt from Manning's book Streaming Data: Understanding the real-time pipeline.

  • Request/acknowledge pattern
  • Three common strategies can overcome this limitation: one on the client side, one on the service side, and one a combination of the two. Let’s consider the client side first. A common strategy often taken by the client is to make the requests asynchronously; this approach is illustrated in figure 2.3.

    Figure 2.3. Client making asynchronous request to the service

    With this adaptation the client makes the request of the service and then continues on with other processing while the service is processing the request. This is the pattern used by all modern web browsers: the browser makes many asynchronous requests for resources and renders the image and/or content as it arrives. This type of processing allows the client to maximize the time normally spent waiting on the response. The end result is an overall increase in the work performed by the client over a period of time. Implementing this type of pattern is relatively easy today because all modern programming languages and many of the frameworks you may use natively support performing the request asynchronously. This pattern is often called half-async because one half of the request response is done asynchronously.

    Let’s walk through the flow of data illustrated in figure 2.6. As the visitor is browsing our site, we’re collecting data about each page they visit and every link they click. The unique thing we’re doing that’s particular to the request/acknowledge pattern occurs on the first page they visit. On this page our collection tier returns an acknowledgment that can be used in future requests. Unlike the request/response pattern, which may return as response success or failure, the request/acknowledge pattern returns data that can be used in future requests. In this case the acknowledgment is nothing more than a unique identifier, but it plays an important role. The acknowledgment can be used on all subsequent pages the visitor visits. When we call the propensity service, we can pass the unique identifier we obtained on the very first visit. With the unique identifier, which identifies the visitor, our propensity service can determine and return the visitor’s current propensity-to-purchase score.

    I realize I’m leaving out a lot of the details of how we got from collection to a propensity score, but it will become clearer in the coming chapters. The key takeaway is that with the request/acknowledge pattern, a client makes a request of a service, asking for an action to be taken, and in turn receives an acknowledgment token that can be used in future requests. We experience this pattern every day in real life. For example, when you purchase an item online, you’re often given a confirmation number, which you can then use to check on the status of your order.