response of request hangs and resolves after awhile - postgresql

i have an issue with a backend service in a microservice architecture using Kubernetes.
sometimes when i make a request to the service on postman or frontend, it will hang for very long until it timeouts whether the request is a big or small one, and this behaviour will last for a minute or so before it auto resolves and requests respond at normal speeds.
my team is figuring what the problem is. we suspect the source of the problem could come from Kubernetes or postgresql.
hope if someone has some insight into this. tq!

Related

Asynchronous request-reply design in Flutter web

I'm building a web application using Flutter, and I have some requests that take a lot of time in server side, and "hold" http resources until the requests are answered.
To deal with this I read you can do polling or other solutions (see here).
What is the correct design in flutter? How would you implement it in flutter?
I have some requests that take a lot of time, and "hold" http
resources until the requests are answered
Sounds like you are using a synchronous approach, where your program sits and wait until the responses comes back. Instead, try using an asynchronous approach, that will allow your program to continue to run while you wait for the responses to come back.
I know nothing about Dart or Flutter, but these should help get you started:
https://dart.dev/codelabs/async-await
https://medium.com/flutterdevs/exploring-asynchronous-programming-in-dart-flutter-25f341af32f
Update in response to OP's comment
If you have long-running tasks happening on the server, and you need to get the data back to a web-client then async HTTP requests are a legitimate architecture based on what you have explained so far.
If processing is blocked then maybe there's possibly an issue with you implementation. Alternatively there might be issues between the browser and client (issues with a proxy server, etc), so check for those types of issues.
If you need another option altogether then websockets might be worth looking into.

Getting timeouts constantly when sending RESTRequests to server

I am sending requests (post and get) with Delphi's TRESTClient and TRESTRequest to a webserver. Said server is being developed by someone else.
When sending requests to the API I am getting timeouts seemingly randomly and often.
The strange thing is that this only seems to be happening when making the requests with Delphi. When using a fresh, empty project and just placing the components the timeouts still occur. When using Postman no timeouts occur, even if I send the requests as fast as possible (I thought at first that maybe too many requests were sent too quickly, but I cannot replicate this behavior in Postman and I sometimes get timeouts even on the first request sent).
Since searching the internet didn't turn up anything about it I am at a loss.
Has anyone ever experienced something like this? If not, how could I move forward to find the cause of the problem?
Edit: The problem has returned and I was able to narrow it down a bit more:
When sending a post request, the request is getting processed by the webserver, but I get a timeout on the client side waiting for a response. The dev working on the server is looking into it on his end.
Strangely a similar thing happens with post requests expecting a response to a different server, which makes me think that the problem is on my end after all (especially considering Postman is working fine)

Excessive number of TaskCanceledExceptions

I've just started looking at Service Fabric, and was hoping someone could help with a problem I am having.
We have started noticing an excessive number of TaskCanceledExceptions being thrown back to RunAsync. This seems to be caused by Service Fabric setting the cancellation token which was passed into RunAsync.
I understand there are legitimate reasons for Service Fabric setting the token, like if the service is restarted, or the primary is demoted, but we are seeing hundreds of thousands in some months (and hardly any in others).
My questions are:
What scenarios could cause the setting of large numbers of cancellation tokens?
SF must log the reason it cancelled a given token. Where does Service Fabric log this kind of information?

Akka Cluster application

I'm trying to gather a bit of knowledge on using an Akka Cluster application for an ETL style application.
I've read through most of the documentation and I'm now looking on moving forward with writing the actual application so I'm here to see if anyone has worked on something before and has any recommendations.
The ETL will need to able to schedule and throttle HTTP requests to a variety of endpoints. I would like to find a way to publish the statistics of the application (response times from endpoints, overall time in the application, and collect errors).
The application should be autoscaled so that when the amount of scheduled requests is increasing over time the Akka Cluster will add nodes to respond to the influx of work.
I was thinking that each scheduled request would produce a UUID to track the work (identifying results and errors that happen). So after the external endpoints respond or don't the results could be placed on a Akka Stream that would post process the requests as part of the T and the L of the application.
If there are good patterns out there or anyone can make a recommendation I would greatly appreciate it.
Cheers!
Take a look at kamon.io -- it's a library to provide metrics and tracing through a variety of technologies, and has an Akka tracing component. From the little I've worked with it, starting a trace requires just one method call.

Socket has timed out

We are trying to access our web-app (through web server, IHS). When we use http we are fine ;https protocol is working as it submits the requests, however we observe Socket Time Out Exception continuously after some requests have been processed. Thereafter the request processing resumes again. We have tested the application with quite large concurrent load using https earlier; but in this case we are not sure why we are getting this error.
Oh boy, this can be due to thousands of different things. I would suggest a layer analysis approach starting off by the Web Server logs, you need to make sure the requests are reaching your web server and what is happening to the ones dictating a time out, you could be facing anything from network latency to a resource bounded host, contention or who knows, it all depends on your application's design.
Start off by checking out the network layer. Maybe if you provide some more information I can help you out.
Also check out http and https time out configurations on your web server.