1

I used OpenAPI Generator to generate a C# client for the Thingsboard REST API. I then used this client to build an application for automatically creating devices and writing telemetry data into Thingsboard.

When I work from home and connect to my company network via a VPN, my application works just fine and is reasonably fast. However, when I work on site I noticed that every single http request towards Thingsboard (hosted on a VM in our company network) takes literally forever (up to 30 seconds) and I have no idea, why. It does not matter which API function or endpoint I call, they are all slow.

I already debugged this to the point where I can say for sure that the delay is caused somewhere inside this function call which is implemented in RestSharp.RestClient:

response = await client.ExecuteAsync<T>(req, cancellationToken).ConfigureAwait(false);

As this is deep inside the auto generated client code, I don't really know how to debug this any further. One important thing I noticed is that this problem is 100% limited to the application itself, and not to my whole system/connection. For example, when I call the API via Postman or directly in my browser, it works just fine and I get a response within less than 1 second.

What could be causing this problem and how can I debug it further?

Chris
  • 1,417
  • 4
  • 21
  • 53
  • 1
    An application like Fiddler or Wireshark might help you to see the actual network traffic going back and forth and determine exactly what is slowing you down compared to what happens in postman? – Paddy Jun 30 '22 at 10:29
  • have you tried using Postman or the browser from within the VM ? use `Fiddler` from inside the VM to debug the ongoing traffic, and see the requests between fiddler itself (composer) and the application. – iSR5 Jun 30 '22 at 10:32
  • 30 seconds is a security software delay. – Hans Passant Jun 30 '22 at 10:34
  • @iSR5 From within which VM do you mean? As I said, when I use Postman or the browser on my own machine, it works perfectly fine already, but when I run the application on my own machine, it becomes really slow when I am currently on site. I don't really understand how it would help me in this situation to test the connection from within the VM where the server is running. – Chris Jun 30 '22 at 11:14

1 Answers1

-2

It Depend on the where server location is. If it's in your office it will give fast Response. If Server is in one country and you are in another country it will give slow response

Upender Reddy
  • 568
  • 3
  • 8
  • That might be correct in general, but in my case it actually becomes slower (up to 30 seconds) per request when I am closer to the physical location of the server (e.g. in the same network and even in the same building). – Chris Jun 30 '22 at 11:12
  • check no of sight's hosting on that particular server and storage Remain in C Drive. based on no of request to the server, it's data base, background jobs running in it, If there is cursors return in any procedure if that particular table is using it may depends – Upender Reddy Jun 30 '22 at 11:42
  • try to add (nolock) after table eg: select * from Tablename(nolock) – Upender Reddy Jun 30 '22 at 11:43