スポンサーリンク


概要

  • さくらのレンタルサーバと、さくらのVPSでGDの処理時間を比較する。
  • 結果、さくらのレンタルサーバの方が処理時間が短かった。

実験内容

  • さくらのレンタルサーバと、さくらのVPSに実験用のPHPコードを置き、処理時間を比較する。
  • 実験に使用したPHP
    • 参考(というかそのまま) http://symfoware.blog68.fc2.com/blog-entry-1579.html
      <?php
      function do_resize() {
         // 縦横、1600pxに収まるように縮小したい
         $width = 1600;
         $height = 1600;
         //JPEGファイルを読み込む
         $image = ImageCreateFromJPEG('sample.jpg');
         // 元画像のファイルサイズを取得
         $original_width = ImageSx($image);
         $original_height = ImageSy($image);
         //元画像の比率を計算し、高さを設定
         $proportion = $original_width / $original_height;
         $height = $width / $proportion;
              
         //高さが幅より大きい場合は、高さを幅に合わせ、横幅を縮小
         if($proportion < 1){
             $height = $width;
             $width = $width * $proportion;
         }
         $new_image = ImageCreateTrueColor($width, $height); // 画像作成
         // 元画像から再サンプリング
         ImageCopyResampled($new_image, $image,0,0,0,0,$width,$height,$original_width,$original_height);
         // 保存
         ImageJpeg( $new_image , 'result.jpg' , 80 );
      }
      $time_start = microtime(true);
      for ($i = 0; $i < 100; $i++) {
         do_resize();
      }
      $timelimit = microtime(true) - $time_start;
      echo $timelimit . " seconds\n";
      ?>
  • 画像ファイル

結果

さくらのレンタルサーバ スタンダードさくらのVPSさくらのVPS
ゾーン石狩第1ゾーン石狩第1ゾーン
メモリ18GB2 GB32 GB
ディスク100GBSSD 50 GBSSD 800 GB
CPUIntel Xeon E312xx (Sandy Bridge)仮想3コア仮想10コア
OSFreeBSD 9.1-RELEASE-p24 amd64CentOS 6 x86_64CentOS 6 x86_64
Apache2.2.292.2.152.2.15
PHP5.3.295.3.35.3.3
TEST1回目(秒)89.42103.30110.01
TEST2回目(秒)90.95104.67115.78
TEST3回目(秒)88.45106.59115.69
TEST4回目(秒)89.86105.25112.57
TEST5回目(秒)89.84103.35100.50
平均89.71104.63110.91

結論

  • VPSより共用サーバの方が早い。
  • 仮想3コアと仮想10コアを比較すると、今回の結果では仮想3コアの方が早かった。

Total:3624 / Today:1 / Yesterday:1


スポンサーリンク


添付ファイル: filesample.jpg 2208件 [詳細]

トップ   差分 バックアップ リロード   一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2015-10-19 (月) 22:39:42