JMeter (Active?) FTP to VLTrader

2019-03-05 18:15发布

Situation: I'm using JMeter to load test my communications application (Cleo VLTrader). I'm new to JMeter, and have been able to get HTTP communication working, but not FTP. When I attempt to use a JMeter FTP Request sampler, I can see on the server side that the JMeter is issuing a "PASV" command, and failing shortly thereafter due to a "502 PASV command not available" error.

Question: How do I need to configure my JMeter FTP Request sampler to connect to my FTP server?

标签: ftp jmeter
1条回答
神经病院院长
2楼-- · 2019-03-05 18:28

1. Sorry for this but just to ensure: have you ensured that FTP connection succeeds manually, i.e. not from FTP Request in jmeter script but via console/telnet connection or any FTP client utility?


2. FTP Passive mode

Possible cause:
Since your FTP Request fails during PASV command execution can suppose that the root cause is that your ftp server doesn't support passive mode while jmeter's FTP Request uses passive mode by default.

To ensure this try to switch into Passive mode after connecting to your ftp from console, e.g.

telnet your.ftp.server.url 21
USER yourusername
PASS yourpassword
PASV

or

ftp -d your.ftp.server.url
USER yourusername
PASS yourpassword
passive

or using any ftp client utility which have option to select mode (active/passive) for connection.

If the same issue appears during this - well, the problem is that your ftp server doesn't support passive mode which is used by FTP Request.

See e.g. this for explanation of differences in both the modes.


Possible solution:
As per jmeter sources:

ftp.enterLocalPassiveMode();

switch to passive mode is used by default and there is no possibility to set mode externally in FTP Request configuration screen.

But you can implement ftp request yourself, avoiding usage of FTP Request.
You can use FTPClient realization from Apache Commons Net and script ftp connection in BeanShell Sampler.

Very simplified this may look like:

import org.apache.commons.net.ftp.*;

FTPClient client = new FTPClient();
client.setDataTimeout(3600000);
client.connect(ftpHost,ftpPort);
client.login(userName, userName);
client.setFileType(FTPClient.BINARY_FILE_TYPE);

...

// FTPClient uses 'active mode' by default
if (ftp_passive_mode) {
    client.enterLocalPassiveMode();
} else {
    client.enterLocalActiveMode();
}

...

client.logout();
client.disconnect();

Maybe also I'm wrong and the reason of your issue hides in another place.
Hope this will help you to diagnose and solve your problem.

查看更多
登录 后发表回答