Closed jojoaoteman closed 3 years ago
@jojoaoteman 每个sample的数据是根据当前sample的element元素存储的,肯定不会串,除非你在同一个sample里面把接口从A修改为B。 多接口压测,建议每个接口都创建一个Dubbo Sample.
hi,大神,我其实也遇到同样的问题。
我也遇到了这个问题,我把DubboSample.java中的 ReferenceConfigCache cache = ReferenceConfigCache.getCache(Constants.getAddress(this), new ReferenceConfigCache.KeyGenerator() { ...
中的Constants.getAddress(this)替换为 -> Constants.getInterface(this),路径的问题就没有再出现了
我测试了一下2.7.7确实有问题,2.7.4以前是没有问题,估计是dubbov2.7.7版本对ReferenceConfigCache进行了修改,具体原因我排查一下。
收到,期待中,我写的blog特别感谢了你和另一个兄弟。
------------------ 原始邮件 ------------------ 发件人: "thubbo/jmeter-plugins-for-apache-dubbo" <notifications@github.com>; 发送时间: 2020年10月14日(星期三) 下午2:31 收件人: "thubbo/jmeter-plugins-for-apache-dubbo"<jmeter-plugins-for-apache-dubbo@noreply.github.com>; 抄送: "荔枝"<2696732525@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [thubbo/jmeter-plugins-for-apache-dubbo] 使用插件2.7.7版本进行压测时,先压A接口,压完后再压B的接口;发现B的接口类路径是A的,但是方法名是B的 (#122)
我测试了一下2.7.7确实有问题,2.7.4以前是没有问题,估计是dubbov2.7.7版本对ReferenceConfigCache进行了修改,具体原因我排查一下。
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
我也遇到了这个问题,我把DubboSample.java中的 ReferenceConfigCache cache = ReferenceConfigCache.getCache(Constants.getAddress(this), new ReferenceConfigCache.KeyGenerator() { ...
中的Constants.getAddress(this)替换为 -> Constants.getInterface(this),路径的问题就没有再出现了
我也遇到了,用楼上大佬的方法解决了
//2.7.7版本 referenceConfig.toString() 返回有问题待定位,返回的都是 <dubbo:reference /> 导致只缓存了第一个接口的 referenceConfig,看了下AbstractConfig这个类下的toString()方法 没看出问题,有空debug一下
/*
ReferenceConfigCache cache = ReferenceConfigCache.getCache(Constants.getAddress(this), new ReferenceConfigCache.KeyGenerator() {
@Override
public String generateKey(ReferenceConfigBase<?> referenceConfig) {
System.out.println("******2.7.7 key is******"+referenceConfig.toString());
return referenceConfig.toString();
}
});
*/ //先改成了如下,referenceConfig的key用默认的 接口名+group+version ReferenceConfigCache cache = ReferenceConfigCache.getCache(Constants.getAddress(this));
public String toString() { try { StringBuilder buf = new StringBuilder(); buf.append("<dubbo:"); buf.append(getTagName(this.getClass())); Method[] methods = this.getClass().getMethods(); Method[] var3 = methods; int var4 = methods.length;
for(int var5 = 0; var5 < var4; ++var5) {
Method method = var3[var5];
try {
if (MethodUtils.isGetter(method)) {
String name = method.getName();
String key = calculateAttributeFromGetter(name);
try {
this.getClass().getDeclaredField(key);
} catch (NoSuchFieldException var10) {
continue;
}
Object value = method.invoke(this);
if (value != null) {
buf.append(" ");
buf.append(key);
buf.append("=\"");
buf.append(value);
buf.append("\"");
}
}
} catch (Exception var11) {
logger.warn(var11.getMessage(), var11);
}
}
/*
2.7.7版本和2.7.4相比 toString()方法中多了
try {
this.getClass().getDeclaredField(key);
} catch (NoSuchFieldException var10) {
continue;
}
而GenericService genericService = (GenericService) cache.get(reference);传入ReferenceConfig对象, 这些属性都是在父类ReferenceConfigBase中定义的 所以this.getClass().getDeclaredField(key)获取不到值进入catch异常了
问题修复在如下版本: | 插件版本 |
---|---|
Dubbo Jmeter Plugin v2.7.4.1 | |
Dubbo Jmeter Plugin v2.7.8 |
使用Dubbo Jmeter Plugin v2.7.4.1 支持调用的dubbo服务端版本:v2.5.x、v.2.6.x、[v2.7.0-v2.7.4.1]
使用Dubbo Jmeter Plugin v2.7.8 支持调用的dubbo服务端版本:>=v2.7.0
ps. 别问为什么听话就对了。