This is my first post on cloud computing and today I want to talk about Amazon SQS i.e. Simple Queue Service. I will write more on cloud computing in upcoming posts and a quick introduction about cloud computing is also in the pipeline.
Amazon SQS offers a reliable, highly scalable, hosted queue for storing messages as they travel between computers. By using Amazon SQS, developers can simply move data between distributed components of their applications that perform different tasks, without losing messages or requiring each component to be always available. Amazon SQS supports an upper limit of 8KB for a single message in the queue. Queue length can be infinite.
So the point of this discussion is not an advertisement about Amazon SQS but the behavior of it. First when some technical person tossed a word QUEUE, the listener thinks about a FIFO behavior but Amazon SQS is far behind that. They also clear that this SQS doesn't follow a FIFO kind of service. But still some people assume this works as FIFO and build their application around this assumption. But I want to WARN those technocrats that this is a big mess of your service if you go on with this belief.
I wrote a sample program using AWSSDK in C# to see the behavior of SQS. I inserted number from 1 to 100 sequentially in to the queue and got the output as below, which is far from FIFO behavior.
for (int i = 1; i < 100; i++)
AWSHelper.SendMessage("MyQueue", i.ToString());
for (int i = 1; i < 100; i++)
{
Message msg = AWSHelper.ReceiveMessage("MyQueue", 1, 100);
Console.WriteLine(msg.Body);
AWSHelper.DeleteMessage("MyQueue", msg.ReceiptHandle);
}
Output:
7 16 9 17 4 3 10 18 24 6 1 8 20 5 2 12 14 21 37 43 28 52 38 27 30 11 15 41 32 47 25 26 55 57 39 69 73 13 34 44 42 48 77 19 50 80 58 49 63 54 64 29 85 22 95 68 67 75 59 60 23 31 35 83 33 36 45 51 93 98 61 40 84 53 74 46 81 62 56 82 65 76 87 89 99 78 66 79 70 88 92 71 72 86 90 91 94 96 97
Subscribe - To get an automatic feed of all future posts subscribe here, or to receive them via email go here and enter your email address in the box. You can also like us on facebook and follow me on Twitter @akashag1001.
I doubt, it is right way to test it.
@bhups: What point, I wanted to make, was that Amazon SQS doesn't provide you FIFO behavior. The result might vary on so many factors. You will get different output sequence on every iteration.
Amazon clearly states you will not get FIFO, doesn't matter in most distributed cases anyhow.
Additionally you can build FIFO in your application layer if required.
@Anonymous: I totally agree and mentioned the same: "They also make clear that SQS doesn't follow a FIFO kind of service."
I was just trying to clear the confusion here as I have seen many people, who assumes FIFO behavior in SQS.
I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
Mac service center in chennai | Mac service center in chennai
Good information.