- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我是 Jgroups 的新手,但根据我对文档的理解,它的主要优点之一是可以禁用不需要/不想要的协议(protocol)元素(以实现更好的性能)。但是,当我尝试禁用与“先进先出”交货顺序和“保证交货”有关的任何内容时,出现以下错误:
Exception in thread "main" java.lang.Exception: events [GET_DIGEST SET_DIGEST ] are required by GMS, but not provided by any of the protocols below it
at org.jgroups.stack.Configurator.sanityCheck(Configurator.java:320)
at org.jgroups.stack.Configurator.connectProtocols(Configurator.java:197)
at org.jgroups.stack.Configurator.setupProtocolStack(Configurator.java:115)
at org.jgroups.stack.Configurator.setupProtocolStack(Configurator.java:49)
at org.jgroups.stack.ProtocolStack.setup(ProtocolStack.java:475)
at org.jgroups.JChannel.init(JChannel.java:965)
at org.jgroups.JChannel.<init>(JChannel.java:148)
at org.jgroups.JChannel.<init>(JChannel.java:130)
at RpcDispatcherTest.start(RpcDispatcherTest.java:29)
at RpcDispatcherTest.main(RpcDispatcherTest.java:83)
我的 xml 配置文件如下所示:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:org:jgroups"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups.xsd">
<TCP bind_addr="127.0.0.1"
bind_port="7800"
recv_buf_size="${tcp.recv_buf_size:130k}"
send_buf_size="${tcp.send_buf_size:130k}"
max_bundle_size="64K"
sock_conn_timeout="300"
enable_diagnostics="true"
thread_pool.min_threads="10"
thread_pool.max_threads="20"
thread_pool.keep_alive_time="30000"
stats = "false"
/>
<TCPPING initial_hosts="127.0.0.1[7800]"
port_range="0" stats = "false"/>
<MERGE3 min_interval="10000"
max_interval="30000" stats = "false"/>
<FD_SOCK stats = "false"/>
<FD timeout="3000" max_tries="3" stats = "false" />
<VERIFY_SUSPECT timeout="1500" stats = "false" />
<pbcast.GMS print_local_addr="true" join_timeout="2000"
view_bundling="true" stats = "false"/>
</config>
如果我注释掉最后一个协议(protocol)(pgcast.GMS 协议(protocol)),我不会收到错误,并且它“似乎”可以在单个 Windows VM(在 Google Cloud 上)上工作,但是如果我启动第二个 jvm(仍在同一台 Windows 计算机上),那么我注意到每个 jvm 都位于“单独的”集群中并且看不到另一个。 (在“正常的tcp.xml”配置中(包括NACKA和XXXX协议(protocol)),例如
<pbcast.NAKACK2 use_mcast_xmit="false"
discard_delivered_msgs="true"
stats = "false"/>
<UNICAST3 stats = "false"/>
<!--<pbcast.STABLE desired_avg_gossip="50000"-->
<!--max_bytes="4M"/>-->
一切都“按预期”工作,即,如果我在同一台 Windows 计算机上启动第二个 JVM,则第二个 JVM 确实会加入第一个 JVM 的集群,因此第二个 JVM 上发送的消息会出现在第一个 JVM 中,反之亦然。
那么,有没有一种方法可以禁用 UNICAST3 和 NAKACK2(本质上是与 FIFO 排序或保证消息传递有关的任何内容),但仍然包含确保“工作完整集群”所需的逻辑,该逻辑还捕获哪些节点离开/加入集群(例如 pbcast.GMS 逻辑?)我不知道如何......
(背景信息:我正在尝试提高性能,我怀疑性能稍慢是因为“保证消息传递”和“FIFO”协议(protocol),我认为我不需要这些协议(protocol),因为a)我正在使用TCP,b)消息可以按任何顺序发送。 (也就是说,我假设 TCP 几乎按照定义来保证消息传递,因为这很关键。)我也在 Google Cloud 上,我认为 TCP 逻辑的“保证”方面在高度优化的路由器上运行,并且无论如何都不允许多播,这抑制了 UDP 多播的主要优势之一。)
最后(我不认为这是必要的),但这是我的测试代码(这只是对 JGroups 4.0 附带的演示的轻微修改):
import org.jgroups.Address;
import org.jgroups.JChannel;
import org.jgroups.Message;
import org.jgroups.blocks.*;
import org.jgroups.util.RspList;
import org.jgroups.util.Util;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;
public class RpcDispatcherTest {
JChannel channel;
RpcDispatcher disp;
RspList rsp_list;
String props = "gs-tcp.xml"; // set by application
public static int print(int number) throws Exception {
return number;
}
public void start() throws Exception {
RequestOptions opts=new RequestOptions(ResponseMode.GET_FIRST, 1000);
channel=new JChannel(props);
disp=new RpcDispatcher(channel, this);
channel.connect("RpcDispatcherTestGroup");
final Address myCurAddress = channel.getAddress();
System.out.println("Currrent address is " + myCurAddress + " all members address are " + channel.getView().getMembers().toString());
final long t1 = System.currentTimeMillis();
final IntStream x = IntStream.range(0, 1_000_000);
final AtomicInteger cnt = new AtomicInteger();
x.asLongStream().parallel().forEach(l -> {
try {
final int i = (int) l;
if (i % (100) == 0) {
System.out.println("At " + i + " on thread + " + Thread.currentThread().getId());
}
final MethodCall call=new MethodCall(getClass().getMethod("print", int.class));
call.setArgs(i);
final CompletableFuture<Integer> response = disp.<Integer>callRemoteMethodWithFuture(myCurAddress, call, opts);
response.thenAccept(integer -> {
if (integer % (1024*8) == 0) {
System.out.println("At " + cnt.incrementAndGet() + " Execution time for " + integer + " is " + (System.currentTimeMillis() - t1)/1000f);
}
});
} catch (Exception e) {
e.printStackTrace();
}
});
// Util.close(disp, channel);
}
public static void main(String[] args) throws Exception {
new RpcDispatcherTest().start();
}
}
最佳答案
我没有找到禁用所有可靠消息传输协议(protocol)的方法,因为至少 GMS
协议(protocol)依赖于 NAKACK2
。 GMS
要求上述协议(protocol)提供 GET_DIGEST
事件,该事件由 NAKACK2
提供。
但是删除 UNICAST3
协议(protocol)确实有很大帮助,而且现在性能好多了。
关于java - 如何在 JGROUPS 中禁用 FIFO 和重传协议(protocol)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53330526/
我可以看到有状态的协议(protocol)可以减少像 cookie 这样的“模拟状态”。 但是测试变得更加难以确保您的实现正确并重新连接,并且 session 继续可能很难处理。 始终使用无状态协议(
我正在尝试为我的下一个分布式应用程序找到合适的协议(protocol)中间件。在过去的几天里,我找到了几个规范,想知道我是否错过了一个重要的规范?它应该是二进制协议(protocol),支持 RPC,
我正在做一个研究生院软件工程项目,我正在寻找管理 ATM 和银行网络之间通信的协议(protocol)。 我已经在谷歌上搜索了很长一段时间,虽然我找到了各种有关 ATM 的有趣信息,但我惊讶地发现似乎
我正在开发一个 ECG 模块,它以字节为单位给出数据。有一个关于它的协议(protocol)文档解释了如何构建从模块中出来的数据包。我想解码该数据。我很困惑 Protocol Buffer 是否会对此
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 3年前关闭。 Improve this qu
我需要在我的程序中包含基本的文件发送和文件接收例程,并且需要通过 ZMODEM 协议(protocol)。问题是我无法理解规范。 供引用,here is the specification . 规范没
我最近听到这个术语来描述 Google 的新环聊协议(protocol)和 Whisper System 的新 encrypted texting app . The new TextSecure p
如何检查某个对象是否符合协议(protocol)? 我试过这种方式,但出现错误: if lCell.conformsToProtocol(ContentProtocol) { } 最佳
在应用程序中,我们有两种类型的贴纸,字符串和位图。每个贴纸包都可以包含两种类型。这就是我声明模型的方式: // Mark: - Models protocol Sticker: Codable { }
这个问题在这里已经有了答案: Why can't a get-only property requirement in a protocol be satisfied by a property w
我有以下快速代码: protocol Animal { var name: String { get } } struct Bird: Animal { var name: String
我在遵循继承树的几个类中分配协议(protocol)。像这样: 头等舱 @protocol LevelOne - (void) functionA @end @interface BaseClass
我们之前使用的是 fix,但客户说使用 OUCH 进行交易,因为这样速度更快。我在互联网上查了一下,消息看起来很相似。它如何获得速度优势。请给我一些示例消息 最佳答案 基本上,FIX 消息以文本格式传
在我的 swift 项目中,我有一个使用协议(protocol)继承的案例,如下所示 protocol A : class{ } protocol B : A{ } 接下来我要实现的目标是声明另一个具
我想根据这两种协议(protocol)的一般特征(例如开销(数据包)、安全性、信息建模和可靠性)来比较 OPC UA 和 MQTT。我在哪里可以找到每个协议(protocol)的开销和其他特性的一些示
本质上,我的最终目标是拥有一个协议(protocol) Log,它强制所有符合它的对象都有一个符合另一个协议(protocol) [LogEvent] 的对象数组. 但是,符合Log的类需要有特定类型
我正在尝试为基于左操作数和右操作数标识的协议(protocol)实现 Equatable 协议(protocol)。换句话说:我如何为一个协议(protocol)实现 Equatable 协议(pro
问题不在于编程。 我正在使用一台旧机器,微软停止了这些机器的补丁。 有没有人针对攻击者已知的使用端口 445 的 SMB 协议(protocol)漏洞的解决方案? 任何棘手的解决方案? 换句话说,我想
在我们的业务中,我们需要记录到达我们服务器的每个请求/响应。 目前,我们使用 xml 作为标准实现。 如果我们需要调试/跟踪某些错误,则使用日志文件。 如果我们切换到 Protocol Buffer
你推荐什么协议(protocol)定义? 我评估了 Google 的 Protocol Buffer ,但它不允许我控制正在构建的数据包中字段的位置。我认为 Thrift 也是如此。我的要求是: 指定
我是一名优秀的程序员,十分优秀!