Webpage in IIS is slow - iis-8.5

I have a PHP page(website hosted in IIS 8.5) which is loading very slow, it takes more than 15 seconds to load.
It connects to a remote SQL server and display the result of the query, i tried executing the query in SQL Management studio and the results are returned within 1 second.
The same page(copied the file) from a different webserver is loading very fast(<1 sec).
I enabled Request Tracing in IIS for the website and when i looked at the results, the time taken for the response is 11000 msec, but the total ms as per the tracing steps is <100 msec.
I dont know where the webpage or IIS is blocked for many seconds before sending the result to client.

Related

ASP.NET Core 6 Web API: long waiting before WCF calls

I have an ASP.NET Core 6 Web API which will call WCF on the same server, but different site hosting on IIS.
I now have an issue that when I call WCF (I have tested WCF using SoapUI with same settings too, the result is normal and don't have this issue), I found a long waiting before the call to the WCF service. I have traced the current connections counter in performance monitor and found it like the image below:
I use SoapUI Load Test for testing this, with 50 threads settings at once and runs 2 per thread in SoapUI, and I get this chart for the current connections counter. And the chart is the same as the SoapUI percentage, in the long waiting the percentage keeps 0% and in the peaks the percentage goes up. The response time of the load test leads to nearly 30 seconds due to this long waiting.

Random requests to Laravel app take too long and get 504 Nginx error code

My Laravel app randomly (average 1-3 in 9000 requests) get 504 Nginx Gateway Time-out errors in various Livewire API calls (various components as well). Sometimes request gets "stuck" even when just logging in.
Whole app's interface is Livewire heavy, so most of "stuck" requests happen in them, but, to my understanding, 504 error shouldn't be front-end (Livewire) related. I only have basic knowledge about servers, so I'm not sure if that's the case.
App is hosted on Cloudways. After opening a ticket, they just changed request Execution limit to 3600 sec and Memory limit to 2048 MB, but nothing changed, because failing requests where not that memory demanding in the first place. Later they disabled Varnish, but it didn't help as well. After that they said that server is fully optimized and are not looking for a problem anymore. They will try changing server settings only if I name which ones to change.
While testing, I run a script which adds and removes 1 charater in a customer Search Bar so I'm always making same 2 queries. What I found out:
Most of Responses are fast, but sometimes same Request (same query
and everything) takes 3+ min. or even longer and gets "504 Nginx"
code.
Laravel Debugbar shows, that app took only 41.13 ms (used 6 MB) to run that Request, and received it i.e. at 2022-05-16 16:38:51. But browser shows "Requested on 2022-05-16 16:35:24". And it's true because I've waited for that simple response for 3 min. 44 s.
When "stuck", same request can be lost for different durations, can be 1 min. can be 15 min., but the moment I make another Request from different Livewire component both new and old (that was "stuck") instantly get responses.
[Probably Livewire feature] While waiting for response, livewire
tracks all of changes in searchbar and after response or 504 error,
sends request with an array called "payload" which has all of the
recorded changes, sometimes hundreds of items (if I didn't stop the
while request was "stuck")
I haven't encountered this issue on my local machine while using Laravel Valet.
Server services (Cloudways don't show much):
Apache
Memchaced
Mysql
Ngnix
PHP FPM
Redis
Varnish (disabled)
Basic info:
PHP 8.0
mariaDB 10.4
Laravel v9.4.1
Livewire v2.10.4
Available settings (also not much):
EXECUTION LIMIT 300 sec
MEMORY LIMIT 1024MB
PHP
MAX INPUT VARIABLES 12500
MAX INPUT TIME 299 sec
OPCACHE Memory 254MB
XDEBUG disabled
NGINX
STATIC CACHE EXPIRY 525600min.
TLS Versions 1.2, 1.3
Can it still be Livewire's problem? What should I try changing in the server settings?
Before trying to migrate to another hosting provider, I'd like to try fixing it.

Ajax-calls: big differences between server runtime and client waiting time

I have two REST endpoints driving some navigation in a web site. Both create nearly the same response, but one gets its data straight from the db whereas the other has to ask a search engine (solr) first to get some data and then do the db calls.
If i profile both endpoints via JProfiler i get a higher runtime (approx. 60%) for the second one (about 31ms vs. 53ms). That's as expected.
Profile result:
If i view the same ajax calls from the client side i get a very different picture.
The faster of the both calls takes about 146 ms waiting and network time
The slower of the both calls takes about 1.4 seconds waiting and network
Frontend timing is measured via chrome developer tools. The server is a tomcat 7.0.30 running in STS 3.2. Client and server live on the same system, db and solr are external so there should be no network latency between tomcat and the browser. As a side note: The faster response has the bigger payload (2.6 vs 4.5 kb).
I have no idea why the slower of the both calls takes about 60% more server time but in sum nearly 1000% more "frontend time".
The question is: Is there any way i can figure out where this timing differences originate?
By default, the CPU views in JProfiler show times in the "Runnable" thread state. If a thread reads data from a socket connection or waits for some condition, that time is not included in the "Runnable" thread state.
In the upper right corner of the CPU views there is a thread state selector. If you change that to "All states", you will get times that you can compare with the wall clock times from the browser.

ASP.Net Web Api initial requests are taking too long

Initial requests are taking 3-5 seconds, subsequent calls takes < 500 milliseconds. Service makes a light weight stored proc call and there is no latency found when we profile it.
This service does not hit very frequently and Idle Time-out of the Process model is 20 minutes (default). We tried to hit it every 19 minutes but no change.
Service running under IIS 7.5 with .Net framework 4.5
The first request for an ASP.NET website always takes some time because the code needs to be compiled. You can install a module for IIS that automatically makes that initial request so you don't get that slowdown yourself.
http://www.iis.net/downloads/microsoft/application-initialization

Why is the latency of my GAE app serving static files so high?

I was checking the performance of my Go application on GAE, and I thought that the response time for a static file was quite high (183ms). Is it? Why is it? What can I do about it?
64.103.25.105 - - [07/Feb/2013:04:10:03 -0800] "GET /css/bootstrap-responsive.css
HTTP/1.1" 200 21752 - "Go http package" "example.com" ms=183 cpu_ms=0
"Regular" 200 ms seems on the high side of things for static files. I serve a static version of the same "bootstrap-responsive.css" from my application and I can see two types of answer times:
50-100ms (most of the time)
150-500ms (sometimes)
Since I have a ping roundtrip of more or less 50ms to google app engine, it seems the file is usually served within 50ms or so.
I would guess the 150-300ms response time is related to google app engine frontend server being "cold cached". I presumed that retrieving the file from some persistent storage, involves higher latencies than if it is in the frontend server cache.
I also assume that you can hit various frontend servers and get sporadic higher latencies.
Lastly, the overall perceived latency from a browser should be closely approximated by:
(tc)ping round trip + tcp/http queuing/buffering at the frontend server + file serving application time (as seen in your google app logs) + time to transfer the file.
If the frontend server is not overloaded and the file is small, the latency should be close to ping + serving time.
In my case, 50ms (ping) + 35ms (serving) = 85ms, is quite close to what I see in my browser 95ms.
Finally, If your app is serving a lot of requests, they maybe get queued, introducing a delay that is not "visible" in the application logs.
For a comparison I tested a site using tools.pingdom.com
Pingdom reported a Load time of 218ms
Here was the result from the logs:
2013-02-11 22:28:26.773 /stylesheets/bootstrap.min.css 200 35ms 45kb
Another test resulting in 238ms from Pingdom and 2ms in the logs.
Therefore, I would say that your 183ms seems relatively good. There are so many factors at play:
Your location to the server
Is the server that is serving the resource overloaded?
You could try serving the files using a Go instance instead of App Engine's static file server. I tested this some time ago, the results were occasionally faster, but the speeds were less consistent. Response time also increased under load, due to App Engine Instance being Limited to 10 Concurrent Requests. Not to mention you will be billed for the instance time.
Edit:
For a comparison to other Cloud / CDN providers see Cedexis's - Free Country Reports
You should try setting caching on static files.

Resources