google-spdy-protocol
SPDY (speedy) เป็น networking protocol สำหรับเวปที่ถูกพัฒนาโดย Google เพื่อช่วยลดเวลาการโหลดหน้าเวปและเพิ่มความปลอดภัยให้กับเวป SPDY กำลังถูกพลักดันให้เป็น standard protocol และในปัจจุบันก็เป็น Internet Draft เป็นที่เรียบร้อยแล้ว สำหรับ browser ที่รองรับการทำงานในตอนนี้ก็มี Google Chrome และ Mozilla Firefox

ข้อดีของ SPDY (speedy):

  • web server และ browser สามารถ compress HTTP headers เพื่อช่วยลดการส่งข้อมูล
  • ถ้าหากเรียกใช้งานทรัพยากรหลายตัวสามารถรวมการเรียกใช้ให้เป็น 1 TCP connection เพื่อช่วยลด connections บน network
  • Browser สามารถขอแหล่งข้อมูลหน้าทั้งหมดในครั้งเดียว ซึ่งจะช่วยลดจำนวนรอบการรับส่งข้อมูลระหว่าง web server และ browser

การ config ให้ Apache web server รองรับการทำงาน SPDY protocol

  1. Apche ต้องรันแบบ Worker MPM ตัวอย่างเช่น รันด้วย mod_fcgid
  2. Install Apache webserver, mod_ssl และ openssl:
    [shell][root@ezylinux ~]# yum install httpd mod_ssl openssl[/shell]
  3. เนื่องจาก SPDY protocol ใช้ https ในการทำงาน ดังนั้นเราจึงต้องสร้าง certificate ขึ้นมาเพื่อให้รองรับการทำงานแบบ https (ไม่สามารถทำงานแบบ http ได้)
      • สร้าง private key:
        [shell][root@ezylinux ~]# openssl genrsa -out ca.key 1024[/shell]
      • สร้าง CSR:
        [shell][root@ezylinux ~]# openssl req -new -key ca.key -out ca.csr[/shell]
      • สร้าง Self Signed Key:
        [shell][root@ezylinux ~]# openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt[/shell]
      • Copy ไฟล์ทั้งหมดไปไว้ที่ /etc/http/ssl
        [shell][root@ezylinux ~]# cp ca.crt /etc/http/ssl
        [root@ezylinux ~]# cp ca.key /etc/http/ssl/ca.key
        [root@ezylinux ~]# cp ca.csr /etc/http/ssl/ca.csr[/shell]
      • สร้าง virtual host ให้รองรับการทำงานแบบ https
        [shell]
        ServerAdmin [email protected]
        DocumentRoot /var/www/ezylinux.com
        ServerName www.ezylinux.com
        ErrorLog logs/ezylinux.com-errorlog
        CustomLog logs/ezylinux.com-accesslog combined

        SSLEngine on
        SSLProtocol all -SSLv2
        SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
        SSLCertificateFile /etc/http/ssl/ca.crt
        SSLCertificateKeyFile /etc/http/ssl/ca.key</pre>
        </li>
        </ul>
        </ul>
        <ul>[/shell]

    • Download SPDY (mod_spdy) ด้วยคำสั่ง
      • SPDY (mod_spdy) สำหรับ 32bit:
        [shell][root@ezylinux ~]# wget https://dl-ssl.google.com/dl/linux/direct/mod-spdy-beta_current_i386.rpm[/shell]
      • SPDY (mod_spdy) สำหรับ 64bit:
        [shell][root@ezylinux ~]# wget https://dl-ssl.google.com/dl/linux/direct/mod-spdy-beta_current_x86_64.rpm[/shell]
    • Install mod-spdy for Apache
      [shell][root@ezylinux ~]# yum install –nogpgcheck mod-spdy-beta_current_x86_64.rpm[/shell]
    • ทำการตรวจสอบความถูกต้องของ config ด้วยคำสั่ง
      [shell][root@ezylinux ~]# /etc/init.d/httpd configtest[/shell]
    • Restart apache service ด้วยคำสั่ง
      [shell][root@ezylinux ~]# /etc/init.d/httpd restart[/shell]

การทดสอบ SPDY ว่า apache server ได้เปิดให้ใช้งาน SPDY หรือยัง ให้เปิด Chrome และเข้าไปที่

[text]chrome://net-internals/#spdy[/text]

Video ทดสอบ speed ของ https กับ SPDY (mod_spdy)