我们目前使用的是 GridGain 社区版 8.8.10。我们使用 Ignite 操作符在 Kubernetes 中设置了 Ignite 集群。该集群由 2 个启用了本机持久性的节点组成,我们使用胖客户端连接到 Ignite 集群。客户端也部署在同一个 Kubernetes 集群中。Cluster的内存配置如下:
-DIGNITE_WAL_MMAP=false -DIGNITE_QUIET=false -Xms6g -Xmx6g -XX:+AlwaysPreTouch -XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:+DisableExplicitGC
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
<property name="name" value="Knowledge_Region"/>
<!-- Memory region of 20 MB initial size. -->
<property name="initialSize" value="#{20 * 1024 * 1024}"/>
<!-- Maximum size is 9 GB -->
<property name="maxSize" value="#{9L * 1024 * 1024 * 1024}"/>
<!-- Enabling eviction for this memory region. -->
<property name="pageEvictionMode" value="RANDOM_2_LRU"/>
<property name="persistenceEnabled" value="true"/>
<!-- Enabling SEGMENTED_LRU page replacement …Run Code Online (Sandbox Code Playgroud) 我有一个带字符串作为键的缓存和TileKey(下面的类)作为值,我注意到当我执行查询(下面)时,即使使用了所有字段,性能也会受到缓存大小的线性影响.在查询中被索引.
这是一个代表性的基准 - 我使用相同的查询(下面)和所有基准测试的相同参数:查询返回(相同)所有基准测试中的30个条目
我用8gb单节点和4gb 2节点执行了基准测试,结果几乎相同(就查询速度而言相对于缓存大小而言)
我也尝试使用QuerySqlFieldGroup作为第一个组字段使用"time"字段,它应该将结果集减少到所有基准测试中的1000个条目,我不确定这是否是QuerySqlFieldGroup的正确用法.理解它应该主要用于缓存之间的连接查询.
我做错了什么或者这些是使用Ignite索引的预期查询性能?
代码:
String strQuery = "time = ? and zoom = ? and x >= ? and x <= ? and y >= ? and y <= ?";
SqlQuery<String, TileKey> query= new SqlQuery<String, TileKey>(TileKey.class, strQuery);
query.setArgs(time, zoom, xMin,xMax,yMin, yMax);
QueryCursor<Entry<String, TileKey>> tileKeyCursor = tileKeyCache.query(query);
Map<String, TileKey> tileKeyMap = new HashMap<String, TileKey>();
for (Entry<String, TileKey> p : keysCursor) {
tileKeyMap.put(p.getKey(), p.getValue());
}
Run Code Online (Sandbox Code Playgroud)
缓存配置:
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="KeysCache" />
<property …Run Code Online (Sandbox Code Playgroud) 我正在使用 Ignite 1.7.0 并正在测试 Apache Ignite 的 write Behind 功能。提出这个问题的动机是为了更好地了解在 Apache Ignite 中启用 write Behind 功能时幕后发生的情况。
我有一个 Ignite 客户端程序,它将在测试缓存中插入 20 个条目(称为“test_cache”)。
Ignite 服务器运行在同一台计算机上,但运行在不同的 JVM 上。
Ignite 缓存具有以下配置设置:
所有其他属性均设置为默认值。
除此之外,还有一个为缓存配置的缓存存储,代码如下:
package com.ignite.genericpoc;
import java.util.Collection;
import java.util.Map;
import javax.cache.Cache.Entry;
import javax.cache.integration.CacheLoaderException;
import javax.cache.integration.CacheWriterException;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.resources.CacheNameResource;
import org.apache.ignite.resources.IgniteInstanceResource;
public class IgniteStoreTest implements CacheStore<String, String> {
@IgniteInstanceResource
Ignite gridReference;
@CacheNameResource
String cacheName;
@Override
public String load(String key) throws CacheLoaderException {
System.out.println("load …Run Code Online (Sandbox Code Playgroud) 正如本文档建议的那样,可以通过设置执行 SqlQuery 时设置超时,https://ignite.apache.org/releases/2.4.0/javadoc/org/apache/ignite/cache/query/SqlQuery.html#setTimeout- int-java.util.concurrent.TimeUnit-
QueryCancelledException 的文档还提到,如果查询在执行时被取消或超时,则会引发已检查的异常,https: //ignite.apache.org/releases/2.4.0/javadoc/org/apache/ignite/cache/query /QueryCancelledException.html
这里提到了同样的方法作为取消/超时长时间运行的查询的方法, https://apacheignite-sql.readme.io/v2.4/docs/query-cancellation
但奇怪的是所有 IgniteCache.query(..) 方法的 java 文档,https://ignite.apache.org/releases/2.4.0/javadoc/org/apache/ignite/IgniteCache.html#query-org。 apache.ignite.cache.query.Query-不声明此已检查异常,或者就此而言,抛出任何已检查异常(与 QueryCursor.getAll() 方法相同),导致对查询超时处理的位置和方式进行编码的混乱。
我编写了下面的代码,但无法使查询超时以快速测试我的代码路径的该部分并查看其是否正确。我希望在 IgniteCache.query(..) 方法和 QueryCursor.getAll() 及其相关方法中都会抛出异常。
显然,SqlQuery.setTimeout(int timeout, TimeUnit timeUnit) 的最小超时粒度是 TimeUnit.MILLISECONDS,我在初始测试期间意识到,这使得强制测试超时变得更加困难。
下面的代码看起来正确吗?(我想避免游标方法并依赖在 try-with-resources 中调用的 IgniteCache.query(..) 来检测超时)。这行得通吗?
@Scheduled(fixedDelayString = "${checkInterval}", initialDelayString = "${checkDelay}")
private final void monitorHealth() {
if(!isReady) {
return;
}
try (QueryCursor<Entry<Integer, FabricInfo>> cursor = fabricInfoCache.query(SQL_QUERY)) {
cursor.iterator();
// Reset the query time out counter..
if(retryCount != 0) {
retryCount = 0;
LOGGER.warn("Client health check query executed without …Run Code Online (Sandbox Code Playgroud) 当通过Eclipse将Web应用程序部署到Tomcat时,Eclipse会覆盖$ catalina_home/conf/server.xml.这意味着,在应用程序部署之前我对server.xml所做的任何更改都会被Eclipse覆盖.
我的应用程序使用GridGain,因此我需要将以下行添加到server.xml:
<Listener className="org.gridgain.grid.loaders.tomcat.GridTomcatLoader" configurationFile="config/default-spring.xml"/>
Run Code Online (Sandbox Code Playgroud)
由于Eclipse每次部署新版本的应用程序时都会覆盖server.xml,因此我需要指示Eclipse在部署期间插入上述行(这适用于所有tomcat事件侦听器).这可能吗?如果没有,是否有基于GridGain的应用程序通过Eclipse部署的解决方法?
我通过Maven Dependency通过eclipse启动了Apache Ignite服务器,有人能告诉我如何通过visor命令监控缓存吗?如何通过Maven设置Apache Ignite时启用它?提前致谢
CacheConfiguration<String, JSONObject> conf = new CacheConfiguration<String, JSONObject>();
conf.setName("ABC");
conf.setWriteThrough(true);
conf.setReadThrough(true);
conf.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
conf.setOffHeapMaxMemory(0);
Run Code Online (Sandbox Code Playgroud)
这是我在ignite 1.9中的缓存配置,但是当我将Apache Ignite从1.9升级到2.0时,我在最后两行配置时遇到错误.
我无法理解 Apache Ignite 和 GridGain 平台之间的区别。他们是平等的吗?或者GridGain是Apache Ignite实现的一个标准?
我们有 3 个节点的 Gridgain 服务器,并且在 GCP Kubernetes 引擎中部署了 3 个客户端节点。集群已启用本机持久性。也<property name="shutdownPolicy" value="GRACEFUL"/>作为关闭政策。每个缓存都有一个备份。集群自动重启后分区丢失。需要通过执行控制命令来重置这些分区。
你能为此提供适当的解决方案吗?我们有大约 60GB 的持久数据。