队
我使用JCIFS成功编写了CIFS JSR223 Sampler(Groovy)。但问题是我没有通过增加用户来看到良好的网络吞吐量。我尝试了分布式测试,改变了缓冲区大小(jcifs属性发送/接收)..但没有运气。
非常感谢任何帮助......这是我使用Jcifs编写和读取的代码。
CIFS_Write的代码
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
import java.net.InetAddress;
//import java.io.file;
import org.apache.commons.net.io.Util;
import jcifs.smb.SmbFileOutputStream;
//jcifs.Config.setProperty("jcifs.smb.client.ssnLimit", "1" );
jcifs.Config.setProperty("jcifs.smb.client.rcv_buf_size", "223288");
jcifs.Config.setProperty("jcifs.smb.client.snd_buf_size", "23288");
jcifs.Config.setProperty("jcifs.smb.maxBuffers", "50");
jcifs.Config.setProperty("jcifs.smb.client.tcpNoDelay", "true");
String user = "xx";
String pass ="xx";
SmbFileOutputStream out = null;
String clientIP = InetAddress.getLocalHost().getHostName();
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("",user, pass);
String sharepath =vars.get("sharename")+"server25/"+clientIP+"a1.csv";
SmbFile remoteFile = new SmbFile (sharepath, auth);
os = (SmbFileOutputStream)remoteFile.getOutputStream();
InputStream iss = new BufferedInputStream(new FileInputStream("/mnt/client.csv/"));
//InputStream iss = new BufferedInputStream(new FileInputStream("/opt/client.csv"));
Util.copyStream(iss,os,65535);
os.close();
iss.close();
CIFS_Read的代码:
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
//jcifs.Config.setProperty("jcifs.smb.client.ssnLimit", "1" );
String user = "xx";
String pass ="xx";
jcifs.Config.setProperty("jcifs.smb.client.rcv_buf_size", "223288");
jcifs.Config.setProperty("jcifs.smb.client.snd_buf_size", "23288");
jcifs.Config.setProperty("jcifs.smb.maxBuffers", "50");
jcifs.Config.setProperty("jcifs.smb.client.tcpNoDelay", "true");
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("",user, pass);
String clientIP = InetAddress.getLocalHost().getHostName();
String sharepath =vars.get("sharename")+"server25/"+clientIP+"a1.csv";
SmbFile remoteFile = new SmbFile (sharepath, auth);
InputStream iss = new BufferedInputStream(remoteFile.getInputStream());
byte [] buffer = new byte[65535];
while ((ch = iss.read(buffer)) != -1) {
continue;
}
iss.close();
答案 0 :(得分:1)
据我所知,您正试图通过增加访问这些代码路径的用户数量来增加负载。
<postinstallScriptlet>
<scriptFile>src/rpm/postinstall</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</postinstallScriptlet>
维护会话中的地图(想想用户) - &gt;传输(认为socket到文件服务器)。默认情况下,它为每个套接字分配JCIFS
个会话,这可能是一种过度杀伤,可能会使您的套接字无法满足流量。
您应该尝试设置此250
并将其设置为较低的值,例如JVM property : -Djcifs.smb.client.ssnLimit
。