首页 \ 问答 \ 动态配置分布式对象(Configuring Distributed Objects Dynamically)

动态配置分布式对象(Configuring Distributed Objects Dynamically)

我目前正在评估使用Hazelcast作为我们的软件。 如果你能帮助我阐明以下内容,会很高兴。

我有一个特定的要求:我想能够动态地配置分布式对象(比如地图,队列等)。 也就是说,当我启动集群时,我无法掌握所有配置数据。 我希望能够根据需要初始化(和处理)服务,并且可以在它们之间改变它们的配置。

我正在评估的版本是3.6.2。

我可以获得的文档(参考手册,部署指南以及“Mastering Hazelcast”电子书)在这个主题上的细节很少,甚至是部分矛盾。

因此,澄清一个预期的用法:我想启动群集; 然后,在某个时候,创建一个分布式地图结构,在节点上使用它; 然后将其处置并使用具有不同配置的地图(例如,备份数量,驱逐策略)用于相同的目的。

文档提到,这是可以预料的,如果节点对同一个分布式对象有不同的配置,就会发生坏事。 这很合理,很好。 我可以确保配置一致。

看看代码,似乎可以做我想要的事情:在创建分布式对象时,如果它还没有代理,HazelcastInstance将查看其Config以创建一个新的并将其存储在其本地代理列表。 当该对象被销毁时,其代理将从列表中删除。 在下一次调用时,它会从Config中重新加载。 此外,该配置是可写的,所以如果它在两者之间被改变,它应该选择这些改变。

所以这看起来应该起作用,但鉴于文件对此事的沉默,我想要一些确认。

  • 有没有任何理由为什么上述不应该工作?
  • 如果它应该起作用,是否有任何理由这样做? 例如,是否有计划在未来版本中更改代码,以防止这种情况发生?
  • 如果是这样,是否有其他选择?

I'm currently evaluating using Hazelcast for our software. Would be glad if you could help me elucidate the following.

I have one specific requirement: I want to be able to configure distributed objects (say maps, queues, etc.) dynamically. That is, I can't have all the configuration data at hand when I start the cluster. I want to be able to initialise (and dispose) services on-demand, and their configuration possibly to change in-between.

The version I'm evaluating is 3.6.2.

The documentation I have available (Reference Manual, Deployment Guide, as well as the "Mastering Hazelcast" e-book) are very skimpy on details w.r.t. this subject, and even partially contradicting.

So, to clarify an intended usage: I want to start the cluster; then, at some point, create, say, a distributed map structure, use it across the nodes; then dispose it and use a map with a different configuration (say, number of backups, eviction policy) for the same purposes.

The documentation mentions, and this is to be expected, that bad things will happen if nodes have different configurations for the same distributed object. That makes perfect sense and is fine; I can ensure that the configs will be consistent.

Looking at the code, it would seem to be possible to do what I intend: when creating a distributed object, if it doesn't already have a proxy, the HazelcastInstance will go look at its Config to create a new one and store it in its local list of proxies. When that object is destroyed, its proxy is removed from the list. On the next invocation, it would go reload from the Config. Furthermore, that config is writeable, so if it has been changed in-between, it should pick up those changes.

So this would seem like it should work, but given how silent the documentation is on the matter, I'd like some confirmation.

  • Is there any reason why the above shouldn't work?
  • If it should work, is there any reason not to do the above? For instance, are there plans to change the code in future releases in a way that would prevent this from working?
  • If so, is there any alternative?

原文:https://stackoverflow.com/questions/39876694
更新时间:2022-06-21 13:06

最满意答案

它不是循环方式,条件在while控制器不满足,不返回true

顺便说一下, ${__javaScript("${State}".indexOf("Received") == -1,)}表示当State不包含Received时,condition为true。

  • indexOf在父(State)中找不到字符串, indexOf返回-1

第一次,它运行因为,你设置Statenot set yet ,where条件返回true (indexOf返回-1,因为“not set yet”不包含“Received”)

当我执行这个测试时,它会在http请求后被卡住,这个请求以绿色执行,接下来没有任何反应,这里有什么问题?

测试是停止还是仍在运行?

  1. 如果测试停止,您可以假设条件失败(这意味着State包含“Received”),因此当控制器停止发送请求并且出来时。 while控制器给出的总执行时间( number of times http request has been sent* (http request response time + 5 seconds) )获取“已接收”消息所需的时间。 注意:将Controller作为子项添加到事务控制器以获取总体执行时间。
  2. 如果测试仍在运行,则测试设计出现问题。 预计是每隔5秒,http请求应该是SENT。

添加调试采样器以了解使用Reg Ex Extractor通过State变量捕获的值。

以下是我如何理解场景的屏幕截图。

在此处输入图像描述

与我们分享您的测试计划,以帮助您。


It is not looping means, condition in While controller is not satisfied, not returning true.

By the way, ${__javaScript("${State}".indexOf("Received") == -1,)} means that, condition is true when State does not contains Received.

  • indexOf returns -1 in case the string is not found in the parent (State)

First time, it ran because, you set State to not set yet, where condition returns true (indexOf returns -1 as "not set yet" does not contains "Received")

When I execute this test, it gets stuck after http request, which is executed in green and nothing happens next, what can be the problem here?

Does the test stopped or still running?

  1. If test is stopped, you can assume that condition is failed (which mean State contains "Received"), so while controller is stopped sending the requests and comes out. overall execution time of while controller gives (number of times http request has been sent* (http request response time + 5 seconds)) the time required to get the "Received" message. Note: Add While Controller as a child to Transaction Controller to get the overall execution time.
  2. If test is still running, something wrong in your test design. expected is that every 5 seconds, http request should be SENT.

Add Debug Sampler to know what value is captured by State variable using Reg Ex Extractor.

Following is the screen shot that how i understood the scenario.

enter image description here

Share your Test Plan with us in order to help you.

相关问答

更多
  • 这是你的考试方式: 第一个循环: status_1变量为空,而Controller正在执行 第二个循环: status_1变量值为6 ,而Controller未执行,因为条件为false。 在While Controller之前添加一个Debug Sampler ,以便自己查看 解决方案就像将下一行添加到您的Beanshell采样器之一一样简单: vars.remove("status_1"); ResponseMessage="variablescleared"; ResponseCode=200; 该 ...
  • 您必须使用以下函数引用变量: ${__V(Result_${index}_g1) You have to reference the variable with the function: ${__V(Result_${index}_g1)
  • 您不需要在控制器内部放置If Controller。 您可以在While Controller中使用此条件: ${__javaScript("${DONE}"!="Downloaded" && "${Temp}"!="No Exceptions found")} You don't need to put If Controller inside While Controller. You can use this condition in While Controller: ${__javaScript ...
  • 您需要使用引号括${__samplerName()} ,如下所示: "${__samplerName()}"=="HTTPRequestName" 请参阅如何使用JMeter的'IF'控制器并获取Pie。 有关If Controller用例和子句的更多详细信息。 如果您需要基于某些条件运行采样器,则可以使用JMeter属性,如下所示: 启动JMeter,提供采样器名称属性,如jmeter -Jrunsomesampler=true 使用以下条件添加If Controller: ${__P(runsomes ...
  • 我建议使用Response Assertion来验证${status}变量值是Progress Success 将响应声明添加为HTTP请求采样器的子项 配置如下: 应用于: - > JMeter变量 - > status 模式匹配规则: Matches 要测试的模式: Progress|Success 鉴于使用“匹配”规则,JMeter会将该模式视为Perl5样式的正则表达式,因此如果${status}变量等于Success或Progress则取样器将传递,否则它将被标记为失败。 请参阅如何在三个简单步骤 ...
  • 它不是循环方式,条件在while控制器不满足,不返回true 。 顺便说一下, ${__javaScript("${State}".indexOf("Received") == -1,)}表示当State不包含Received时,condition为true。 indexOf在父(State)中找不到字符串, indexOf返回-1 第一次,它运行因为,你设置State还not set yet ,where条件返回true (indexOf返回-1,因为“not set yet”不包含“Received”) ...
  • 是的,剩余的9个请求必须从缓存中提取。 循环控制器是简单的循环执行器,内部没有任何魔法。 改进的性能是因为在服务器上使用缓存结果。 如果你想要一件事你可以尝试,使用循环控制器,但使用不同的替代参数,以便每次不同的请求将被发送到服务器(我知道循环控制器是重复相同的值,但这只是为了确认高速缓存)。 然后比较结果。 我希望这清除了疑点:) Yes, Remaining 9 requests must be pulling from cache. Loop controller is simple loop exe ...
  • 你的情况没有区别。 这种情况很简单,对于更复杂的情况,当你可以在单线程组中有更多的周期时,第一种情况可能更优选,因为处理这部分采样器的循环不需要触及线程组参数...以及它的完全主观的。 No difference in your case. This scenario is simple, for more complicated case, when you can have much more cycles in single thread group 1st case may be more pref ...
  • m.request()返回一个延迟的值,而不是值本身。 我在下面有一段代码,显示了一种获取值的方法。 我明确地用延期调用替换了m.request(),并使用超时而不是帖子。 //component var tISM = {}; //model tISM = { Key: function(data) { this.Id = m.prop(data.Id); this.Name = m.prop(data.Name); this.CreationTime = m.prop ...
  • while循环的基础是在满足条件时循环。 因此,你的while循环应该会做一些会影响这种情况的事情。 如果没有,你可能会永远循环。 在您的情况下,您希望在spaces > 2循环。 这意味着你最好更新while循环中的spaces : while (spaces > 2) { Console.WriteLine("You entered more than three words! Try again!"); s = Console.ReadLine(); spaces = s.Co ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。