การทดสอบประสิทธิภาพ Web Server ประเภท Static Page : Apache2 vs Lighttpd บนเครื่อง Ubuntu 14.04 LTS
เครื่องมือในการทดสอบ Web Server OS : Ubuntu 14.04 LTS Client OS : Windows 8.1 Software : Apache Jmeter 2.11 Environment : Web Server Ubuntu Server (Oracle VM VirtualBox) Intel Haswell 1.6GHz (2.30GHz) 4 core RAM 512G Client Windows 8.1 (Physical Notebook) Intel Haswell 1.6GHz (2.30GHz) Intel Haswell 4 core RAM 8G – รันอยู่บนเครื่องเดียวกัน – ใช้ค่า Default ไม่มีการ Tuning เพิ่มเติม วิธีการทดสอบ 1. ทำการตั้งค่า Apache ให้อยู่คนละ Port กับ Lighttpd 2. ทำการสร้าง Static Page โดยมีตำแหน่ง และ HTML Code (index.html) ดังนี้ Apache : /var/www/html/index.html สำหรับ Apache ให้ rename ไฟล์เดิมก่อนเนื่องจากมีไฟล์อยู่แล้วด้วยคำสั่งดังนี้ sudo mv /var/www/html/index.html /var/www/html/index.html_bak Lighttpd : /var/www/index.html <!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN”> <html> <head> <title>Webserver test</title> </head> <body> This is a webserver test page. </body> </html> 3. เปิดโปรแกรม Jmeter ทำการ Add Thread Group, HTTP Request, View Results Tree และ Graph Results 4. ทำการทดสอบโดยชี้ไปที่ Web Site ของ Web Server ที่ต้องการ โดยมีตัวอย่างดังรูป (จะสังเกตุว่ามีการตั้งค่า Timeout = 1500 ms เพื่อป้องกันโปรแกรมค้าง เนื่องจาก Web Server ไม่ยอมตอบ) *หมายเหตุ ระหว่างรัน Test สามารถตรวจสอบการทำงานของเครื่อง Web Server โดยติดตั้งโปรแกรมชื่อ htop ดังนี้ sudo apt-get install -y htop พิมพ์คำสั่ง htop จะปรากฎหน้าจอดังรูป การตั้งค่าทดสอบ Number of Threads (users) : 500,1000,2000,2500,3000 Ramp-Up Period (in seconds) : 1 Loop Count : 1 ตัวอย่างการทดสอบ จำนวน Users ที่เปิด Page ไม่สำเร็จ Number of Threads (users) 500 1000 2000 2500 3000 Apache2 0 28 424 2232 Jmeter Hang