I have a windows service which I’m using to both publish and consume an Amazon SQS message. I am seeing very poor performance (approximately 10 seconds before the message arrives).
Any thoughts other than Amazon performance you could suggest me to look into ?
For the client part I’m using the following code:
var awsAccessKey = ConfigurationManager.AppSettings.Get("AwsAccessKey");
var awsSecretKey = ConfigurationManager.AppSettings.Get("AwsSecretKey");
var awsRegionEndpoint = ConfigurationManager.AppSettings.Get("AwsRegionEndpoint");
var region = RegionEndpoint.GetBySystemName(awsRegionEndpoint);
var queueUrl = ConfigurationManager.AppSettings.Get("QueueUrl");
var mqServer = new SqsMqServer(
awsAccessKey,
awsSecretKey,
region)
{ DisableBuffering = true };// Trade-off latency vs efficiency
var mqClient = mqServer.ConnectionFactory.GetClient();
var request = new Amazon.SQS.Model.SendMessageRequest();
var json = JsonSerializer.SerializeToString<T>((T)ob1);
mqClient.SendMessage(queueUrl, json);
For the Server part I’m using
public override void Configure(Funq.Container container) {
var queueProvider = ConfigurationManager.AppSettings.Get("QueueProvider");
var awsAccessKey = ConfigurationManager.AppSettings.Get("AwsAccessKey");
var awsSecretKey = ConfigurationManager.AppSettings.Get("AwsSecretKey");
var awsRegionEndpoint = ConfigurationManager.AppSettings.Get("AwsRegionEndpoint");
var region = RegionEndpoint.GetBySystemName(awsRegionEndpoint);
var queueUrl = ConfigurationManager.AppSettings.Get("QueueUrl");
container.Register<IMessageService>(c => new SqsMqServer(
awsAccessKey,
awsSecretKey,
region)
{ DisableBuffering = true });
var mqServer = container.Resolve<IMessageService>();
mqServer.RegisterHandler<InboundMessage>(ExecuteMessage);
mqServer.Start();
}
Do you have such long messages delivering in all regions or only for specific one? What is the size of the message and how do you measure delivering time (do you send and receive message on the same instance? If not and you are using logs to get the time difference are these times are same on both machines?)
I have only tested on the one region so far US-EAST-1
The message is very small, approximately a 200 byte payload
Delivering time I’m testing using a pack sender, as the process is:
UDP Message Send -> UDP Msg Receive -> Publish Message -> Consume Message, Ack Message. I intend to shift the ack, but I’m still concerned about the lack of throughput.
I am also debugging the publish and consume points in the code, and can confirm a delay of greater than 10 seconds normally.
I should mention that I am testing this off of Amazon, so I am expecting some latency, but 10 seconds appears way too much to be geographic latency driven.
in a hope to have 4 worker threads receiving these messages. If I send 3 messages I would expect a delay of 10 seconds then for 3 acks to arrive, however, I’m seeing something that appears more like a serial operation send, send, send, 10 second, ack, 10 second, ack, 10 second, ack
An update on this, delay appeared to be mostly to do with the constructor authenticating Amazon side. I created a singleton and performance improve significantly (back to being what I would expect)