Tech geek. Life geek.

Tag: Keycdn

CDN compare: Azure vs Cloudfront vs BelugaCDN

It is a test of the speed from CDN Edge servers to the multi-locations. It is very important the signal for the real experience of the users.

Let me see how I implement the tests.

  • I created two endpoints on the Azure CDN, on Microsoft CDN and Akamai CDN.
  • I created a CloudFront distribution on Amazon CloudFront.
  • I created a CDN property on BelugaCDN.

All these four CDN settings pointed to a custom origin of one of my sites, which hosted on DigitalOcean.

The file I used for testing is a JPG file, an image file.

The testing tool is provided by KeyCDN performance tool.

I run at least two tests to make sure most of the testing server can get the JPG file from the cache of the Edge server(CDN), not back to the origin server.

 

Azure CDN: Standard Microsoft Tier

Standard Microsoft Tier CDN

 

The results are base on the 14 tests from different locations globally. I care about the TTFB much more than others.

What is TTFB

TTFB, which stands for time to first byte, is the amount of time it takes from when a client makes an HTTP request to it receiving its first byte of data from the web server. TTFB is an important aspect of website optimization since the faster the TTFB, the faster the requested resource can start being delivered to the browser.

The time to first byte is made up of three separate components.

  • The time needed to send the HTTP request
  • The time needed for the server to process the request
  • The time needed for the server to send back the first byte of the response to the client

What is a good TTFB?

The time to first byte can vary greatly depending on what sort of content you are serving (static vs dynamic), your server’s configuration, etc. Therefore determining what is a good TTFB number is difficult to answer and is variable based on your situation. However, on average anything with a TTFB under 100 ms is fantastic. Anything between 200-500 ms is standard, between 500 ms – 1 s is less than ideal and anything greater than 1 s should likely be investigated further.

As mentioned, it should be noted that these times are average benchmarks, however do not apply to all websites. Depending on the type of content and complexity of the application it may be completely unavoidable that the TTFB is greater than 1 second

Continue reading

Dirty Hack: Add CDN support into phpBB 3.1.6

It works for phpBB 3.1.x, not just phpBB 3.1.6. For a national forum or global forum, it is a must to have a CDN support.

The way I used is not a formal extension or plugin. It is a hack, actually a dirty hack. If you have no experience for it, you can close this page now.

Now, let’s start.

  1. Backup everything of your phpBB, include files and database.\
  2. URL path example.
    Forum url is http://www.myforum.com/
    CDN url is http://myforum.kxcdn.com/
  3.  Open /includes/functions.php
    add following in line 5112

    // Add CDN path
    $cdn_cache = '//myforum.kxcdn.com/';

    Find following around Line 5216

    'T_ASSETS_PATH'         => "{$web_path}assets",
    'T_THEME_PATH'         => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme',
    'T_TEMPLATE_PATH'      => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/template',
          

    Replace by

    'T_ASSETS_PATH'         => $cdn_cache."assets",
    'T_THEME_PATH'         => $cdn_cache."styles/" . rawurlencode($user->style['style_path']) . '/theme',
    'T_TEMPLATE_PATH'      => $cdn_cache."styles/" . rawurlencode($user->style['style_path']) . '/template',

    Find following around Line 5230

    'T_STYLESHEET_LINK'      => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/stylesheet.css?assets_version=' . $config['assets_version'],
    'T_STYLESHEET_LANG_LINK'    => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . '/stylesheet.css?assets_version=' . $config['assets_version'],

    Replace by

    'T_STYLESHEET_LINK'      => $cdn_cache."styles/" . rawurlencode($user->style['style_path']) . '/theme/stylesheet.css?assets_version=' . $config['assets_version'],
    'T_STYLESHEET_LANG_LINK'    => $cdn_cache."styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . '/stylesheet.css?assets_version=' . $config['assets_version'],

    Save and overwrite the original file.

  4.   Open /includes/functions_content.php
    Find following around Line 902

    return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' . $root_path . $config['smilies_path'] . '/\2 />', $text);

    Replace by

    return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' .'//forum.kxcdn.com/forum/'.$root_path. $config['smilies_path'] . '/\2 />', $text);

    Save and overwrite the old file.

  5. Then purge cache in the ACP.

Look at the waterfall chat after this hack.

cdn-phpbb-hack

The CDN service provider is KEYCDN. You can apply through this link.

© 2020 David Yin's Blog

Theme by Anders NorenUp ↑