Current time: 04-20-2019, 02:18 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Website loads fast, but it can be faster
02-26-2012, 09:58 PM
Post: #1
Website loads fast, but it can be faster
Hello to everybody,

This is my first post here at webpagetest, my name is Avi, I work as a linux system administrator, and i'm running few websites and right now i'm working on optimize them.

One of my websites is knan.co.il, this is my web business card,

I combined css to one file, also the js is one file, I also combined few jpg to css sprites, but still, the website is not fast enough.

I ran 2 tests, one with "KeepAlive On" and one with "KeepAlive Off", I also created a video to compare between the tests(the left window is with "KeepAlive Off").

I noticed that on both of the tests the ttfb is bit high, and the website load faster when KeepAlive setting is set to off.

Knan.co.il is running on HP DL360, with Raid5, on 25/25mbit connection, the tests was made with no load avarage and no i/o wait.

Also, apache is compiled with prefork engine:
StartServers 2
MinSpareServers 3
MaxSpareServers 3
ServerLimit 192
MaxClients 192
MaxRequestsPerChild 1000

How can i reduce the ttfb and the slower loading with KeepAlive On?

Thanks in advence,
Avi.
Find all posts by this user
Quote this message in a reply
02-27-2012, 09:10 PM
Post: #2
RE: Website loads fast, but it can be faster
Does your server have enough memory ? If so the first I would do is increase the MinSpareServers (and thus MaxSpareServers).

You mentioned this server has no load avarage or i/o wait, so I guess you mean very low.

But how many visitors do you have ? Do you have a lot of visitors on your site ? If the site is mostly static files, load avarage and i/o wait would be low.

Check the number of httpd or apache processes and the number of established connections to port 80 with netstat. If those are all low numbers when testing, then I'm not sure what the cause is.

KeepAlive is a good thing, it should help with getting images,css and so on faster to the browser.

The problem is, if you have Apache and a busy server a tradeoff might need to be made as there are Apache processes which are doing nothing but keeping memory occupied.

In that case maybe you have packet loss which delays the existing connections from working ?
Visit this user's website Find all posts by this user
Quote this message in a reply
02-27-2012, 09:35 PM (This post was last modified: 02-27-2012 09:46 PM by Marvin.)
Post: #3
RE: Website loads fast, but it can be faster
Hi Avi,

The site loads fast! Congrats!

Try to reduce the number of HTTP requests by:

- eliminating some images (could you live without images # 9, 10, 12, 13, perhaps substitute images #9 & 10 with css since they are just dots and a horizontal line)

- combining similar-colored images into CSS sprites (example, images # 5, 7, and 14)

P.S. Your favicon.ico is 13.3 kb(!), see if you can make it smaller (under 1kb would be nice)

Marvin
Find all posts by this user
Quote this message in a reply
02-28-2012, 12:01 AM (This post was last modified: 02-28-2012 12:01 AM by pmeenan.)
Post: #4
RE: Website loads fast, but it can be faster
Apache and keep-alive were the bane of my existence. The clients in Apache are quite heavy (well, depending on how you configure it but the default of a new client process per connection is). My guess is that you are running out of clients - you should be able to see it in the apache stats if you graph them.

The way I usually solve it is I put a nginx reverse-proxy in front of the apache server (on the same box) and let nginx handle the connections and apache behaves just like when keep-alive is disabled (make sure you have the max number of file descriptors tuned too).

Even better is to move to nginx completely but the proxy method is easier if you rely on .htaccess rules or other apache-specific behavior. One thing to watch out for is the IP address of the client becomes 127.0.0.1 so you usually want to add an X-Forwarded-For header in your nginx rules and make sure to use that on the apache side.

If you don't want to go quite that far, a bandaid you can apply would be to lower the keep-alive time to 1 second from the default of 10. That will buy you more headroom and still benefit the clients but it won't solve the core issue.
Visit this user's website Find all posts by this user
Quote this message in a reply
02-28-2012, 12:24 AM (This post was last modified: 02-28-2012 01:08 AM by Avi Keinan.)
Post: #5
RE: Website loads fast, but it can be faster
Thanks for the fast comments Big Grin

I ran another 3 tests, with "KeepAlive On", to check if something else is the reason for the high ttfb:
One test as standart test.
One test with fw monitor and fw rules turned off.
One test with iptables set to off.

Regarding MinSpareServers:
The server has 3gb of free memory, but few month ago, when the MinSpareServers/Max was 70-110, the ttfb was higher.

I also ran another few tests right now, and tried diffrent settings and ttfb is just higher.

Regarding Css sprites:
I'm working on it, and i will update when it will be completed.

Thanks,
Avi.
Hi, pmeenan,

I know the option of reverse proxy with nginx (I also installed it for a lot of my clients), but replacing apache with nginx is not an option at this moment, we are using directadmin for server managment, also reverse proxy causing higher ttfb for dynamic content.

We don't hit the MaxClient limit, we use nginx for all the static content for the rest of the websites on this server.

Also, there is nginx installed on this server for serving thumbnails.
I tried to load all the images/css/js from nginx, but the results was long time than loading everything from 1 domain.

   

Now i see that the ttfb on nginx is also high, i attached a screenshot of the static content loads from nginx on another website on the same server (I cant publish the results test).

In couple of hours I will check the raid configuration, it might be the reason for the high ttfb.

Avi.
Find all posts by this user
Quote this message in a reply
03-07-2012, 04:59 AM
Post: #6
Sad can you help me
hi my friends,
:scan you help me? i confused completely ,this site is not very fast and i dont know why?
i control whole item for fast load but isnt very fast,
can you see and check it?
http://www.OstadeIT.com
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)