JMeterãNATç°å¢ã§ä½¿ãæ©ä¼ããã£ãã®ã§è¨å®æ¹æ³ã¾ã¨ãããã¨ãããã»ã¼ä»¥ä¸ã®ãµã¤ãã«æ¸ãã¦ãã£ãéãã«ããã*1
ä»åã¯æ¥ç¶å¨ãã®è¨å®ã®è©±ããããªãã®ã§ãã¤ã³ã¹ãã¼ã«æ¹æ³ããã¹ãè¨ç»ã®è¨å®æ¹æ³ããµã¼ãä¸ã§ã®CUIã«ãããã¹ãå®è¡ãªã©ã«ã¤ãã¦ã¯è§£èª¬ããã¾ããã
使ç¨ããã½ããã¦ã§ã¢
ä»å使ç¨ããã½ããã¦ã§ã¢ã¯ä»¥ä¸ã®éã
JMeterã®ãµã¼ãã¯ã©ã¤ã¢ã³ãéã®éä¿¡
Apache JMeterã¯ãã¯ã©ã¤ã¢ã³ãã¢ããªã±ã¼ã·ã§ã³(GUI)ä¸ã§å ¥åãããã¹ãè¨ç»ãå®è¡ããã ãã§ã¯ãªããåºåãããã¹ãè¨ç»ãã³ãã³ãã©ã¤ã³ããå®è¡ãããã¨ãã§ãããããã«ãã¯ã©ã¤ã¢ã³ãã¢ããªã±ã¼ã·ã§ã³ãããµã¼ãã«ãªã¢ã¼ãæ¥ç¶ãããã¹ãè¨ç»ãå®è¡ãããã®å®è¡çµæã表示ãããã¨ãã§ããã
ãã¹ãè¨ç»ã®ãªã¢ã¼ãå®è¡ã¯ããã¹ãå®è¡ç¨ã®ãµã¼ãä¸ã§jmeter-serverãèµ·åãããã®ãµã¼ãã®ãã¼ãã«ã¯ã©ã¤ã¢ã³ãã¢ããªã±ã¼ã·ã§ã³ããã½ã±ããæ¥ç¶ãããã¨ã§ãããªããããã«jmeter-serverä¸ã§å®è¡ããããã¹ãè¨ç»ã®å®è¡çµæãã¯ã©ã¤ã¢ã³ãã¢ããªã±ã¼ã·ã§ã³ä¸ã§è¡¨ç¤ºããããã«ã¯ãjmeter-serverããã¯ã©ã¤ã¢ã³ãã¢ããªã±ã¼ã·ã§ã³ã®ãã¼ãã¸ã®æ¥ç¶ãå¿ è¦ã«ãªãã
ä¸ã®å³ã¯ããããããã¼ãä¸ã¤ãã¤ã ããå®éã«ã¯rmiregistryç¨ã®ãã¼ãã使ç¨ããã
SSHã«ãããã¼ã転é
ãã¦ãä¸è¨ã®å³ã§ã®ãã¯ã©ã¤ã¢ã³ãPCããNATç°å¢ã«ãããªã©ã®çç±ã§ããµã¼ãããç´æ¥æ¥ç¶ã§ããªãå ´åã«ã¤ãã¦èãããä»åã¯ãSSHã«ãããã¼ã転éã使ç¨ããã
ã¾ãããµã¼ãã»ã¯ã©ã¤ã¢ã³ãã®ã©ã¡ããããæ¥ç¶å¯è½ãªä¸ç¶ãµã¼ããç¨æããããµã¼ããä¸ç¶ãµã¼ããå ¼ãã¦ãæ§ããªãããããã§ã¯ä¸å¿å¥ãµã¼ãã¨ãããã¨ã«ããã
ã¯ã©ã¤ã¢ã³ãPCããä¸ç¶ãµã¼ãã«ã以ä¸ã®ãããªsshæ¥ç¶ããããªããã¨ã§ãã³ããªã³ã°ããããªãã(ããã§ã¯ãã¯ã©ã¤ã¢ã³ãã¢ããªã±ã¼ã·ã§ã³ã使ç¨ãããã¼ãçªå·ã30000ããµã¼ãã®ã¢ãã¬ã¹ã192.0.2.1ã¨ãã¦ãããJMeterã«ãããè¨å®æ¹æ³ãªã©ã«ã¤ãã¦ã¯å¾è¿°)
ssh -R 30000:localhost:30000 192.0.2.1
JMeter(GUI)ãå®è¡ãã¦ããPCããä¸ç¶ãµã¼ãã«æ¥ç¶ããããªããä¸ç¶ãµã¼ãä¸ã§ã½ã±ããã«ãã¼ã30000çªãå²ãä»ãã¦æ¥ç¶ãåãä»ããããã«ãªãã
JMeter Serverã§ãã¹ããéå§ãããã¨ãçµæãéä¿¡ããçºã«ã¯ã©ã¤ã¢ã³ãã¸ã®æ¥ç¶ããããªããã¨ãããè¨å®(å¾è¿°)ã工夫ãããã¨ã§ãã¯ã©ã¤ã¢ã³ãPCã¸æ¥ç¶ãã代ããã«ãä¸ç¶ãµã¼ãã«æ¥ç¶ããããªãããã«ä»åãããã¨ãã§ããä¸ç¶ãµã¼ãä¸ã§å ã»ã©SSHãç¨æãããã¼ãã«æ¥ç¶ããããªããããä¸ç¶ãµã¼ãä¸ã®30000çªãã¼ãã¸ã®æ¥ç¶ã¯ãSSHã®ãã¼ã転éæ©è½ã«ãã£ã¦æ¥ç¶å ã§ããã¯ã©ã¤ã¢ã³ãPCã®30000çªãã¼ãã«è»¢éãããã¯ã©ã¤ã¢ã³ãPCä¸ã®JMeterã«æ¥ç¶ããããªãããããã«ã§ããã
ä¸ç¶ãµã¼ãã§ãã¼ã転éããããªãã«ã¯ãä¸ç¶ãµã¼ãã®sshdã®è¨å®ãå¿ è¦ãªå ´åããããOpenSSHã§ã¯ãsshd_configã§ãGatewayPorts yesããæå®ããå¿ è¦ããã£ãã
ä¸ã®ä¾ã§ã¯ããã¹ãå®è¡ãµã¼ãããã¯ã©ã¤ã¢ã³ãPCã¸ã®æ¥ç¶ãã§ããªãå ´åã®èª¬æã§ãã£ãããã¯ã©ã¤ã¢ã³ããããµã¼ãã¸ã®æ¥ç¶ãã§ããªãå ´åãåãããã«ãã¼ã転éã§æ¥ç¶ã確ä¿ã§ããã
JMeterã®è¨å®å 容
ã¯ã©ã¤ã¢ã³ãããµã¼ãã®ã©ã¡ããç¸äºã«æ¥ç¶ã§ããªããããªå ´åãèãããã©ã¡ãããããä¸ç¶ãµã¼ãã«ã¯æ¥ç¶ã§ããã¨ãããä¸ç¶ãµã¼ãã¯ä¸ã®å³ã®ããã«ã¤ã³ã¿ã¼ãããä¸ã«ãããããããªããããµã¼ãå´ã®DMZä¸ãªã©ã«ãããããããªãã
ããããã®IPã¢ãã¬ã¹ã以ä¸ã®ããã«ããã
ä¸ç¶ãµã¼ã | 192.0.2.1(ã°ãã¼ãã«) |
ã¯ã©ã¤ã¢ã³ãPC | 192.168.0.3(ãã©ã¤ãã¼ã) |
JMeterå®è¡ãµã¼ã | 192.168.1.5(ãã©ã¤ãã¼ã) |
ä»å使ç¨ãããã¼ãã以ä¸ã®ããã«æ±ºããããã¼ãçªå·ã¯ä½ã§ãè¯ãã転éã§ããããã«åºå®ã¯å¿ è¦ã
rmiregistryãã¼ã | 31099 | ããã©ã«ãã¯1099 |
JMeter ãµã¼ãã使ç¨ãããã¼ã | 40000 | ããã©ã«ãã¯ä¸å® |
JMeter ã¯ã©ã¤ã¢ã³ãã使ç¨ãããã¼ã | 30000 | ããã©ã«ãã¯ä¸å® |
ã¯ã©ã¤ã¢ã³ãã®è¨å®
ãµã¼ãã¸ã®æ¥ç¶ãä¸ç¶ãµã¼ãã«æ¯ãæ¿ããããã«ã/etc/hostsã«ä»¥ä¸ã®è¨è¿°ããããªãã
127.0.0.1 localhost jmeter-client 192.0.2.1 jmeter-server
bin/jmeter.properiesã®ä»¥ä¸ã®é ç®ãè¨å®ããã
remote_hosts=jmeter-server:31099 client.rmi.localport=30000
remote_hostsã«ã¯ãµã¼ãåã¨rmiregistryãã¼ããæå®ãããæå®ãããã¹ãåãã¡ãã¥ã¼ããé¸æã§ããããã«ãªãã
bin/jmeter.shã§JVM_ARGSã«ä»¥ä¸ã®å¼æ°ã追å ããã·ã¹ãã ããããã£ã«java.rmi.server.hostnameãè¨å®ããã
JVM_ARGS="-Djava.rmi.server.hostname=jmeter-client"
ãµã¼ãã®è¨å®
ã¯ã©ã¤ã¢ã³ãã¸ã®æ¥ç¶ãä¸ç¶ãµã¼ãã«æ¯ãæ¿ããããã«ã/etc/hostsã«ä»¥ä¸ã®è¨è¿°ããããªãã
192.168.1.5 jmeter-server 192.0.2.1 jmeter-client
bin/jmeter.properiesã®ä»¥ä¸ã®é ç®ãè¨å®ããã
client.rmi.localport=30000 server.rmi.port=31099 server.rmi.localport=40000
bin/jmeter-serverã§RMI_HOST_DEFã«ä»¥ä¸ã®å¼æ°ã追å ããã·ã¹ãã ããããã£ã«java.rmi.server.hostnameãè¨å®ããã
RMI_HOST_DEF=-Djava.rmi.server.hostname=jmeter-server
ãã³ããªã³ã°è¨å®
ãµã¼ãããä¸ç¶ãµã¼ãã«å¯¾ãã¦ã以ä¸ã®ããã«SSHæ¥ç¶ããããªã
ssh -ladmin -R 31099:localhost:31099 jmeter-client ssh -ladmin -R 40000:localhost:40000 jmeter-client
ã¯ã©ã¤ã¢ã³ãPCããä¸ç¶ãµã¼ãã«å¯¾ãã¦ã以ä¸ã®ããã«SSHæ¥ç¶ããããªã
ssh -ladmin -R 30000:localhost:30000 jmeter-server
å¿ è¦ã§ããã°ããµã¼ããã¯ã©ã¤ã¢ã³ãPCããä¸è¨ã®ãã¼ãã¸ã®æ¥ç¶ãããããFWã§è¨±å¯ããã
ããã°ã©ã ã®èµ·å
ãµã¼ãå´ã§jmeter-serverãèµ·åãã
[apache-jmeter-2.9]$ bin/jmeter-server Using local port: 40000 Created remote object: UnicastServerRef [liveRef: [endpoint:[jmeter-server:40000](local),objID:...
ã¯ã©ã¤ã¢ã³ãå´ã§ãjmeter.shãèµ·åãã
[apache-jmeter-2.9]$ bin/jmeter.sh
å¦çã®æµãã®èª¬æ
å¤å以ä¸ã®ç解ã§ãã£ã¦ããã¨æãã
- ãµã¼ãä¸ã§jmeter-serverãèµ·å
- ã¯ã©ã¤ã¢ã³ãPCã§ãã¡ãã¥ã¼ãããå®è¡ãï¼ãéå§(ãªã¢ã¼ã)ãã§jmeter-server:31099ãæå®ãããã¹ããå®è¡
- å®è¡çµæãåå¾ã§ããããã«ãclient.rmi.localportã§æå®ãããã¼ã(30000)ã§æ¥ç¶ã®åãä»ããéå§ãã
- ã¯ã©ã¤ã¢ã³ããããjmeter-server:31099ã«æ¥ç¶ãããµã¼ãã®æ¥ç¶æ
å ±ãåå¾
- ã¯ã©ã¤ã¢ã³ãPCä¸ã®/etc/hostsã§ã¯ãjmeter-serverã«ã¯ä¸ç¶ãµã¼ãã®IPã¢ãã¬ã¹ãæå®ãã¦ããã®ã§ãä¸ç¶ãµã¼ãã®æ¥ç¶31099çªãã¼ãã«æ¥ç¶
- ãã¼ã転éããããµã¼ãä¸ã®rmiregistryã«æ¥ç¶
- rmiregistryã¯ãæ¥ç¶æ å ±ã¨ãã¦ããã¼ãçªå·40000ã¨ãjava.rmi.server.hostnameã·ã¹ãã ããããã£ã§æå®ãããã¹ãåjmeter-serverãæ»ã
- ã¯ã©ã¤ã¢ã³ããããjmeter-server:40000ã«æ¥ç¶ãã
- ã¯ã©ã¤ã¢ã³ãPCä¸ã®/etc/hostsã§ã¯jmeter-serverã«ã¯ä¸ç¶ãµã¼ãã®IPã¢ãã¬ã¹ãæå®ãã¦ããã®ã§ãä¸ç¶ãµã¼ãã®æ¥ç¶40000çªãã¼ãã«æ¥ç¶
- ãã¼ã転éããããµã¼ãä¸ã®JMeterãµã¼ã(40000çªãã¼ã)ã«æ¥ç¶
- JMeterã¯ã©ã¤ã¢ã³ãã¯ãµã¼ãã«å¯¾ãã¦ãèªåã®æ¥ç¶æ å ±ã¨ãã¦java.rmi.server.hostnameã·ã¹ãã ããããã£ã§æå®ãããã¹ãåjmeter-clientã¨ããã¼ãçªå·30000ãéã
- JMeterãµã¼ããããjmeter-client:30000ã«æ¥ç¶ãã
- ãµã¼ãä¸ã®/etc/hostsã§ã¯jmeter-clientã«ã¯ä¸ç¶ãµã¼ãã®IPã¢ãã¬ã¹ãæå®ãã¦ããã®ã§ãä¸ç¶ãµã¼ãã®æ¥ç¶30000çªãã¼ãã«æ¥ç¶
- ãã¼ã転éããããã¼ã«ã«PCã®JMeterã¯ã©ã¤ã¢ã³ã(30000çªãã¼ã)ã«æ¥ç¶
ãã®ä»è£è¶³
å ã ã¯ã©ã¤ã¢ã³ãâãµã¼ãéã®åç·ãç´°ãã£ãã®ã§ãµã¼ãå´ã§å®è¡ãããã¨ãã¦å§ãããã ãã©ããªã¹ãã¼ãçµæãããªã¼ã§è¡¨ç¤ºããªã©ã使ç¨ãã¦ããå ´åãã¬ã¹ãã³ã¹ã®å 容ã転éãããã®ã§è»¢ééã¯æ¸ããªããããã°ã¨ã©ã¼ã®ã¿ãã«ãã§ãã¯ãããããã¿å ãµã¤ãæ§ã®ããã«mode=Asynchè¨å®ããæ¹ãããããã
*1:ãµã¼ãå´ãNATã¨ããã®ã¯ä»å追å ããæ¡ä»¶ã ãã©ã