Site is very slow only the first request - performance

When browsing "http://dev.bindsolution.com/" the site takes too long to begin processing. Why this?
Are using "CSS Sprites", "css" and "JavaScript" minify although I do not think the problem is this.
Why the first request the site is extremely slow?
PS: I'm visiting from Brazil

When you first request the site after publishing, ASP.Net needs to compile and load the application.

It depends on what do you mean by first request.. Is it first request after an application (or app pool) has been redeployed/restarted, the very first request to your application is slow could be that IIS has to start the asp.net worker process.
also this link should provide you with more details: http://msdn.microsoft.com/en-us/library/ms366723.aspx
if you mean first request by any user well then there is an overhead on the files that needs to be downloaded by the user, also the site might be doing some process intensive stuff in Session_start, I would check all these..
Also if you have access to the code you could probably run some performance analysis on the same. I would highly recommend dotTrace by JetBrains.
FYI, I am no way associated with JetBrains. Just love their sw/tools

It could be that the first load is slow and subsequent loads are quicker because assets (js, css, images ) are cached for subsequent views and don't need to be loaded.
The firefox plugin yslow will give you a detailed breakdown on the sizes and loading speeds.
Also run smush.it ( part of yslow ) to shrink your image sizes. It will make the images smaller but there will be no noticeable difference.

IIS may have shut down some worker threads which need to be started, your appDomain will be starting and loading all classes from your dlls and JITing these to machine code, ASP.Net will also be doing it's own warmup (initialising all things required in the pipeline, possibly pre-compiling some views etc).
Update
The first request is slow because of the number of resources that the page has to load, once loaded, the browser will cache them do they will not need to be requested again (which is why there's the speed improvement).
Consider aggregating (and possibly compressing) all required resources on your own site, and referencing those in your pages.

Related

Website randomly loads slowly every once in a while

I have a laravel website which is running on apache2 and it's running on multiple servers for multiple clients. There is only one web server where the website loads slowly. Now it's not loading slowly on every page load, it randomly loads slowly. Also after loading a page, that has loaded quickly, if you leave the site for say 5 minutes and begin to navigate to another page, the page loads slowly yet again.
Not sure if in fact it's apache that causes the slowness of the site, or if it's a third party plugin because as the page is loading it mentions m.stripe.com is loading and then on another page load, it could be another plugin loading.
Are there any tools that I can use to decipher this issue.
It is very difficult to answer why a Laravel website is slower. There are many reasons behind a slower Laravel application. You have to debug and take decisions where you need to improve in your application. Here a list I focus on when I develop an application.
Database
How may database query load on each page? you have to ensure any recursive query not exist. Make efficient data cache. Check queries takes a little time to execute.
Network Connection
If you are using different network connections with your Redis, database, queue then make sure those connections are well optimized and taking a little time to connect and serve data.
Cache Files
Make Cache you blade HTML files, routers, config files, and optimize those cache. Also, reduct autoloads services as much as possible.
Optimize your Images
Optimize your images. I recommend not to use local files. try to use a cloud service.
Minify CSS and JS file
You should minify your CSS and js files. and try to use libraries from CDN.
Use Queue
Use queue where possible like email send, PDF Generate...
Found that there where 2 A name records with different IP adresses for the same domain. I would have thought some error would have been raised by apache because of this, but it randomly selected the ip to serve the site and of course long load times for the ip that does not exist.
Minify your HTML, CSS, and Javascript. it's a great way to increase page spread. Depending on the IDE you use, you could install a minifier extension, use webpack to bundle your code, or use an online minifier like https://fixcode.org/minify
Use a CDN to load static files like scripts, images, and style sheet. you could also load all of your site via a CDN
you could also consider lazy loading parts of your script. especially in cases where you compile scripts with webpack

Server response time - Drupal on Bluehost

In the past, when I checked the site speed in google page speed or many similar tools, the site got very high scores (good css & js optimize). I installed the Advanced CSS/JS Aggregation module and boost module to get high score.
Then, suddenly, I started to get message on the google page speed (and other tools), saying my server response time is slow - around 3 seconds.
My site built with Drupal 7 and hosted on Bluehost Shared hosting.
Bluehost technical support says that the problem is not in their side
What do you think causing the server to be slow?
How can I fix it?
Or at least, what should I check (images, caching, something else)?
The first thing to figure out is what's a desirable response time. For example, if you have lots of modules and pretty heavy site/homepage then maybe 3 seconds is ok unless something is done to change the processing time(caching, using less modules etc).
Back to your case of where should i check:
Check, your homepage and what views and other things are loading for your homepage to be rendered. Then make a list and go one by one to ask:
Is it optimal/can it be improved? maybe something is throwing the caching out(dynamic parameters be injected by each request for the item etc).
If you're using views, enable the sql view to see what sql statements its using and you can use tools to analyze/improve it(this could be a question by itself)
Look at the modules that load/being used to make sure you need them.
Check on the drupal caching(/admin/config/development/performance) and make sure the correct checkboxes are checked.
This could as well be blue host's problem because if they're hosting so many sites on the server, the server will start kicking some sites out of memory and load them back as they're requested by the visitors hence the slow load(server requests the site, drupal loads it from database etc).
You can ask specific questions after you check those.

Very high page load times?

I have a Drupal site built on a shared host and I'm finding that the site is very slow to respond. I susepect it's the host and not my Drupal/database configurations but I don't know how to decipher the results from Pingdom.
I have also read Explanation of Pingdom Results but am unsure of how to resolve my problems.
Pingdom results show a Load Time of 60 seconds.
Performance Grade tab shows results of all items at or near 100.
According to the Page Analysis tab, most of the time is spent on the Wait state.
Does the above indicate a problem with my hosting or perhaps domain name provider or is there something that I can do to improve performance of my website?
I should also mention that I've used other tools like Google's Page Speed Chrome plugin and Firefox's Yslow plugin and both give an above average rating to my webpages which leads me to believe it's an issue with my host.
Drupal has this issues of abusing database queries especially if you use a lot of modules on one page and do not cache anything. That may slow down your site considerably. I use Pressflow Drupal`s profile to reduce some load times I also ad Varnish to server (you can look at Memcache too) I also add Boost module to the site itself. But the most important thing is to get query per page load number right. If have written some custom code optimize it. Look for ways to get same data without sending queries to the server maybe some data was already loaded to the page and you do not need tome queries.
In your particular case I think that some lose loop which does not end but has safety trigger which kills it after certain amount of time. I can bet that the reason is somewhere in your custom code or some underdeveloped module. Try to enable display of all the error.
P.S. Example of such page would be the best way determine what is wrong.

include static resources like images, css, js etc in tests

I´ve recently started using JMeter to create load tests for my web applications. I really like the tool, and after watching some videos it was really easy to get started with creating tests.
There´s however one thing that I´m not clear about.
Reading on the JMeter homepage, there´s a "Best practice" section. Among other things, it says:
The most important thing to do is filter out all requests you aren't interested in. For instance, there's no point in recording image requests (JMeter can be instructed to download all images on a page - see HTTP Request ). These will just clutter your test plan.
I´ve seen this on other pages aswell, saying that you shouldn´t include requests for images or any other static resources in your tests. However I´ve still not been able to find a single page which gives a good explanation as to WHY you shoudn´t include static resources.
Sure, JMeter isn´t a browser, but requests for static resources would no doubt affect performance of your application? Can someone please give me a good explanation :-)
It all depends on what you are trying to test.
In general, there are two types of performance test I do with JMeter: specific tests, where I look at things that I'm worried about, and "safety net" tests, where I measure the entire application to make sure it does indeed work the way I expect it to.
Specific tests nearly always deal with the dynamic aspects of the web application - the server-side code (.aspx, .php, .jsp etc.). This is where most applications have their bottlenecks - the effort to run a server-side script is many, many times higher than the effort to retrieve a CSS file from disk and serve it up to the browser without any additional processing. If I'm testing the server-side scripts, I don't want to also load the assets - because they clutter up the tests, and consume bandwidth at the test client end. I don't want my tests to fail because my JMeter server is downloading a 5MB video file on each thread and consuming all the bandwidth, when what I'm actually trying to do is see how many logins per second the server can support.
There's very little point in testing your webserver's ability to serve static files - Microsoft, the Apache team, whoever, have already done a brilliant job at that; unless you have a very specific concern, there are better ways to spend your testing budget.
Safety net tests put the whole thing together to prove that it all really does work the way I expect it. Usually, I run these on a production(like) environment, so I have a CDN, production-grade hardware, and the "live" application config. I usually employ a cloud-based testing service for this, so I can see performance from different locations, and generate enough load to stress production-grade kit. You could use JMeter for this (and there are a couple of JMeter Cloud services I've used in the past). It's expensive, it may require downtime, and you should only do it as a safety net.
When you want to do a proper performance test (especially a stress test), where you need to produce your application's response time as a function of number of users/threads in time, you need to include all static resources, just as jMeter Proxy saved them when you recorded your test.
To take browser cache into account you can either use HTTP Cache Manager or Once Only controller, so that each thread only downloads static stuff once, with their first request.
HTTP Cache Manager is the recommended way to go and much easier to set up, simply include it in your test, as the first child of a thread group.
Once Only controller is regularly used when you need to log-in users only on their first request.
BTW parametrization of non-static HTTP Requests is recommended, you won't e.g. search for the same product name or e.g. buy the same book every time, that's usually the starting point which can give you a general idea of performance efficiency of you app.
Hope this helps...
Unless your app is used by casual visitors who only look at one page and then go, there is a good chance that the static resources are being downloaded once, and then served from the browser cache.
Moreover, although static resources affect the bandwidth and the overall response time for the user, they should have a small impact on the server load, and they might not be the kind of thing that you want to measure.
I guess you need to try mimicking what actual, real users would do with the application.

Please Help Me Troubleshoot Why My Site Is Loading So Slowly

My website is http://secretpassagesbooks.com/. It runs on the latest version of wordpress and is hosted via GoDaddy on a shared web server.
My website takes at anywhere from ten seconds to one minute to load, and I don't understand why. I have tested in IE, FireFox, and Chrome, and the page speed is the same. I performed several speed tests at various online speed test sites and have an average load time of 5 - 6 seconds. Yet when I click on a link to my URL or enter it directly it takes in excess of 30 seconds (sometimes more than a minute) to load the index page.
Here is what I have done so far to troubleshoot the issue:
I have the YSlow and Page Speed extensions installed in Firebug
Yslow test gives me a "Grade A -Overall performance score 90"
My Page Speed a score is 94/100
I have the W3Cache wordpress plugin installed and am using page, browser, and database object caching
I've tried minimizing as much CSS and JavaScript as possible
The site is using HTTP compression
Is there anything more I can do with this design, or is it case of my shared web server being overloaded? Thanks in advance for all your help.
YSlow, etc detect problems in the HTML, Javascript and CSS parts, and these are probably OK. It looks like your hosting is to blame.
If those plug-in results are correct (and I've no reason to doubt they are), then it's most likely a case of your virtual server simply being overloaded.
I presume you have no such issues running an identical site in a "local" production environment either, although you might want to try this to confirm if you've not already done this.
Incidentally, a tale-tell sign of an overloaded VPS/shared hosting solution is if the first page load is incredibly slow, but subsequent loads are "normal" - a common reason being that your "decicated" sandbox is being awoken from a sleep/low resource state. (This also seems to be the case as far as your site is concerned.) As such, it's possible (I don't know the details of this server, such as whether you have a "guaranteed" resource level for CPU, memory, etc.) that other sites on this particular server are using more than their fair share of bandwidth until your site kicks in.
Based on some tests from a tool that I built (The Performance Grader at JoomlaPerformance.com), wow is it bad...
Notice that the HTML took approximately 21.83 seconds to download (from the initial request, to the last object being downloaded). Not to mention that the page is nearly 300kb (which is fairly large for only having 7 images)...
This is where the issue is. Notice that the connection and DNS phases are fine, but the generation phase is really REALLY slow. That's where your problems are. It's server-side. So, you need to debug why it's slow. Some areas to look at are the SQL queries that are being executed (and if they are slow), any slow plugins, etc. Try disabling things one at a time to see if each makes a measurable difference or not.
My "hunch" is that your database is either overloaded, or your queries are very expensive. So in short, you can try another host to see if that helps (which is the solution more than you'd think)...
As most of you pointed out, the issue seemed to be with the server. I contacted GoDaddy and explained the situation. It turns out that my site was hosted on one of their legacy servers and was most likely overloaded. They switched me over to one of their grid servers (no cost) and now everything is loading quickly. Thanks for all the responses. I spent a lot of time tweaking the design, removing plugins one by one, reducing as many HTTP requests as possible, and generally went crazy trying figure out how to best optimize my site. After a few days and a lot of tests, I could not accept that the problem was client-side, especially after all the optimization test I ran showed my site was ok. So good to have it settled...for now, at least.
GoDaddy's webhosting is the bottleneck to your website, you should probably go for a VPS if you have got an advanced website with loads of lookups!

Resources