Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Speed up your website – Part 2: Server

Thursday, July 5th, 2018 by Servage

This is the second part of a simplified explanation of the “Yahoo best practices for speeding up your web site“. Read the first part here. The second part is about server related optimization. I am aware that some settings are not available to all developers, depending on their development and deployment infrastructure.

Use Content Delivery Networks

Where possible you should take advantage of servers closer to your users than your own. TO get started quickly with some major improvements, try to load JavaScript sources like Google APIs, jQuery or similar code you might use in your project, directly from their servers, or suggested CDN.

Add expires header to utilize cache

You can gain some control over the amount of requests by telling clients that the intended content isn’t expired yet. For example by using the Apache configuration

ExpiresDefault "access plus 10 years"

The client should understand that content which hasn’t expired yet, can be read from the Cache, instead of generating a new request. If you wish to generate a new request, create a new filename (target) for the request.

Gzip components and configure ETags

Two advanced topics. Compressing content minimizes transfer times. Read more here. Using ETags helps the use of cached resources on cluster systems. Read more here.

Flush the buffer early

On busy servers you might experience that parts of the content are ready, while waiting for others. For example the files with scripts and HTML have been loaded quickly, but data from the database are slower. You can obtain a speed increase by flushing the buffer earlier, and thereby sending some of your rendered content to the client, before the entire page is ready. Between <body> and <head> is a good place to do this.

... <!-- css, js -->
</head>
<?php flush(); ?>
<body>
... <!-- content -->

Use GET for AJAX requests

For some reason AJAX GET requests are processed with less overall resources than AJAX POST requests. If possible, use GET. See more explanations here.

Speed up your website – Part 2: Server, 3.6 out of 5 based on 7 ratings
Categories: Guides & Tutorials, Tips & Tricks

Keywords:

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.