amazon sqs (1)

2
Amazon SQS Notes By http://linuxacademy.com Default Visibility Timeout - The number of seconds that a message received from a queue will be invisible to other receiving components Message Retention Period - The amount of time that SQS will retain a message if it does not get deleted. Delivery Delay - The amount of time to delay the first delivery of all the messages added to the queue Receive Message Wait Time - The maximum amount of time that a long polling receive call will wait for a message to become available before returning an empty response. SQS guarantees delivery but not the order at which messages are delivered. You can only delete a message with a message receipt SQS is great for creating distributed systems. SQS Key Features: Redundant infrastructure - Stores messages in a distributed fashion across many servers. SQS guarantees delivery of the message to the queue but does not guarantee the order at which is is delivered. Configure settings on a per queue basis o Messages can be up to 256KB in size. o You can store longer messages in s3 or simple db with a related queue attached. Delay queues o Set a delay in which all messages are postponed for the duration of the delay. "at least once delivery" o Not commonly, but sometimes a message can be duplicated on multiple servers causing the message to appear more than once. Amazon SQS thus guarantees at least delivery of at least ONE message but does not limit it to only one. It is the job of you code to understand if it has already been processed. "Message order " o SQS attempts to keep your messages in order but due to the distributed nature of the service it is not guaranteed "Short polling" o (the default polling for a new queue) when you request messages from a queue, since messages live on on multiple severs the request will be based on weighted random distribution as to what subset of servers it connects to, not all messages might be on that server. Thus you might only receive "some" of the message in your overall queue for each request. Amazon SQS polls the queue making multiple requests for the messages using the Short polling method. (SQS samples several servers

Upload: riteshaladdin

Post on 05-Nov-2015

219 views

Category:

Documents


3 download

DESCRIPTION

Amazon Sqs (1)

TRANSCRIPT

  • Amazon SQS Notes Byhttp://linuxacademy.com

    Default Visibility Timeout - The number of seconds that a message received from a queue will be invisible to other receiving componentsMessage Retention Period - The amount of time that SQS will retain a message if it does not get deleted.Delivery Delay - The amount of time to delay the first delivery of all the messages added to the queueReceive Message Wait Time - The maximum amount of time that a long polling receive call will wait for a message to become available before returning an empty response.

    SQS guarantees delivery but not the order at which messages are delivered. You can only delete a message with a message receipt SQS is great for creating distributed systems.

    SQS Key Features: Redundant infrastructure - Stores messages in a distributed fashion across

    many servers. SQS guarantees delivery of the message to the queue but does not guarantee the order at which is is delivered.

    Configure settings on a per queue basiso Messages can be up to 256KB in size. o You can store longer messages in s3 or simple db with a related queue

    attached. Delay queues

    o Set a delay in which all messages are postponed for the duration of the delay.

    "at least once delivery" o Not commonly, but sometimes a message can be duplicated on multiple

    servers causing the message to appear more than once. Amazon SQS thus guarantees at least delivery of at least ONE message but does not limit it to only one. It is the job of you code to understand if it has already been processed.

    "Message order " o SQS attempts to keep your messages in order but due to the distributed

    nature of the service it is not guaranteed "Short polling"

    o (the default polling for a new queue) when you request messages from a queue, since messages live on on multiple severs the request will be based on weighted random distribution as to what subset of servers it connects to, not all messages might be on that server. Thus you might only receive "some" of the message in your overall queue for each request. Amazon SQS polls the queue making multiple requests for the messages using the Short polling method. (SQS samples several servers

  • then returns those messages) basically querying ies to see if any message are available to include in a response, long polling will query ALL the servers.

    "Long Polling" o (benefit is reduction of number of empty responses) Long polling allows

    SQS service to wait until a message is available in the queue before sending a response. So as long as the connection does not timeout the response will contain at least one of the available messages (if any) and up to the maxim number requested.

    o Reducing number of empty responses will reduce cost since you are charged for requests on aws.

    queue_url o URL of the queue needed in your code to refer to the SQS queue

    message id o System- assigned message id that amazon SQS returns to you in the

    send message response. This is useful for identifying messages and which messages have already been processed by your application.

    receipt handle o Each time you receive a message you receive a receipt handle. The last

    receipt handle from the most recent request is needed in order to delete the message from the queue.

    o Your code needs to delete the message from the queue when it has been processed.

    o After a message is received it is not removed from the queue but other parts of your system are prevented from seeing it and processing it again through the visibility timeout, which is a period of time during which amazon sqs prevents other consuming components from receiving and processing that message. You do not have to have timeout and your message can be immediately available to other parts of your system.

    message timer o Determines the number of seconds the message is not visible to the

    consumers in the queue. Default is 0 seconds.

    Talking Points Integration into SNS