0

I'm using a simple node.js script to send a message to a service bus. It suddenly seems to have slowed down to the point where a single operation is taking 16 seconds.

Anyone have any thoughts on that? I can't seem to find anything on Azure that would help me understand why that't the case, so any pointers greatly appreciated.

Outline code for test script below.

const azure = require('azure');
const azureConnectionString = 'Endpoint=...';
const queue = 'myqueue';
const serviceBusService = azure.createServiceBusService(azureConnectionString);

let customProperties = {
    "property1":"test property"
}

sendMessage(customProperties);


function sendMessage(customProperties) {
    if (customProperties) {
        let queuemessage = {};
        queuemessage.body = "body";
        queuemessage.customProperties = customProperties;
        console.time("sendMessage");
        serviceBusService.sendQueueMessage(queue, queuemessage, function (error) {
            if (!error) {
                console.timeEnd("sendMessage");
            } else {
                console.log(error);
            }
        })
    } else {
        console.log('service bus request missing parameters');
    }
}
Thomas
  • 24,234
  • 6
  • 81
  • 125
Darren
  • 1,071
  • 1
  • 15
  • 39
  • Is the code running in Azure or on premise? – Don Lockhart Aug 22 '16 at 13:20
  • On my laptop on premise for testing. Actual code is on Azure. – Darren Aug 22 '16 at 13:21
  • Can you try setting the [ConnectivityMode](https://msdn.microsoft.com/en-us/library/microsoft.servicebus.connectivitymode.aspx) to HTTPS? – Don Lockhart Aug 22 '16 at 13:37
  • I tried that using serviceBusService.ConnectivityMode = 'Https' but I'm not sure if that's right or supported based on the link you sent? Didn't seem to make a difference... Currently taking between 20-30 seconds to send now... – Darren Aug 22 '16 at 13:45
  • Yeah, that link was for .NET - I did not find the JavaScript equivalent. The point of setting the property is to avoid probing for the TCP ports. When I have code running on premise, ports other than 80/443 are blocked. The probe takes about 25 seconds before falling back to HTTP. Hence, setting the mode explicitly avoids that delay. – Don Lockhart Aug 22 '16 at 14:02
  • Thanks. I'm not sure if I did it right, and I don't see any entries for connectivityMode in any of the js files I looked through in the azure module, so I don't think it's supported. I can see why that might make a difference though... – Darren Aug 22 '16 at 19:42
  • Could you please make sure that your test environment is in the same region with your Service Bus? It could be the internet issue. Or could you please try to deploy your test script to Azure, and check the latency? Any update, please feel free to let me know. – Gary Liu Aug 25 '16 at 07:14

0 Answers0