Upgrade to Pro — share decks privately, control downloads, hide ads and more …

サムネイルマスタとgo-thumber / Use thumbnail master with...

Harukasan
February 18, 2015

サムネイルマスタとgo-thumber / Use thumbnail master with go-thumber

画像変換Night / 2015-02-18

Harukasan

February 18, 2015
Tweet

More Decks by Harukasan

Other Decks in Technology

Transcript

  1. ṖίʔυͲ͏ʹ͔͍ͨ͠ // ========================================= // CMYK形式の画像をRGB形式に変換する // 劣化およびディスクI/Oによる負荷を最小限にするため // 一旦PNGに変換してからJPEGに変換する //

    ========================================= public static function cmyk2rgb($image, $tmp_name) { // Workaround for TransformImageColorspace() bug // // It means same below: // // $image->setImageColorspace(Imagick::COLORSPACE_RGB); // $image->setImageFormat('PNG'); $image->setImageCompressionQuality(75); $image->readImageBlob($image->getImageBlob()); $image->setImageFormat('JPEG'); $image->setImageCompressionQuality(100); $image->writeImage($tmp_name); }
  2. ϓϩΩγʹͳͬͯΔͷͰ؆୯ GET http://localhost:8000/w=128,h=128,q=95/upstream.example.com/example.jpg w: ੜ੒͢ΔαϜωΠϧͷ࠷େ෯ (required) h: ੜ੒͢ΔαϜωΠϧͷ࠷େߴ͞ (required) q:

    JPEG quality (default 90) u: ࢦఆαΠζΑΓখ͔ͬͨ͞ΒΞοϓεέʔϧ(Ҿ͖Ԇ͹͠)͢Δ͔Ͳ͏͔ (default 1) a: ΞεϖΫτΛΩʔϓ͢Δ͔Ͳ͏͔ (default 1) o: JPEGͷoptimizeΛߦ͏ (default 0) p: μ΢ϯαϯϓϦϯάϑΝΫλ (default 2)
  3. ϕϯνϚʔΫ • Tecnick’s public test imagesͷը૾Λ256x256pxʹॖখ͢Δ • ຊ౰͸Πϥετը૾ͷςετηοτ͕ग़དྷΔͱྑ͍͚Ͳ
 ݖརपΓ͕໘౗ •

    mod_smalllight(ImageMagickɺImlib2)ͱൺֱ • Apacheͷνϡʔχϯά͸͋Μ·͕Μ͹ͬͯͳ͍ • εέʔϦϯάσίʔυ͸༗ޮ
  4. Resize to 256x256px Benchmark (quality=99) Requests per second 0 25

    50 75 100 125 Numbers of Connections 0 1 2 3 4 5 6 7 8 9 10 smallight(imlib2) go-thumber smalllight(magick) εϧʔϓοτͷൺֱ
  5. Mean of Latency (size=256x256, quality=99) Mean of Latency (ms) 0

    50 100 150 200 Numbers of Connections 0 1 2 3 4 5 6 7 8 9 10 smalllight(magick) go-thumber smallight(imlib2) ฏۉॲཧ஗Ԇͷൺֱ
  6. ݁Ռ දࣔճ਺ બ୒͞Εͨճ਺ બ୒͞Εׂͨ߹ SMALLLIGHT(imlib2) 467 58 8.2% SMALLLIGHT(ImageMagick) 466

    275 39.3% go-thumber 467 367 52.4% • Ϣʔβʔ͕៉ྷͰ͋Δͱબ୒ͨ͠ճ਺ • go-thumberͰੜ੒͞ΕͨαϜωΠϧ͕࠷΋ଟ͘બ୒͞Εͨ