Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music
All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => all application on unix knowledges by golfreeze => Topic started by: golfreeze on มิถุนายน 03, 2013, 03:06:45 pm
-
เล่าถึงการทำงานของ Jmeter ปกติแล้ว กับการใช้งานของผม
โดยปกติแล้ว ผมจะใช้โปรแกรม Jmeter ในการทำ Load test ซึ่งมีเพื่อนที่ office แนะนำมาอีกที
ตัวนี้ ค่อนข้างจะประยุกต์ใช้ในการเทสโหลด ได้ หลากหลายวิธี และ สามารถใช้งานได้กับหลาย protocol
ซึ่งหลักๆ ผมก็จะใช้กับพวก SMTP , HTTP , HTTPS
แต่ด้วยการใช้งาน กับ HTTPS จะมีความเกี่ยวเนื่อง กับ Client certificate ผมเลยขอลองประมาณนี้ั นะครับ
http://stackoverflow.com/questions/7278239/ssl-client-certificate-needs-special-contents?rq=1
http://jmeter.apache.org/usermanual/component_reference.html#Keystore_Configuration
-
##วิธีการตั้งค่า และ การทำงานของ Certificate ใน Jmeter
http://docs.oracle.com/javase/1.5.0/docs/guide/security/jsse/JSSERefGuide.html#Customization
ส่วนนี้เราสามารถทำการแก้ไข ได้ที่ไฟล์ system.perproties จะเป็นไฟล์อยู่ใน folder "Jmeter" ที่เราทำการแตกออกมานะครับผม
สามารถใช้ Notepad หรือ Editplus ในการแก้ไขก่อนได้ แต่ทำการ backup configure ไว้ก่อนนะครับ เพื่อความปลอดภัย
-
ที่ไฟล์ system.properties จะเป็นที่ประกอบด้วยการอ้างถึง แหล่งของ client cert และ server cert รวมทั้ง password ที่ไว้ใส่ตอนใช้งาน cert
# Keystore properties (client certificates)
# Truststore properties (trusted certificates)
###มีปัญหาเรื่องการ connect client cert ผ่าน Jmeter
http://jmeter.512774.n5.nabble.com/Certificate-Based-Authentication-td5713372.html
-
(http://golfreeze.packetlove.com/pix/images/20130605145017_s.png)
พอดีวันนี้ ต้องทำเทส Connection กับตัว Load balance ครับผม
แล้วจะเทสใช้งานกับ connection ที่มี Client Certificate เข้ามาเกี่ยวด้วย บน Jmeter
คุณต้อง configure เพิ่มเติมที่ "system.properties"
folder C:/apache-jmeter-2.9 file "system.properties"
Uncomment บันทัดดังกล่าว แล้วทำการ ระบุ path ที่เก็บ client certificate
javax.net.ssl.keyStore=C:\\Users\\golf\\Desktop\\\\certificate_for_client\\user04.p12
javax.net.ssl.keyStorePassword=123456
javax.net.ssl.keyStoreType=pkcs12
ต้อง export client certificate ออกมาเป็น .p12 นั่นคือ รูปแบบของ pkc12 นั่นเอง
คือจะมีการเก็บทั้ง public key , private key ไว้ในตัวเดียว เลยต้องระบุ password เพื่อความปลอดภัย
ssl turn on ssl debugging
javax.net.debug=ssl,sslctx,session,sessioncache
เปิด debug mode เพื่อช่วยหา error เพิ่มเติม แต่ถ้าทำงานได้ปกติแล้วก็ comment กลับเข้าไปได้นะครับ แล้วแต่ชอบ
ต่อมาผมขอเปลี่ยน ภาษา jmeter จาก Japanese เป็น english นะครับ
###configure on file "jmeter.properties"
uncomment บันทัดข้างล่างนี้ ให้เป็นแบบนี้ครับ
language=en
ต่อไปเริ่มทำการ ตั้งค่าใน โปรแกรม jMeter
ของผมใช้งานเป็น version 2.9 โหลดจากเว็บ Apache มาได้เลยครับ
http://jmeter.apache.org/download_jmeter.cgi
ตั้งค่าทำการ สร้าง Test Plan
โดยการคลิกขวาที่ Test Plan แล้วทำการ Add "Thread Group"
จาก "Thread Group" ทำการ Add "Logic Controller" , add "Throughput controller"
ต่อจากนั้นทำการ Add "HTTP Request" คลิกขวาที่ Throughput Controller
เลือก Configure Element > HTTP Request Defaults
จากนั้นทำการ แอด Log debug คลิกขวาที่ "HTTP Request" > Listeners
เลือกทั้ง View Results Tree และ View Results in Table เพื่อใช้ในการ debug log
ต่อไปตั้งค่าใน "HTTP Request"
ระบุ Web Server Server name: golf.test.com
Port : 443
HTTP Request Implementation เลือกเป็น HttpClient3.1
Protocol : https
Method : POST
PATH: /index.html
แล้วก็จัดการเทส Load ได้เลยครับผม
ถ้าท่านใดออกเนต ผ่าน Proxy ก็ระบุค่า Proxy ไว้ก่อนด้วยนะครับ
เครื่องที่สร้าง Load จะได้ connect ระบบผ่าน internet ได้ ;)