WebPageTestには、回線速度を切り替えてsitespeedを測る機能があります。
この回線速度の差が、どの程度sitespeedに影響を与えるのか 同一画面を 3GFast と、FIOS の双方で測り、比較してみました。
結果を以下に記載します。


比較する動機

記事を書きながら一瞬冷静になると、「一体俺は何をやっているんだろう」という気持ちになりますが、比較したい動機は以下になります。

  1. サイトの速度改善の際は、施策の影響がわかりやすい遅い回線で測りたい。

  2. 遅い回線の結果のみだと、実際のユーザーが体験している環境、実際に個人で使用している回線速度とは乖離がある。

  3. サーバーリソース等の関係上、遅い回線、速い回線での比較を全ての画面に対して行うのが難しい場合がある。

  4. 一部の画面をサンプリングして、速度差を算出しておき、「普通の回線だと、どれくらい改善しているの?」 という質問に回答できるようにする。


WebPageTest で選択できる回線速度について

RESTful APIs - WebPagetest Documentationには以下、記載があります。

  • DSL - 1.5 Mbps down, 384 Kbps up, 50 ms first-hop RTT, 0% packet loss
  • Cable - 5 Mbps down, 1 Mbps up, 28ms first-hop RTT, 0% packet loss
  • FIOS - 20 Mbps down, 5 Mbps up, 4 ms first-hop RTT, 0% packet loss (not all locations will get the full bandwidth)
  • Dial - 49 Kbps down, 30 Kbps up, 120 ms first-hop RTT, 0% packet loss
  • 3G - 1.6 Mbps down, 768 Kbps up, 300 ms first-hop RTT, 0% packet loss
  • 3GFast - 1.6 Mbps down, 768 Kbps up, 150 ms first-hop RTT, 0% packet loss
  • Native - No synthetic traffic shaping applied
  • custom - Custom profile, bandwidth and latency must also be specified using the bwIn, bwOut, latency and plr parameters

Mbps とは何かがよくわからなったので、調べてみましたが、Wikipediaが個人的にはわかりやすいかと思いました。
ビット毎秒 - Wikipedia
3GFast は、2010年代前半まで使われていたスマートフォンの回線速度、FIOS は光回線の無線LAN接続あたりの回線速度かと思います。


現在接続中の回線速度を測る

以下のサイトで接続中の回線速度を測ることができます。


自分の環境の回線速度を測った結果

  • 下り
    13.73 Mbs

  • 上り
    30.14 Mbs

FIOS よりも、遅いという結果になります。1


比較方法

比較方法は以下の通りです。

  1. 2018/03/01日 から、2018/03/13日 まで、3画面の3GFast回線での速度、FIOS回線での速度を計測。

  2. 1. の計測結果をTSV化、Pandas で読み込み、基本統計量 を算出。平均値を元に比較。

APIの指定パラメータについて

測定にはDataStudioとGASでWebPagetestの計測結果をグラフ化する | mediba Creator × Engineer Blog に掲載されているGAS を拝借して測定しています。 指定パラメータは以下となります。

  • FIOS回線での指定パラメータ

    var g_WPT_REQUEST_PARAM = {
        k: g_WPT_API_KEY,
        video: 1,
        f: 'json',
        mobile: 0,
        runs: 1,
        fvonly: 1,
        // FIOS > 20 Mbps down, 5 Mbps up, 4 ms first-hop RTT, 0% packet loss (not all locations will get the full bandwidth)
        location: 'ec2-ap-northeast-1.FIOS',
        mobileDevice: ''
    };
    

  • 3GFast 回線での指定パラメータ

    var g_WPT_REQUEST_PARAM = {
        k: g_WPT_API_KEY,
        video: 1,
        f: 'json',
        mobile: 0,
        runs: 1,
        fvonly: 1,
        location: 'ec2-ap-northeast-1.3GFast',
        mobileDevice: ''
    };
    

比較する

インプットとしたTSVはgistにUPしました。
WebPagetest の同一画面を 回線速度 3GFast FIOS で 測定した結果 を TSVにした

python3.6 -m pip install pandas   

import pandas as pd

# 基本統計量を算出して返す
def calc_describe(url):
    dataframe = pd.read_table(url) 
    # 欠損値を含む行を削除
    dataframe = dataframe.dropna(how='any')
    # 日付カラムを削除
    del dataframe['date']
    # 基本統計量算出
    return dataframe.describe()    

aboutページの結果比較

# aboutページの3GFast回線の結果の読み込み、基本統計量算出
about_3gfast = calc_describe("https://gist.githubusercontent.com/kemsakurai/3a211ddd211948452de1613f82543eed/raw/9c936600c2534a25a32baa64f9f9cc526a691e2f/about_3GFast.tsv")

# aboutページのFIOS回線の結果の読み込み、基本統計量算出
about_fios = calc_describe("https://gist.githubusercontent.com/kemsakurai/3a211ddd211948452de1613f82543eed/raw/9c936600c2534a25a32baa64f9f9cc526a691e2f/about_FIOS.tsv")

# 3gfast の統計量を fios の統計量で割る
about_3gfast / about_fios
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
SpeedIndex TTFB domInteractive firstPaint domContentLoadedEventStart
count 2.000000 2.000000 2.000000 2.000000 2.000000
mean 3.936292 4.096074 3.391063 2.602626 3.390611
std 2.145486 0.988315 1.030183 1.133197 1.030104
min 3.224658 10.866667 8.047619 4.337143 8.047619
25% 4.528433 11.205479 4.931818 3.594000 4.931818
50% 4.260512 5.550595 4.309013 3.195046 4.313305
75% 3.787075 2.906994 2.983289 2.124768 2.975333
max 1.750501 1.565939 1.494501 1.789960 1.494501

Blog記事ページの結果比較

# blog記事ページの3GFast回線の結果の読み込み、基本統計量算出
blog_content_3gfast = calc_describe("https://gist.github.com/kemsakurai/3a211ddd211948452de1613f82543eed/raw/9c936600c2534a25a32baa64f9f9cc526a691e2f/blogContent_3GFast.tsv")

# blog記事のFIOS回線の結果の読み込み、基本統計量算出
blog_content_fios = calc_describe("https://gist.github.com/kemsakurai/3a211ddd211948452de1613f82543eed/raw/9c936600c2534a25a32baa64f9f9cc526a691e2f/blogContent_FIOS.tsv")

# 3gfast の統計量を fios の統計量で割る
blog_content_3gfast / blog_content_fios
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
SpeedIndex TTFB domInteractive firstPaint domContentLoadedEventStart
count 1.959732 1.959732 1.959732 1.959732 1.959732
mean 2.055841 2.405646 2.460823 1.299255 2.460426
std 0.985670 0.539615 0.543047 0.847286 0.543025
min 1.943709 10.403226 8.755556 2.321782 8.755556
25% 2.407710 10.271605 6.673986 1.643052 6.673986
50% 2.161184 2.832344 3.021739 1.400000 3.021739
75% 2.252902 2.206633 2.356736 1.332877 2.356736
max 1.771239 1.069644 1.111176 1.753156 1.111176
# topページの3GFast回線の結果の読み込み、基本統計量算出
top_3gfast = calc_describe("https://gist.github.com/kemsakurai/3a211ddd211948452de1613f82543eed/raw/9c936600c2534a25a32baa64f9f9cc526a691e2f/top_3GFast.tsv")

# topページのFIOS回線の結果の読み込み、基本統計量算出
top_fios = calc_describe("https://gist.github.com/kemsakurai/3a211ddd211948452de1613f82543eed/raw/9c936600c2534a25a32baa64f9f9cc526a691e2f/top_FIOS.tsv")

# 3gfast の統計量を fios の統計量で割る
top_3gfast / top_fios
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
SpeedIndex TTFB domInteractive firstPaint domContentLoadedEventStart
count 1.951389 1.951389 1.951389 1.951389 1.951389
mean 1.814808 2.270119 1.855093 1.510263 1.855023
std 1.047281 0.676279 0.602291 1.032938 0.602208
min 2.021703 9.054795 8.312500 3.441748 8.322917
25% 1.907104 2.791541 2.695597 1.656394 2.695597
50% 1.970000 2.656635 2.139887 1.635065 2.139887
75% 1.943917 2.255826 1.800218 1.546398 1.798258
max 1.460391 1.085439 1.268943 1.484353 1.268943

結果からわかること、感想

結果からわかること、感想を以下に記載します。

  • 当たり前だが、回線速度が速い方が、ページ速度は速い。
  • ページ間のばらつきは大きい。個人的にはばらつかないと思っていた。推測よりも計測。
  • Aboutページが、3GFast回線下で遅い、回線の影響を受けやすいページになっている。SpeedIndex が、Topページよりも遅いので、広告が原因の気がする。 PCで計測しているので、回線の割りに大きな画像の広告が配信されている?
  • firstPaint は、回線の影響を受けにくい。 コンテンツの1バイト目が届いてしまえばそこからの転送は速いのかもしれない。
  • 20Mbps / 1.6Mbps = 12.5倍 ほどの回線による速度差はない。(理論上の20Mbps は実際の速度として出ていない?)

「普通の回線だと、どれくらい改善しているの?」 という質問に対する個人的な回答についてです。
もっとも速度差が大きいAboutの結果から、 「3.5倍程度の速度となります。(ので、そこまで改善されたとはいえない)」と回答を返そうかなと思います。
理由は、遅めに回答しておけば、通常回線下ではそれよりも速くなる場合があり、「結果としては予想よりも大きな改善がありました」とか言えるかなと考えました。

以上です。


  1. FIOS での実際の回線速度を測ることはできないので、あくまで理論上の話かと思います。 

コメント