# Patent

## Title
Pre-processing and processing pipeline for queue client

## Abstract

Methods and systems for implementing a pre-processing and processing pipeline for a queue client are disclosed. A queue client receives, from a queue service, data indicative of an estimated time to process a first message in a queue. The queue client initiates processing of the first message. The queue client receives, from the queue service, data indicative of an estimated time to pre-process a second message in the queue. The queue client initiates pre-processing of the second message during the processing of the first message. The pre-processing of the second message is scheduled based on the estimated time to process the first message and the estimated time to pre-process the second message.

## Background
BACKGROUND
Many companies and other organizations operate distributed systems that interconnect numerous computing systems and other computing resources to support their operations, such as with the computing systems being co-located (e.g., as part of a local network) or instead located in multiple distinct geographical locations (e.g., connected via one or more private or public intermediate networks). For example, data centers housing significant numbers of interconnected computing systems have become commonplace, such as private data centers that are operated by and on behalf of a single organization and public data centers that are operated by entities as businesses to provide computing resources to customers. As the scale and scope of typical distributed systems has increased, the tasks of provisioning, administering, and managing the computing resources have become increasingly complicated.
For example, a queuing service may be implemented using a distributed system in a manner that prioritizes high availability and redundancy. However, prior approaches for implementing a distributed queuing service may present messages out of their intended order. Additionally, prior approaches for implementing a distributed queuing service may present a message more than the number of intended times (e.g., once). The presentation of messages out of their intended order and the presentation of messages more than once may pose problems for applications that require strict queue behavior.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 illustrates an example system environment for strict queue ordering in a distributed system, according to one embodiment.
FIGS. 2A and 2B illustrate an example system environment for implementing message forwarding with strict queue ordering in a distributed system, according to one embodiment.
FIGS. 3A and 3B illustrate aspects of queue server functionality in an example system environment for strict queue ordering in a distributed system, according to one embodiment.
FIGS. 4A and 4B illustrate an example system environment for implementing redundancy with strict queue ordering in a distributed system, according to one embodiment.
FIG. 5 illustrates an example system environment for efficiently employing queue consumers with strict queue ordering in a distributed system, according to one embodiment.
FIG. 6 is a flowchart illustrating a method for implementing strict queue ordering in a distributed system, according to one embodiment.
FIG. 7 illustrates an example system environment for a pre-processing and processing pipeline for a queue client, according to one embodiment.
FIG. 8 illustrates an example system environment for a pre-processing and processing pipeline for a queue client with heartbeat functionality, according to one embodiment.
FIG. 9 is a flowchart illustrating a method for implementing a pre-processing and processing pipeline for a queue client, according to one embodiment.
FIG. 10 illustrates an example of a computing device that may be used in some embodiments.



While embodiments are described herein by way of example for several embodiments and illustrative drawings, those skilled in the art will recognize that embodiments are not limited to the embodiments or drawings described. It should be understood, that the drawings and detailed description thereto are not intended to limit embodiments to the particular form disclosed, but on the contrary, the intention is to cover all modifications, equivalents and alternatives falling within the spirit and scope as defined by the appended claims. The headings used herein are for organizational purposes only and are not meant to be used to limit the scope of the description or the claims. As used throughout this application, the word “may” is used in a permissive sense (i.e., meaning “having the potential to”), rather than the mandatory sense (i.e., meaning “must”). Similarly, the words “include,” “including,” and “includes” mean “including, but not limited to.”
DETAILED DESCRIPTION OF EMBODIMENTS
Various embodiments of methods and systems for implementing strict queue ordering in a distributed system are described. In a distributed strict queue system with multiple queue servers, each queue server may be assigned a portion of a range of values for a strict order parameter. Based on the value of its strict order parameter, an incoming message may be forwarded to the appropriate queue server for the value of the strict order parameter, and the queue server may assign a sequence identifier to the message. The message may then be presented in the intended order with respect to other messages with the same value for the strict order parameter. Additionally, each message may be delivered to a queue consumer once and only once in the distributed strict queue system.
Various embodiments of methods and systems for implementing a pre-processing and processing pipeline for a queue client are described. For any given message in a queue, a queue client may obtain an estimated time to pre-process the message and an estimated time to process the message. Based on these estimated times for consecutive messages in the queue, the client may perform pre-processing operations for a later message (e.g., fetching data required for processing) while continuing to process an earlier message. In this manner, the queue client may perform all or part of the pre-processing for a particular message by the time the client is ready to process the message. In one embodiment, the processing and pre-processing may be performed simultaneously for consecutive messages with different strict order parameters or when the pre-processing stage does not have a strictness guarantee.
FIG. 1 illustrates an example system environment for strict queue ordering in a distributed system, according to one embodiment. A distributed strict queue system 100 may include a plurality of queue producers (e.g., queue producers 150A and 150B through 150N), a queue service 110 implemented using a plurality of queue servers (e.g., queue servers 115A and 115B through 115N), and a plurality of queue consumers (e.g., queue consumers 160A and 160B through 160N). The queue producers 150A-150N may represent various clients, client accounts, computing instances, resources, processes, or any suitable combinations thereof. Each of the queue producers 150A-150N may supply one or more messages to the queue service 110 to be enqueued. The messages may represent tasks or requests to be executed or otherwise implemented using appropriate computing resources. For example, a message may describe or reference one or more instructions to be executed or interpreted using source data from one or more indicated data sources and/or storing results in one or more indicated data destinations. As will be described in greater detail below, the queue service 110 may implement one or more strict queues 120 in which messages with the same value for a strict order parameter are presented in their intended order. The queue consumers 160A-160N may pull the messages from the strict queue(s) 120 and execute or otherwise implement the messages. In one embodiment, the queue service 110 may deliver each message only once.
In one embodiment, the strict queue(s) 120 may include messages associated with different values for a strict order identifier. Messages with the same value for the strict order identifier may be enqueued in the correct order relative to each other. However, for messages with different values for the strict order identifier, the queue service 110 may use a “best effort” ordering technique that is not guaranteed to present messages with different values for the strict order identifier in the correct order. The best effort ordering may result in some messages with different values for the strict order identifier being processed by queue clients in a different order than the messages were received by the queue service 110. Accordingly, the strict queue(s) 120 may be strict for messages with the same value for the strict order identifier and non-strict for messages with different values for the strict order identifier.
It is contemplated that the distributed strict queue system 100 may include additional components not shown, fewer components than shown, or different combinations, configurations, or quantities of the components shown. For example, although three queue producers 150A, 150B, and 150N are shown for purposes of example and illustration, it is contemplated that different quantities and combinations of queue producers may be used. Additionally, although three queue servers 115A, 115B, and 115N are shown for purposes of example and illustration, it is contemplated that different quantities and combinations of queue servers may be used. Furthermore, although three queue consumers 160A, 160B, and 160N are shown for purposes of example and illustration, it is contemplated that different quantities and combinations of queue consumers may be used.
The distributed strict queue system 100 may comprise one or more computing devices, any of which may be implemented by the example computing device 3000 illustrated in FIG. 10. In various embodiments, portions of the functionality of the distributed strict queue system 100, including the queue producers 150A-150N, queue servers 115A-115N, and/or queue consumers 160A-160N, may be provided by the same computing device or by any suitable number of different computing devices. If any of the components of the distributed strict queue system 100 are implemented using different computing devices, then the components and their respective computing devices may be communicatively coupled, e.g., via a network. Each of the illustrated components may represent any combination of software and hardware usable to perform their respective functions.
In some embodiments, the queue servers 115A-115N and queue consumers 160A-160N may be implemented as virtual compute instances or as physical compute instances. The virtual compute instances and/or physical compute instances may be offered to clients, provisioned, and maintained by a provider network that manages computational resources, memory resources, storage resources, and network resources. A virtual compute instance may comprise one or more servers with a specified computational capacity (which may be specified by indicating the type and number of CPUs, the main memory size, and so on) and a specified software stack (e.g., a particular version of an operating system, which may in turn run on top of a hypervisor). One or more virtual compute instances may be implemented by the example computing device 3000 illustrated in FIG. 10.
In one embodiment, a suitable component of the distributed strict queue system 100 may select and/or provision the queue servers 115A-115N and/or queue consumers 160A-160N. For example, the queue servers 115A-115N and/or queue consumers 160A-160N may be provisioned from a suitable pool of available computing instances. In one embodiment, additional computing instances may be added to the queue servers 115A-115N and/or queue consumers 160A-160N as needed. In one embodiment, computing instances may be returned to the pool of available computing instances from the queue servers 115A-115N and/or queue consumers 160A-160N if the computing instances are not needed at a particular point in time.
In one embodiment, the functionality of the distributed strict queue system 100 may be provided to clients using a provider network. For example, the functionality of the distributed strict queue system 100 may be presented to clients as a web-accessible service. A network set up by an entity such as a company or a public sector organization to provide one or more services (such as various types of cloud-based computing or storage) accessible via the Internet and/or other networks to a distributed set of clients may be termed a provider network. A provider network may include numerous data centers hosting various resource pools, such as collections of physical and/or virtualized computer servers, storage devices, networking equipment and the like, that are used to implement and distribute the infrastructure and services offered by the provider. The resources may, in some embodiments, be offered to clients in units called “instances,” such as virtual or physical compute instances or storage instances. A virtual compute instance may, for example, comprise one or more servers with a specified computational capacity (which may be specified by indicating the type and number of CPUs, the main memory size, and so on) and a specified software stack (e.g., a particular version of an operating system, which may in turn run on top of a hypervisor). A number of different types of computing devices may be used singly or in combination to implement the resources of the provider network in different embodiments, including general purpose or special purpose computer servers, storage devices, network devices, and the like.
In one embodiment, operators of provider networks may implement a flexible set of resource reservation, control, and access interfaces for their clients. For example, a provider network may implement a programmatic resource reservation interface (e.g., via a web site or a set of web pages) that allows clients to learn about, select, purchase access to, and/or reserve resources. In one embodiment, queue resources may be reserved on behalf of clients using a client-accessible service that implements the distributed strict queue system 100. According to one such embodiment, a distributed strict queue system 100 in such an environment may receive specifications for the various messages to be enqueued, e.g., a description of one or more tasks and an indication of a source of input data to be used by the task(s). In response, the distributed strict queue system 100 may enqueue and execute the task(s) using one or more resources of a selected resource pool of the provider network. In one embodiment, the resource pool may be automatically selected based on the anticipated computational needs of the various tasks. In one embodiment, the resource pool may be selected based on a specific resource request or reservation submitted by the client.
In one embodiment, the client may use one or more suitable interfaces (such as one or more web pages, an application programming interface [API], or a command-line interface [CLI]) to provide the various messages to be enqueued and otherwise configure the distributed strict queue system 100. In one embodiment, the client may be able to view the current status of the messages using the interface(s). In one embodiment, additional information about messages in the distributed strict queue system 100 may be available via the interface(s), such as program output, error logs, exception logs, and so on.
FIGS. 2A and 2B illustrate an example system environment for implementing message forwarding with strict queue ordering in a distributed system, according to one embodiment. Each queue producer may provide a set of messages to the queue service 110 over time. For example, the queue producer 150A may provide messages 151A, the queue producer 150B may provide messages 151B, and the queue producer 150N may provide messages 151N. Each message may include a strict order parameter. In one embodiment, the strict order parameter may be assigned by a queue producer within the distributed strict queue system 100. In one embodiment, different queue producers may produce messages that share the same value for the strict order parameter. Additionally, a single queue producer may produce messages that have different values for the strict order parameter. The messages 151A-151N may be received by the queue service 110 at various points in time.
In one embodiment, the messages 151A-151N may be received by one or more designated instances of the queue servers 115A-115N. As shown in FIG. 2A, for example, the messages 151A-151N may be received by substantially any of the queue servers, such as queue server 115A and queue server 115B, for example. Based on the value of the strict order parameter associated with a message, the queue server that initially receives the message from the corresponding queue producer may forward the message to a particular queue server that is associated with that value of the strict order parameter.
In one embodiment, a range of values for the strict order parameter may be divided among the queue servers 115A-115N such that a particular one of the queue servers may be responsible for handling messages identified by each value of the strict order parameter. The range of values may include any collection of values, and the values may include integers, alphanumeric values, binary values, etc. In one embodiment, each value of the strict order parameter may be assigned to one and only one of the queue servers 115A-115N. In one embodiment, any of the queue servers 115A-115N may be responsible for one or more values of the strict order parameters.
The value of the strict order parameter for a message may be generated by the corresponding queue producer. For example, the value of the strict order parameter may be a string, a binary value, or an integer. In one embodiment, a stable hash function may be applied by the initial recipient queue servers to the values of the strict order parameter as expressed in incoming messages. In this manner, the various initial values for the strict order parameter may be standardized to a particular length and/or data type within a known range for more efficient handling by the queue service 110. As used herein, the term “strict order parameter” may refer to the original strict order parameter (or the value thereof) associated with a message or to the result of a hash function that uses the original strict order parameter as input. In one embodiment, a message may be forwarded to an appropriate queue server (i.e., a destination server) based on the hash value.
In one embodiment, each of the queue servers 115A-115N that is configured to receive incoming messages from the queue producers 150A-150N may include functionality for destination server determination. For example, the queue server 115A may include a module 130A that implements the destination server determination functionality, and the queue server 115B may include a module 130B that implements the destination server determination functionality. Using the destination server determination module 130A or 130B, the corresponding queue server may compare the value of the strict order parameter of an incoming message to the range of values assigned to the various queue servers. The destination server determination module 130A or 130B may implement the destination server determination functionality using any suitable technique, such as the use of a lookup function that maps an input value representing a strict order parameter to an output value representing a queue server. The destination server determination module 130A or 130B may determine the identity of the queue server to which the message should be forwarded, i.e., the destination queue server, based on the value of the strict order parameter for the message. The queue server 115A may forward one or more messages 152B to the queue server 115B based on one or more values of the strict order parameter, and the queue server 115B may forward one or more messages 152A to the queue server 115A based on one or more values of the strict order parameter.
The value of the strict order parameter for the message may be within the range of values assigned to the destination queue server. The output of the destination server determination functionality may be stored for later reference using a module for storage of the destination server state. For example, the queue server 115A may include a module 135A that implements the destination server state functionality, and the queue server 115B may include a module 135B that implements the destination server state functionality. In one embodiment, the destination server state 135A or 135B may represent a whole or partial list of active servers within the queue service 110.
In one embodiment, the destination server determination modules 130A and 130B and/or the states 135A and 135B may change if one or more new queue servers become active in the distributed strict queue system 100, if one or more queue servers stop being active or are removed from the distributed strict queue system 100, or if the range of values of the strict order parameter is otherwise reassigned to the queue servers. For example, the range of strict order parameters may be rebalanced if a set of messages with a particular value for the strict order parameter begins placing excessive demands on the resources of the particular queue server assigned to that value of the strict order parameter. In such circumstances, the load for the particular queue server may be reduced by reassigning one or more values of the strict order parameter to another queue server. As another example, if the load provided by a set of messages with a particular value for the strict order parameter decreases sufficiently, the responsible queue server may be assigned additional values of the strict order parameter so that it may optimize its resource usage. In one embodiment, queue servers 110 may be added to the distributed strict queue system 100 or removed from the distributed strict queue system 100 as needed to handle the current load and/or anticipated load.
As shown in FIG. 2B, one or more components 116 may be configured to serve as an interface between the queue producers 150A-150N and the queue servers 115A-115N. Each of the component(s) 116 may be referred to as a forwarding server. Although one forwarding server 116 is shown for purposes of example and illustration, it is contemplated that different quantities and combinations of forwarding servers may be used. The forwarding server(s) 116 may be implemented by the example computing device 3000 illustrated in FIG. 10. In one embodiment, each forwarding server 116 may be provisioned from among the queue servers 115A-115N. The one or more forwarding servers 116 may be used to receive messages from the queue producers 150A-150N and forward each message to the appropriate queue server based on the value of the strict order parameter for the message. For example, the one or more forwarding servers 116 may forward one or more messages 152A to the queue server 115A based on one or more values of the strict order parameter, one or more messages 152B to the queue server 115B based on one or more values of the strict order parameter, and one or more messages 152N to the queue server 115N based on one or more values of the strict order parameter. As discussed above with reference to FIG. 2A, each forwarding server 116 may include a module 130C for destination server determination and a module 135C for destination server state storage. The forwarding server(s) 116 may be used with the distributed strict queue system 100 on any suitable basis, e.g., a queue-by-queue or account-by-account basis.
If the queue producer for a message does not supply a value for the strict order parameter, then a value may be generated by another entity within the distributed strict queue system 100, such as the queue server or forwarding server that initially receives the message from the queue producer. The value for the strict order parameter may be generated using any suitable technique, including uniform random selection from a range of possible values (e.g., within the same range of values assigned to the various queue servers 115A-115N) or round-robin selection from a range of possible values. The ranges of values may be a parameter of the distributed strict queue system 100 or configurable per strict queue.
FIGS. 3A and 3B illustrate aspects of queue server functionality in an example system environment for strict queue ordering in a distributed system, according to one embodiment. Although the queue server functionality is illustrated with reference to queue server 115A, it is contemplated that the same or similar functionality may be implemented by any of the queue servers 115A-115N in the distributed strict queue system 100. At least one of the values of the strict order parameter may be assigned to the queue server 115A. Accordingly, the queue server 115A may receive messages 153 with a first value for the strict order parameter from one or more of the queue producers 150A-150N. The messages may be received at different points in time. For example, the messages 153 may include an earlier message 153A and a later message 153N. Any suitable number of messages may be received by the queue server 115A. As discussed above, the messages 153 may be forwarded to the queue server 115A from another one of the queue servers or from a forwarding server based on the strict order parameters within the messages.
The queue server 115A may include a sequence identification functionality 140A. In one embodiment, each incoming message within the range of strict order parameters assigned to the queue server 115A may undergo sequence identification using the sequence identification functionality 140A. The sequence identification functionality 140A may employ any suitable technique to assign each incoming message a place in a message sequence for the corresponding value of the strict order parameter. For example, the sequence identification functionality 140A may generate a message sequence 141 for the first value based on the messages 153 received over time. The message sequence 141 may indicate an ordering of the messages based on the time of receipt at the queue server 115A. The time of receipt may be based on the time of receipt of the first byte received, the time of receipt of the last byte received, or any time in between. Accordingly, the message sequence 141 for the first value may place the earlier message 153A before the later message 153N.
The sequence identification functionality 140A may assign a sequence identifier to each message. Each sequence identifier may indicate a respective position in the message sequence for the message, where the respective position is based on the time of receipt (e.g., the time of receipt of the first byte received, the time of receipt of the last byte received, or any time in between). In one embodiment, the sequence identifier may include a timestamp (e.g., indicating the time of receipt) and/or an ordinal number indicating the relative position of the message in a sequence associated with a particular value of the strict order identifier. In one embodiment, the sequence identification functionality 140A may remember the last sequence identifier for a particular value of the strict order parameter as long as the particular value is active in the distributed strict queue system 100 and associated with new messages provided to the queue server 115A. If the particular value of the strict order parameter has not been associated with a new message since the last message was delivered to a queue customer, then the message sequence for that particular value may be discarded. The message sequence may be restarted (e.g., from the beginning) if the one or more queue providers resume sending messages with the particular value of the strict order parameter to the queue server 115A.
After the sequence identifier has been added to an incoming message, the queue server 115A may enqueue the message in a logical queue 121A. In one embodiment, a logical queue may be managed by a single queue server (e.g., server 115A) and may contain only those messages associated with a particular value for the strict order parameter. The logical queue 121A may be strictly ordered for messages with a particular value of the strict order parameter. By referencing the sequence identifiers for messages 153 having a particular value of the strict order parameter, the messages 153 may be added to the logical queue 121A in the order in which the messages were received by the queue server 115A that is designated to handle the particular value. As a result, the logical queue 121A may include the messages for a particular value of the strict order parameter in a strict order relative to each other. For example, the earlier message (with a sequence identifier) with the first value 154A and the later message (with a sequence identifier) with the first value 154N may be enqueued in the correct order relative to each other.
As shown in FIG. 3B, the queue server 115A may receive messages 157 having different values for the strict order parameter. Although the queue server functionality is illustrated with reference to queue server 115A, it is contemplated that the same or similar functionality may be implemented by any of the queue servers 115A-115N in the distributed strict queue system 100. At least two of the values of the strict order parameter may be assigned to the queue server 115A, e.g., within a range of values assigned to the queue server 115A. Accordingly, the queue server 115A may receive a set of messages 157 from one or more of the queue producers 150A-150N, where the set of messages 157 includes both messages with a first value for the strict order parameter and messages with a second value for the strict order parameter. The messages 157 may be received at different points in time. For example, the messages 157 may include an earlier message 153A and a later message 153N with the first value, and the messages 157 may also include an earlier message 155A and a later message 155N with the second value. Any suitable number of messages may be received by the queue server 115A. As discussed above, the messages 157 may be forwarded to the queue server 115A from another one of the queue servers or from a forwarding server based on the strict order parameters within the messages.
The queue server 115A may include a sequence identification functionality 140A. In one embodiment, each incoming message within the range of strict order parameters assigned to the queue server 115A may undergo sequence identification using the sequence identification functionality 140A. The sequence identification functionality 140A may employ any suitable technique to assign each incoming message a place in a message sequence for the corresponding value for the strict order parameter. For example, the sequence identification functionality 140A may generate a message sequence 141 for the first value based on the messages 153A-153N with the first value received over time, and the sequence identification functionality 140A may generate a message sequence 142 for the second value based on the messages with the second value 155A-155N received over time. Each message sequence 141 and 142 may indicate an ordering of the messages based on the time of receipt at the queue server 115A. The time of receipt may be based on the receipt of the first byte of the message or the receipt of the last byte of the message. Accordingly, the message sequence 141 for the first value may place the earlier message 153A before the later message 153N, and the message sequence 142 for the second value may place the earlier message 155A before the later message 155N.
As discussed above, the sequence identification functionality 140A may assign a sequence identifier to each message. Each sequence identifier may indicate a respective position in the message sequence for the message, where the respective position is based on the time of receipt (e.g., of the first byte or last byte). In one embodiment, the sequence identifier may include a timestamp (e.g., indicating the time of receipt) and/or an ordinal number indicating the relative position of the message in a sequence associated with a particular value of the strict order identifier.
After the sequence identifier has been added to an incoming message, the queue server 115A may enqueue the message in a logical queue 121A for the first value of the strict order parameter or in a logical queue 122A for the second value of the strict order parameter. In one embodiment, each logical queue 121A and 122A may be managed by a single queue server (e.g., server 115A) and may contain only those messages associated with a particular value for the strict order parameter. The logical queue 121A may be strictly ordered for messages with the first value of the strict order parameter, and the logical queue 122A may be strictly ordered for messages with the second value of the strict order parameter. By referencing the sequence identifiers for messages having particular values of the strict order parameter, the messages may be added to the appropriate logical queue 121A or 122A in the order in which the messages were received by the queue server 115A that is designated to handle the particular values. As a result, the logical queue 121A may include the messages for the first value of the strict order parameter in a strict order relative to each other, and the logical queue 122A may include the messages for the second value of the strict order parameter in a strict order relative to each other. For example, the earlier message (with a sequence identifier) with the first value 154A and the later message (with a sequence identifier) with the first value 154N may be enqueued in the correct order relative to each other. Additionally, the earlier message (with a sequence identifier) with the second value 156A and the later message (with a sequence identifier) with the second value 156N may be enqueued in the correct order relative to each other
In one embodiment, the strict queue(s) 120 may include a plurality of logical queues such as logical queues 121A and 122A. Each of the logical queues may be managed by a single queue server and may correspond to a particular value for the strict order parameter. Messages with the same value for the strict order identifier may be enqueued in the correct order relative to each other. However, for messages with different values for the strict order identifier, the queue service 110 may use a “best effort” ordering technique that is not guaranteed to present messages with different values for the strict order identifier in the correct order. The best effort ordering may result in some messages with different values for the strict order identifier being placed in the queue(s) 120 in a different order than the messages were received by the queue service 110. Accordingly, the strict queue(s) 120 may be strict for messages with the same value for the strict order identifier and non-strict for messages with different values for the strict order identifier.
FIGS. 4A and 4B illustrate an example system environment for implementing redundancy with strict queue ordering in a distributed system, according to one embodiment. In one embodiment, the distributed strict queue system 100 may use one or more backup servers for each queue server. The one or more backup servers may be configured to resume the responsibilities of a primary server if the primary server should experience a failure. As shown in the example of FIG. 4A, the queue server 115A is a primary server for one or more strict order parameters. As further shown in the example, the queue server 115B is a secondary backup server for the primary server 115A, and the queue server 115N is a tertiary backup server for the primary server 115A and secondary server 115B. Each of the servers may include a corresponding logical queue 121A, 121B, or 121N for a particular value of the strict order identifier. It is contemplated that different numbers and configurations of backup servers may be used in the distributed strict queue system 100.
When a message is received by the primary server 115A and stamped with a sequence identifier, the stamped message may be forwarded to the one or more backup servers (e.g., secondary server 115B and tertiary server 115N). The replicated message 158A may be sent from the primary server 115A to the secondary server 115B, and the replicated message 158B may be sent from the secondary server 115B to the tertiary server 115N. The tertiary server 115N may then send a confirmation of receipt 159N to the secondary server 115B, and the secondary server 115B may then send a confirmation of receipt 159B to the primary server 115A. In one embodiment, the primary server 115A may place the message in the logical queue 121A and/or confirm the enqueuing of the message to the message source only after receiving the confirmation of receipt 159B from the secondary server 115B.
Similarly, as shown in the example of FIG. 4B, when preparing to deliver a message to a consumer, the primary server 115A may send updates 458A and 458B to the secondary server 115B and tertiary server 115N before delivering the message. The updates 458A and 458B may indicate that the primary server 115A is preparing to deliver the message. In one embodiment, the message may be delivered to the consumer only after the one or more backup servers have confirmed receipt of the update(s) sent by the primary server, e.g., with confirmations of receipt 459B and 459N. In one embodiment, the delivery of a message to a consumer may include a preparation step in which the one or more backup servers are notified of the impending delivery, a locking step to flag the message in the queue as “locked” after the message has been delivered, and a deletion step to delete the message from the queue after the consumer has confirmed successful processing of the message. Updates 458A and 458B may be sent from the primary server to the one or more backup servers before each step, and the step may be completed only after the one or more backup servers have confirmed receipt of the updates with receipt confirmations 459B and 459N. For example, the primary server 115A may delete the message from the queue 121A only after receiving confirmation of processing from the consumer, sending updates 458A and 458B to the secondary server 115B and tertiary server 115N, and receiving confirmations 459B and 459N of receipt of the updates. In this manner, the distributed strict queue system 100 may provide “guaranteed once” delivery for messages (i.e., a guarantee that each message is delivered once and only once) using one or more backup servers in case the primary server 115A fails at some point during the delivery process.
FIG. 5 illustrates an example system environment for efficiently employing queue consumers with strict queue ordering in a distributed system, according to one embodiment. In one embodiment, the distributed strict queue system 100 may give preferential treatment to particular consumers 160A-160N to increase the efficiency of message execution. Each queue consumer (e.g., queue consumer 160A) may be assigned a portion of the range of values of the strict order parameter. The distributed strict queue system 100 may attempt to allow the consumer associated with a particular value of the strict order parameter to continue to consume messages associated with that particular value of the strict order parameter. In one embodiment, each queue consumer may be associated with one or more particular queue servers that provides messages with one or more particular values of the strict order parameter. As shown in the example of FIG. 5, each logical queue 121A-121N may represent a particular value of the strict order parameter. In various embodiments, each queue consumer may have a one-to-one or one-to-many correspondence with one or more particular values of the strict order parameter (and the corresponding logical queue(s)).
In one embodiment, in a similar manner as discussed above with reference to FIGS. 2A and 2B, a queue consumer may be directed to an appropriate queue server based on one or more values of the strict order parameter assigned to the queue consumer. As shown in FIG. 5, one or more components 516 may be configured to serve as an interface between the queue consumers 160A-160N and the queue servers 115A-115N. Each of the component(s) 516 may be referred to as a forwarding server. Although one forwarding server 516 is shown for purposes of example and illustration, it is contemplated that different quantities and combinations of forwarding servers may be used. The forwarding server(s) 516 may be implemented by the example computing device 3000 illustrated in FIG. 10. The one or more forwarding servers 516 may be used to receive requests from the queue consumers 160A-160N and forward each request to the appropriate queue server based on the one or more values of the strict order parameter associated with the requesting queue consumer. After a forwarding server 516 determines a corresponding queue server for a particular queue consumer, the queue server may push messages to the queue consumer, or the queue consumer may pull messages from the queue server.
Each forwarding server 516 may include a module 530 for performing server determination, a module 535 for storing queue server state information, and a module 540 for storing queue consumer state information. In one embodiment, one or more values of the strict order parameter may be assigned to each of the queue consumers using any suitable technique, including uniform random selection from a range of possible values (e.g., within the same range of values assigned to the various queue servers 115A-115N) or round-robin selection from a range of possible values. The value(s) of the strict order parameter associated with a particular queue consumer may be stored in the queue consumer state information 540. Using the server determination module 530, the forwarding server(s) 516 may compare the value(s) of the strict order parameter associated with a queue consumer to the ranges of values assigned to the various queue servers. The server determination module 530 may implement the server determination functionality 530 using any suitable technique, such as the use of a lookup function that maps a value or range of values of the strict order parameter to a queue server. The server determination module 530 may determine the identity of a queue server that should provide messages to a queue consumer based on one or more values or range of values of the strict order parameter associated with the queue consumer. The output of the server determination functionality 530 may be stored for later reference using a module 535 for storage of queue server state information.
After performing the server lookup process to determine the queue server responsible for a particular value or range of values of the strict order parameter, the server determination module 530 (or any other suitable component of the forwarding server 516) may forward a request (e.g., a request from a queue consumer for messages) to that queue server. If the logical queue corresponding to the value of the strict order parameter contains any messages that are available to the queue consumer, then the queue server may return the next message in the logical queue to the queue consumer. If the logical queue corresponding to the value of the strict order parameter is empty, then the association between the queue consumer and the value of the strict order parameter may be removed, and the server determination module 530 (or any other suitable component of the forwarding server 516) may restart the server lookup process.
If no queue server has messages among the queue servers that are responsible for the value(s) of the strict order parameter assigned to the queue consumer, then the forwarding server 516 may assign one or more new values or a range of values of the strict order parameter to the queue consumer and restart the lookup process. Alternatively, the forwarding server 516 may send a message to the queue consumer indicating that the queue consumer is not currently responsible for processing any messages. In response to such a message from the forwarding server 516, the queue consumer may enter a sleep state in which its interaction with the distributed strict queue system 100 is reduced.
By allowing queue servers to give preferential treatment to particular queue consumers based on the strict order parameter, the efficiency and reliability of failover operations may be enhanced. Additionally, the performance characteristics of a consumer may be enhanced by allowing the consumer to process messages for particular values of the strict order parameter, particularly if the messages tend to require the same input data or other resources. The range of values of the strict order parameter assigned to various consumers may be rebalanced to optimize resource usage, e.g., using load balancing techniques.
FIG. 6 is a flowchart illustrating a method for implementing strict queue ordering in a distributed system, according to one embodiment. As shown in 605, a message may be received at a distributed strict queue system. The message may be received from a queue consumer (e.g., a client, client account, process, instance, resource, etc.) and may have a strict order parameter assigned by the queue consumer. The distributed strict queue system may receive the message using one or more interfaces and/or queue servers. In one embodiment, the distributed strict queue system may compute a stable hash of the strict order parameter upon receipt of the message.
A range of strict order parameters may be divided among a plurality of queue servers. Each strict order parameter may be assigned to one and only one of the queue servers. As shown in 610, the message may be forwarded to the assigned queue server based on the value of the strict order parameter (or the hash thereof). The destination queue server may be determined using a functionality to determine the destination queue server based on the value of the strict order parameter for the message. The destination queue server may be a primary server for a range of values of the strict order parameter that includes the value in the current message. In one embodiment, the primary server may update one or more backup servers (e.g., a secondary server and a tertiary server) with the received message.
As shown in 615, a sequence identifier may be assigned to the message at the queue server responsible for all of the messages with the strict order parameter. The sequence identifier may indicate a respective position in a message sequence for the strict order parameter. The respective position may be based on the time of receipt. The time of receipt may be based on the receipt of the first or last byte of the message at the destination queue server.
As shown in 620, the message may be enqueued based on the sequence identifier. The message may be placed in a queue in a strict order with respect to other messages with the same value for the strict order parameter. In some cases, however, the message may be out of order with respect to messages with other values for the strict order parameter. In this manner, the distributed strict queue system may ensure that messages with the same strict order parameter (i.e., with the same values thereof) are strictly ordered in a queue while messages with different strict order parameters (i.e., with different values thereof) are not necessarily in the correct order (i.e., weakly ordered or non-strictly ordered). In one embodiment, the primary server may update one or more backup servers (e.g., a secondary server and a tertiary server) with updates regarding the enqueuing of the message.
FIG. 7 illustrates an example system environment for a pre-processing and processing pipeline for a queue client, according to one embodiment. A queue client 750 may receive messages from a queue service 710 and perform various operations to execute or otherwise implement the messages. In one embodiment, the queue client 750 may be used in conjunction with the distributed strict queue system 100. The queue client 750 may be correspond to any of the queue consumers 160A-160N discussed above. The queue service 710 may correspond to the queue service 110 discussed above.
The queue client 750 may comprise one or more computing devices, any of which may be implemented by the example computing device 3000 illustrated in FIG. 10. In various embodiments, portions of the functionality of the queue client 750 may be provided by the same computing device or by any suitable number of different computing devices. If any of the components of the queue client 750 are implemented using different computing devices, then the components and their respective computing devices may be communicatively coupled, e.g., via a network. Each of the illustrated components may represent any combination of software and hardware usable to perform their respective functions. In some embodiments, the queue client 750 may be implemented as one or more virtual compute instances and/or physical compute instances. It is contemplated that the queue client 750 may include additional components not shown, fewer components than shown, or different combinations, configurations, or quantities of the components shown.
The queue service 710 may maintain one or more logical queues such as logical queue 721A and logical queue 721B. Each logical queue may use a first-in, first-out (FIFO) data structure to store one or more messages associated with a particular value for a strict order parameter. For example, the logical queue 721A may store message 722A and message 722B through message 722N having one value for the strict order parameter, and the logical queue 721B may store message 723A and message 723B through message 723N having another value for the strict order parameter. The messages may represent tasks or requests to be executed or otherwise implemented using appropriate computing resources. For example, a message may describe or reference one or more instructions to be executed or interpreted using source data from one or more indicated data sources and/or storing results in one or more indicated data destinations.
In one embodiment, the queue service 710 may include functionality to estimate a time (i.e., a duration of time) to process one of the messages. Processing a message may include performing or implementing the one or more tasks described in the message. For messages with the same value for the strict order parameter, the processing stage may have a strictness guarantee such that the queue service 710 is expected to perform the processing of the messages in a particular predetermined order. The queue service 710 may also include functionality to estimate a time (i.e., a duration of time) to pre-process one of the messages. Pre-processing a message may include any part of the message computation for which strict ordering between different messages is not required. For example, pre-processing a message may sometimes include performing one or more tasks to prepare the message for processing, such as fetching or otherwise loading the data described in the message as input for the processing stage. When pre-processing a message includes fetching data, the elements of input data may be acquired from any appropriate source(s), such as local storage locations, remote storage locations, and/or other servers in a distributed system.
In one embodiment, the pre-processing and processing time estimates may be configured at the queue level, such that the same estimates may generally be applied to all the messages in the queue by default, but the queue-level estimates may be overridden for particular messages in a queue. In one embodiment, each message may have its own respective time estimates. Therefore, the queue service may store the pre-processing and processing time estimates per queue 730A and/or per message 730B. Any suitable techniques may be used to determine the estimates. In one embodiment, the time estimates may be determined based on a user-specified configuration per message and/or per queue. In one embodiment, information usable to determine the estimates may be supplied by the queue producer using any suitable interface presented by the queue service 710. For example, a message size parameter may be supplied by the queue producer on a message-by-message basis. The message size parameter may be an integer for which smaller values tend to indicate a shorter processing time and for which larger values tend to indicate a longer processing time. In one embodiment, the queue service 710 may be configured to programmatically estimate the pre-processing and/or processing times based on analysis of performance of the queue client 750 over time. For example, the queue service 710 may programmatically determine a relationship between the message size parameter and processing time for various processed messages, and the queue service 710 may programmatically determine a relationship between the message size parameter and pre-processing time for various processed messages. In this manner, the queue service 710 may generate better estimates for the pre-processing and/or processing times of subsequent messages based on the determined relationships between the message size parameter and the pre-processing and/or processing times for prior messages.
The queue client 750 may receive a sequence of messages from the queue service and process the messages. In one embodiment, the queue client 750 may pull messages 725 from the queue service 710. The client 750 may pull messages 725 from one or more of the logical queues 721A and 721B by sending one or more requests 724 for one or more additional messages to the queue service 710 or by otherwise initiating the pulling of messages from the queue service. In one embodiment, the queue service 710 may push messages 726 to the queue client 750. Messages 726 may be pushed to the queue client 750 periodically based on an analysis of the queue client's health by the queue service 710. The queue client 750 may send to the queue service 710 an indication of the client's health at appropriate points in time. For example, the queue client 750 may send a health indication upon receipt of a message from the queue service 710. In general, the health indication for a queue client 750 may comprise any data usable by the queue service 710 to determine whether to send additional messages 726 to the queue client, how many messages 726 to send to the queue client, and/or how many logical queues to assign to the queue client. For example, the health indication may tend to indicate the load at the client. Based on one or more of the health indications received over time, the queue service 710 may perform a rebalancing of the assignment of logical queues to the queue client 750 and one or more additional queue clients. The queue service 710 may also determine that a particular queue client is unnecessary if the other queue clients are able to handle the strict queue load; consequently, the queue service may reassign any logical queues to the other clients and may instruct the queue client considered unnecessary to enter a sleep state, thereby reducing the queue client's traffic with the queue service
The queue client 750 may also receive the time estimates 730 for pre-processing and processing each message. The time estimates 730 for each message may be received along with the message on a message-by-message basis, i.e., in a bundle along with the body of the message. In one embodiment, relevant per-queue time estimates 730A or relevant per-message time estimates 730B may be sent by the queue service 710 for each individual message.
Based on the pre-processing and processing time estimates 730, the queue client 750 may implement a pipeline for pre-processing and processing the messages 721. Using the pipeline, the queue client 750 may begin pre-processing one message while continuing to process an earlier message. In other words, the queue client may concurrently process one message and pre-process another message. In one embodiment, the queue client 750 may include functionality for message pre-processing 770 and functionality for message processing 780. The message processor 780 may be configured to perform the tasks described in the message, e.g., by executing or interpreting instructions and/or invoking functions or services included in the body of the message. In one embodiment, the message pre-processor 770 may be configured to perform any tasks that may be used to prepare a message for processing, such as fetching or otherwise loading the data described in the message as input for the processing stage. In general, however, the pre-processing stage may include any computation for which a strict order guarantee is not required. For consecutive messages with different values for the strict order identifier, both pre-processing and processing may be performed concurrently. For consecutive messages with the same value for the strict order identifier, the pre-processing of the second message may sometimes be performed concurrently with the processing of the first message.
The queue client 750 may include a scheduler component 760. In one embodiment, the scheduler 760 may schedule the receipt and/or pre-processing of the next message based on the estimated time to process the current message and estimated time to pre-process the next message. For example, if the estimated time to process the current message is 2.0 seconds, and the estimated time to pre-process the next message is 0.3 seconds, then the scheduler may cause the queue client 750 to begin pre-processing the next message after the current message has been processing for 1.7 seconds. As a result, the next message may be fully pre-processed and ready for processing near the time when the processing of the current message is complete. Using the pipeline in this manner, the queue client 750 may perform all or part of the pre-processing for a particular message by the time the client is ready to initiate the processing of the message. In one embodiment, however, the pre-processing of the next message may be initiated at substantially any point in time during the processing of the current message, even if the pre-processing is likely to finish before the processing of the current message or after the processing of the current message.
When a message is first received by the queue client 750 from the queue service 710, the scheduler 760 may receive and analyze the message. At different stages during the pre-processing and processing of the message, the queue service 710 may use different flags to indicate the status of the message. For example, the message may be flagged as “prepared” when sent to the queue client 750 and as “locked” when processing begins. The message may be deleted from the queue (or flagged for deletion) when the queue service 710 is informed by the queue client 750 that processing is complete.
FIG. 8 illustrates an example system environment for a pre-processing and processing pipeline for a queue client with heartbeat functionality, according to one embodiment. In one embodiment, the queue service 710 may include a timeout determination functionality 740. The timeout determination functionality 740 may use the estimates for processing time to determine a timeout duration for a message. The timeout duration may be calculated in any suitable manner, e.g., as the estimated processing time plus an additional time or as a multiplier (e.g., 1.5x) of the estimated processing time. The queue service 710 may consider a message delivered to the queue client 750 to have failed if the client does not confirm the completion of the processing within the timeout duration. In one embodiment, the queue client 750 may request additional time to complete the processing of a message. The timeout determination functionality 740 may be configured to extend the timeout duration based on the receipt of such a request. In this manner, a timeout may be prevented or delayed.
In one embodiment, the queue client 750 may include a heartbeat indicator functionality 790. Using the heartbeat indicator functionality 790, the queue client 750 may send one or more heartbeat indications 791 at appropriate intervals. In one embodiment, the health indications discussed above may be communicated using the same or similar modules. In one embodiment, the heartbeat indication(s) 791 may include data usable by the queue service 710 to determine the load at the queue client 750. Using the heartbeat indication(s) 791 for multiple queue clients, the queue service may decide to put one or more of the clients to sleep if the heartbeats indicate that there are too many active clients for the current load represented by the queue(s).
FIG. 9 is a flowchart illustrating a method for implementing a pre-processing and processing pipeline for a queue client, according to one embodiment. As shown in 905, the queue client may receive, e.g., from a queue service, data indicative of an estimated time to pre-process a first message and data indicative of an estimated time to process the first message. As shown in 910, the queue client may initiate processing of the first message. As shown in 915, the queue client may also receive, e.g., from the queue service, data indicative of an estimated time to pre-process a second message and data indicative of an estimated time to process the second message.
As shown in 920, the queue client may initiate pre-processing of the second message during the processing of the first message. The pre-processing may comprise fetching data described in the second message or any other computation associated with the second message that is not required to be performed in a strict order with respect to the processing of the first message. The pre-processing of the second message may be scheduled to begin based on the estimated time to process the first message and the estimated time to pre-process the second message. In one embodiment, the pre-processing of the second message may be scheduled to be completed by the end of the processing of the first message based on the estimated time to process the first message and the estimated time to pre-process the second message. In one embodiment, the operation shown in 920 may be performed during the processing of the first message based on analysis of the strict order parameters for the first and second messages.
As shown in 925, the queue client may initiate processing of the second message. In one embodiment, the processing of the second message may use any of the results generated from the pre-processing of the second message. The processing of the second message may be initiated after the processing of the first message is completed. In this manner, the queue client may implement a pipeline for pre-processing and processing consecutive messages in a queue. The queue client may also send a status of the processing of any of the messages to the queue service, e.g., after the processing of the message is complete.
Illustrative Computer System
In at least some embodiments, a computer system that implements a portion or all of one or more of the technologies described herein may include a general-purpose computer system that includes or is configured to access one or more computer-readable media. FIG. 10 illustrates such a general-purpose computing device 3000. In the illustrated embodiment, computing device 3000 includes one or more processors 3010 coupled to a system memory 3020 via an input/output (I/O) interface 3030. Computing device 3000 further includes a network interface 3040 coupled to I/O interface 3030.
In various embodiments, computing device 3000 may be a uniprocessor system including one processor 3010 or a multiprocessor system including several processors 3010 (e.g., two, four, eight, or another suitable number). Processors 3010 may include any suitable processors capable of executing instructions. For example, in various embodiments, processors 3010 may be general-purpose or embedded processors implementing any of a variety of instruction set architectures (ISAs), such as the x86, PowerPC, SPARC, or MIPS ISAs, or any other suitable ISA. In multiprocessor systems, each of processors 3010 may commonly, but not necessarily, implement the same ISA.
System memory 3020 may be configured to store program instructions and data accessible by processor(s) 3010. In various embodiments, system memory 3020 may be implemented using any suitable memory technology, such as static random access memory (SRAM), synchronous dynamic RAM (SDRAM), nonvolatile/Flash-type memory, or any other type of memory. In the illustrated embodiment, program instructions and data implementing one or more desired functions, such as those methods, techniques, and data described above, are shown stored within system memory 3020 as code (i.e., program instructions) 3025 and data 3026.
In one embodiment, I/O interface 3030 may be configured to coordinate I/O traffic between processor 3010, system memory 3020, and any peripheral devices in the device, including network interface 3040 or other peripheral interfaces. In some embodiments, I/O interface 3030 may perform any necessary protocol, timing or other data transformations to convert data signals from one component (e.g., system memory 3020) into a format suitable for use by another component (e.g., processor 3010). In some embodiments, I/O interface 3030 may include support for devices attached through various types of peripheral buses, such as a variant of the Peripheral Component Interconnect (PCI) bus standard or the Universal Serial Bus (USB) standard, for example. In some embodiments, the function of I/O interface 3030 may be split into two or more separate components, such as a north bridge and a south bridge, for example. Also, in some embodiments some or all of the functionality of I/O interface 3030, such as an interface to system memory 3020, may be incorporated directly into processor 3010.
Network interface 3040 may be configured to allow data to be exchanged between computing device 3000 and other devices 3060 attached to a network or networks 3050, such as other computer systems or devices as illustrated in FIG. 1, for example. In various embodiments, network interface 3040 may support communication via any suitable wired or wireless general data networks, such as types of Ethernet network, for example. Additionally, network interface 3040 may support communication via telecommunications/telephony networks such as analog voice networks or digital fiber communications networks, via storage area networks such as Fibre Channel SANs, or via any other suitable type of network and/or protocol.
In some embodiments, system memory 3020 may be one embodiment of a computer-readable (i.e., computer-accessible) medium configured to store program instructions and data as described above for implementing embodiments of the corresponding methods and apparatus. However, in other embodiments, program instructions and/or data may be received, sent or stored upon different types of computer-readable media. Generally speaking, a computer-readable medium may include non-transitory storage media or memory media such as magnetic or optical media, e.g., disk or DVD/CD coupled to computing device 3000 via I/O interface 3030. A non-transitory computer-readable storage medium may also include any volatile or non-volatile media such as RAM (e.g. SDRAM, DDR SDRAM, RDRAM, SRAM, etc.), ROM, etc, that may be included in some embodiments of computing device 3000 as system memory 3020 or another type of memory. Further, a computer-readable medium may include transmission media or signals such as electrical, electromagnetic, or digital signals, conveyed via a communication medium such as a network and/or a wireless link, such as may be implemented via network interface 3040. Portions or all of multiple computing devices such as that illustrated in FIG. 10 may be used to implement the described functionality in various embodiments; for example, software components running on a variety of different devices and servers may collaborate to provide the functionality. In some embodiments, portions of the described functionality may be implemented using storage devices, network devices, or special-purpose computer systems, in addition to or instead of being implemented using general-purpose computer systems. The term “computing device,” as used herein, refers to at least all these types of devices, and is not limited to these types of devices.
Various embodiments may further include receiving, sending, or storing instructions and/or data implemented in accordance with the foregoing description upon a computer-readable medium. Generally speaking, a computer-readable medium may include storage media or memory media such as magnetic or optical media, e.g., disk or DVD/CD-ROM, volatile or non-volatile media such as RAM (e.g. SDRAM, DDR, RDRAM, SRAM, etc.), ROM, etc. In some embodiments, a computer-readable medium may also include transmission media or signals such as electrical, electromagnetic, or digital signals, conveyed via a communication medium such as network and/or a wireless link.
The various methods as illustrated in the Figures and described herein represent exemplary embodiments of methods. The methods may be implemented in software, hardware, or a combination thereof. In various of the methods, the order of the steps may be changed, and various elements may be added, reordered, combined, omitted, modified, etc. Various of the steps may be performed automatically (e.g., without being directly prompted by user input) and/or programmatically (e.g., according to program instructions).
Various modifications and changes may be made as would be obvious to a person skilled in the art having the benefit of this disclosure. It is intended to embrace all such modifications and changes and, accordingly, the above description is to be regarded in an illustrative rather than a restrictive sense.

## Claims

1. A system, comprising:
one or more computing devices configured to implement a queue client, wherein the queue client is configured to:
receive, from a queue service, data indicative of an estimated time to pre-process a first message and data indicative of an estimated time to process the first message, wherein the estimated time to pre-process the first message comprises a duration of time corresponding to performing, before processing of the first message, one or more tasks to prepare the first message for processing, and wherein the estimated time to process the first message comprises a duration of time corresponding to processing of one or more other tasks described in the first message, the one or more other tasks processed during processing of the first message;
initiate, by the queue client, processing of the first message, wherein the first message is received by the queue client from the queue service;
receive, from the queue service, data indicative of an estimated time to pre-process a second message, the pre-process of the second message to be performed during the pre-process or the process of the first message, and data indicative of an estimated time to process the second message, wherein the estimated time to pre-process the second message comprises a duration of time corresponding to performing one or more tasks to prepare the second message for processing;
initiate, by the queue client, pre-processing of the second message during the processing of the first message, and wherein the pre-processing of the second message is scheduled based on the estimated time to process the first message and the estimated time to pre-process the second message;
initiate, by the queue client, processing of the second message after the processing of the first message is completed, wherein the second message is received by the queue client from the queue service; and
send, to the queue service, data indicative of a status of the processing of the first message.

2. The system as recited in claim 1, wherein the queue client is further configured to:
send, to the queue service, one or more heartbeat indications.

3. The system as recited in claim 1, wherein the first message comprises a first value for a strict order parameter, wherein the second message comprises a second value for the strict order parameter, and wherein the first value is the same as the second value.

4. A computer-implemented method, comprising:
receiving, at a queue client from a queue service, data indicative of an estimated time to process a first message in a queue, wherein the estimated time to process the first message comprises a duration of time corresponding to processing of one or more tasks described in the first message, the one or more tasks processed during processing of the first message;
initiating, by the queue client, processing of the first message, wherein the first message is received by the queue client from the queue service;
receiving, at the queue client from the queue service, data indicative of an estimated time to pre-process a second message in the queue, the pre-process of the second message to be performed during the pre-process or the process of the first message, wherein the estimated time to pre-process the second message comprises a duration of time corresponding to performing one or more computations associated with the second message that are not required to be performed in a strict order with respect to the processing of the first message; and
initiating, by the queue client, pre-processing of the second message during the processing of the first message, wherein the pre-processing of the second message is scheduled based on the estimated time to process the first message and the estimated time to pre-process the second message.

5. The method as recited in claim 4, further comprising:
initiating processing of the second message using results of the pre-processing of the second message, wherein the processing of the second message is initiated after the processing of the first message is completed.

6. The method as recited in claim 4, further comprising:
sending, to the queue service, one or more heartbeat indications.

7. The method as recited in claim 4, wherein the first message and the second message comprise a first value for a strict order parameter.

8. The method as recited in claim 4, wherein the pre-processing of the second message is scheduled to be completed by the end of the processing of the first message based on the estimated time to process the first message and the estimated time to pre-process the second message.

9. The method as recited in claim 4, wherein a timeout for processing of the first message is determined by the queue service based on the estimated time to process the first message.

10. A system, comprising:
at least one processor;
a memory coupled to the at least one processor, wherein the memory stores program instructions, wherein the program instructions are executable by the at least one processor to:
receive, at a queue client from a queue service, an indication of an expected time to pre-process a first message in a queue and an indication of an expected time to process the first message, wherein the expected time to pre-process the first message comprises a duration of time corresponding to performing, before processing of the first message, one or more tasks to prepare the first message for processing, and wherein the expected time to process the first message comprises a duration of time corresponding to process of one or more other tasks described in the first message, the one or more other tasks processed during process of the first message;
initiate processing of the first message using the queue client, wherein the first message is received by the queue client from the queue service;
receive, at the queue client from the queue service, an indication of an expected time to pre-process a second message in the queue, the pre-process of the second message to be performed during the pre-process or the process of the first message, and an indication of an expected time to process the second message, wherein the estimated time to pre-process the second message comprises a duration of time corresponding to performing one or more tasks to prepare the second message for processing; and
initiate pre-processing of the second message using the queue client during the processing of the first message, wherein the pre-processing of the second message is scheduled based on the expected time to process the first message and the expected time to pre-process the second message.

11. The system as recited in claim 10, wherein the program instructions are executable by the at least one processor to:
initiate processing of the second message using results of the pre-processing of the second message, wherein the processing of the second message is initiated after the processing of the first message is completed.

12. The system as recited in claim 10, wherein the program instructions are executable by the at least one processor to:
send, from the queue client to the queue service, one or more heartbeat indications.

13. The system as recited in claim 10, wherein the first message and the second message comprise a first value for a strict order parameter.

14. The system as recited in claim 10, wherein the pre-processing of the second message is scheduled to be completed by the end of the processing of the first message based on the expected time to process the first message and the expected time to pre-process the second message.

15. The system as recited in claim 10, wherein a timeout for processing of the first message is determined by the queue service based on the expected time to process the first message.

16. A non-transitory, computer-readable storage medium storing program instructions computer-executable to perform:
determining an estimated time to process a first message in a queue, wherein the estimated time to process the first message comprises a duration of time corresponding to processing of one or more tasks described in the first message, the one or more other tasks processed during processing of the first message;
initiating, at a queue client, processing of the first message, wherein the first message is received from a queue service;
determining an estimated time to pre-process a second message in the queue, wherein the estimated time to pre-process the second message comprises a duration of time corresponding to performing, while pre-processing or processing the first message, one or more computations associated with the second message that are not required to be performed in a strict order with respect to the processing of the first message; and
initiating, by the queue client, pre-processing of the second message during the processing of the first message, wherein the pre-processing of the second message is scheduled based on the estimated time to process the first message and the estimated time to pre-process the second message.

17. The computer-readable storage medium as recited in claim 16, wherein the program instructions are further computer-executable to perform:
receiving, at the queue client from the queue service, the estimated time to process the first message in the queue and the estimated time to pre-process the second message in the queue.

18. The computer-readable storage medium as recited in claim 16, wherein the program instructions are further computer-executable to perform:
initiating processing of the second message using results of the pre-processing of the second message, wherein the processing of the second message is initiated after the processing of the first message is completed.

19. The computer-readable storage medium as recited in claim 16, wherein the estimated time to process the first message in the queue is determined at least in part based on a message size parameter for the first message.

20. The computer-readable storage medium as recited in claim 16, wherein the pre-processing of the second message is scheduled to be completed by the end of the processing of the first message based on the estimated time to process the first message and the estimated time to pre-process the second message.