什么是在段中定义的<hz:map>标签中创建的标签之间的区别applicationContext是<hz:config>什么?
它们有什么关系?
我知道<hz:map>in applicationContext会导致创建一个IMap类型的bean,当没有<hz:map>那个时它就不会.
但是,当定义了bean并且随后<hz:map>在hazelcast配置下具有相同名称时,以下配置会执行什么操作?
<hz:map id="loggedInUserMap" name="loggedInUserMap" instance-ref="ipds" scope="singleton" />
<hz:hazelcast id="ipds">
<hz:config>
<hz:instance-name>${hz.instance.name}</hz:instance-name>
<hz:group name="${hz.group.name}" password="${hz.group.password}"/>
<hz:map name="loggedInUserMap" backup-count="1" eviction-policy="NONE" in-memory-format="BINARY">
<hz:near-cache time-to-live-seconds="0" max-idle-seconds="60"
eviction-policy="LRU" max-size="5000" invalidate-on-change="true"/>
</hz:map>
</hz:config>
</hz:hazelcast>
Run Code Online (Sandbox Code Playgroud) 我有一个性能用例,通过该用例,我需要确定花费300毫秒以上的某些process()调用EntryProcessor。我尝试使用SlowOperationDetector以下配置。
<!-- SlowOperation Detector Configuration -->
<property name="hazelcast.slow.operation.detector.enabled">true</property>
<property name="hazelcast.slow.operation.detector.stacktrace.logging.enabled">true</property>
<property name="hazelcast.slow.operation.detector.log.purge.interval.seconds">60000</property>
<property name="hazelcast.slow.operation.detector.log.retention.seconds">60000</property>
<property name="hazelcast.slow.operation.detector.threshold.millis">300</property>
Run Code Online (Sandbox Code Playgroud)
我给出了一个示例测试代码,该代码在内部睡眠1秒钟process()。
public static void main(String args[])
{
Config cfg = null;
try {
cfg = new FileSystemXmlConfig("C:\\workarea\\hazelcast\\hazelcast-perf.xml");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(cfg);
IMap<String, Employee> employeesMap = hazelcastInstance.getMap("anyMap");
employeesMap.put("100", new Employee(100));
SlowEntryProcessor slowEntryProcessor = new SlowEntryProcessor();
employeesMap.executeOnKey("100", slowEntryProcessor);
}
static public class SlowEntryProcessor implements EntryProcessor<String, Employee> …Run Code Online (Sandbox Code Playgroud) java distributed-cache distributed-caching hazelcast hazelcast-imap
我知道<min-eviction-check-millis>在hazelcast配置中定义了在检查此映射的分区是否可逐出之前应该通过的最短时间(以毫秒为单位).因此,在每个配置的间隔期间,将根据配置的驱逐策略在地图中执行驱逐.我有以下与此领域相关的问题.
Q1.驱逐操作是否在操作线程上运行?
Q2.驱逐操作会锁定它正在处理的整个分区吗?
Q3.如果我要遵循100毫秒的默认值(我相信这是一个非常小的值),我是否需要预期会有任何性能损失.
Q4.在以下情景中,驱逐行动的频率如何?
<map name="employees">
<in-memory-format>BINARY</in-memory-format>
<backup-count>1</backup-count>
<max-idle-seconds>1800</max-idle-seconds>
<eviction-policy>NONE</eviction-policy>
<time-to-live-seconds>0</time-to-live-seconds>
<min-eviction-check-millis>1000</min-eviction-check-millis>
<max-size>0</max-size>
<eviction-percentage>0</eviction-percentage>
<merge-policy>com.hazelcast.map.merge.PutIfAbsentMapMergePolicy</merge-policy>
</map>
Run Code Online (Sandbox Code Playgroud)
请注意,虽然没有配置驱逐策略和百分比,但最大空闲时间设置为1800秒.
上述问题的答案将帮助我在大规模部署中对这些配置所使用的值做出明智的决定.
java distributed-cache distributed-caching hazelcast hazelcast-imap