Skip to content

Performance: LS 1.3.0/1.3.1/1.4.0 SQS performance (receiving/deleting) is degraded comparing to 1.2.0 #7342

@a-wi

Description

@a-wi

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

SQS operations with LocalStack 1.3.0 are much slower comparing to 1.2.0 - 5-10% for sending messages, ~2.5 times for receiving and deleting.

image

image

image

Expected Behavior

Performance of SQS operations for LS 1.3.0 should be at least as good as for 1.2.0.

How are you starting LocalStack?

With a docker run command

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

docker run -p 4566:4566 --rm -e SERVICES=sqs -e EAGER_SERVICE_LOADING=1 localstack/localstack:1.3.0

Code snippet to check SQS performance

static async Task TestSQS(int numMsgs)
{
    Stopwatch stopWatch = new();

    using (AmazonSQSClient SQS = new("ignore", "ignore", new AmazonSQSConfig { ServiceURL = "http://localhost:4566" }))
    {
        // Create a queue.
        CreateQueueResponse createQueueResp = await SQS.CreateQueueAsync($"testQueue_{Guid.NewGuid()}");
        string msgText = new('x', 100);
        ReceiveMessageRequest receiveMessageReq = new(createQueueResp.QueueUrl)
        {
            WaitTimeSeconds = 5,
            MaxNumberOfMessages = 10
        };

        // Send messages
        Console.WriteLine($"Sending {numMsgs} messages...");
        Task[] sentMsgs = new Task[numMsgs];
        stopWatch.Restart();
        for (int i = 0; i < numMsgs; i++)
        {
            sentMsgs[i] = SQS.SendMessageAsync(createQueueResp.QueueUrl, msgText);
        }
        await Task.WhenAll(sentMsgs);
        stopWatch.Stop();
        Console.WriteLine($"Num. messages={numMsgs}  Sending time={stopWatch.ElapsedMilliseconds:F0} ms");

        // Process (receive/delete) messages
        Console.WriteLine($"Processing {numMsgs} messages...");
        Stopwatch stopWatchRcv = new();
        Stopwatch stopWatchDel = new();
        int msgCount = 0;
        stopWatch.Restart();
        while (msgCount < numMsgs)
        {
            stopWatchRcv.Start();
            receiveMessageResp = await SQS.ReceiveMessageAsync(receiveMessageReq);
            stopWatchRcv.Stop();
            stopWatchDel.Start();
            foreach (Amazon.SQS.Model.Message msg in receiveMessageResp.Messages)
            {
                await SQS.DeleteMessageAsync(createQueueResp.QueueUrl, msg.ReceiptHandle);
            }
            stopWatchDel.Stop();
            msgCount += receiveMessageResp.Messages.Count;
        }
        stopWatch.Stop();
        Console.WriteLine($"Num. messages={msgCount}  Processing time={stopWatch.ElapsedMilliseconds:F0} ms  (Receiving={stopWatchRcv.ElapsedMilliseconds:F0} ms Deleting={stopWatchDel.ElapsedMilliseconds:F0} ms)");

        await SQS.DeleteQueueAsync(createQueueResp.QueueUrl);
    }
}

Environment

- OS: Win 10
- LocalStack: 1.3.0
- AWS SDK SQS 3.7.100.36 / .NET 6

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions