Website optimization 16 experience

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

  After making a few sites, gradually realize the site open speed problem has the very big relations and front-end optimization, front-end optimization can even affect the background logic code writing! For everyone to have a look on the web site of, on this site I summed up the 15 optimization rules, we here are as follows:

  1 fewer HTTP requests: pictures, CSS, script, flash etc. These will increase the number of HTTP requests, reducing the number of these elements can reduce the response time. The multiple JS, CSS written into a file when possible, pages directly into the picture is not good practice, should be written into the CSS, using   CSS sprites  small figure spliced using background to locate.

  2 Gzip compression technology:

  1) IIS compression service:

    The first step: open IIS, HTTP compression enabled services, web site --> attribute, select a service. In the HTTP compressed selected compressed program file and compress static file box, according to need to set up a temporary directory.

    The second step: to enable WEB service

    The third step: modify the MetaBase.xml start > operation of the input c:\windows\system32\inetsrv, find the MeteBase.xml, first backup, changes in the. (some servers do not need to modify this file can be used)

  2)Apache modification

    First, open the following two modules: LoadModule headers_module modules/mod_headers. so

LoadModule deflate_module modules/mod_deflate. so

    Set the compression ratio, the range between 1---9, set too high will occupy too much resources CPU. DeflateCompressionLevel 3

    AddOutputFilter DEFLATE html xml php js css

  The 3 set of header files expired or static cache

  The browser will use a cache to reduce HTTP requests to speed up page loading time, if the page head and a long time has expired, the elements in the browser will cache page. But if the page where things change if you want to change the name, otherwise the user will not take the initiative to refresh, to see their own measure. This can be achieved by modifying the.Htaccess file.

  4 put CSS on the top, put JS at the bottom.

  5 avoid CSS expressions

  6 the JS and CSS compression, using <link> as external links

  7 avoid redirects problem, configure the server

  8 remove duplicate scripts

  9 configurations of ETags, ETags steps:

    1)The client requests a A page,

    2)The server returns the page A, and in the A and the last ETag,

    3)The client displays the page, and the page with ETag cache,

    4)The client requests page A again, and the last request the server returned ETag is passed to the server,

    5)The ETag server checks, and judge the page since the last time the client request has not been altered, direct return response 304

  10 Ajax Ajax cache, a cache, again in the next post.

  11 Ajax requests the best utility GET, because POST and server two interaction.

  12 when writing DOM, must clear logic, don't write DOM node useless.

  13 reduction in Cookie, because the cookie exchange between the server and the browser, so the expiration time setting is reasonable and the size is necessary

  14 do not scale images in HTML

  15 the size of the favicon.icon cache it, and below 1KB.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Tony at November 19, 2013 - 6:57 PM