spring-boot - Apache Ignite:我的数据是从内存还是磁盘读取的?
问题描述
我需要了解 Ignite 的以下配置是否将从内存或磁盘提供我的数据。
点燃配置:
<property name="dataStorageConfiguration">
<bean class="org.apache.ignite.configuration.DataStorageConfiguration">
<property name="defaultDataRegionConfiguration">
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
<property name="persistenceEnabled" value="true"/>
</bean>
</property>
</bean>
</property>
Java 代码:
ClientConfiguration cfg = new ClientConfiguration().setAddresses("127.0.0.1:10800");
try (IgniteClient client = Ignition.startClient(cfg)) {
ClientCache<Long, SensorsWaiting> cache = client.cache("SQL_PUBLIC_FOO");
FieldsQueryCursor<List<?>> query = cache.query(new SqlFieldsQuery("select * from foo"));
}
问题的背景:我预计会有大量查询,并且需要从内存中提供结果。同时我需要将数据存储到磁盘以防 Ignite Server 崩溃或需要重新启动。
- 我的理解是否正确,在这种情况下,我的数据是从内存中提供的?
- 如果我使用 JDBC 驱动程序会怎样?还是一样吗?缓存和jdbc驱动有什么区别?
解决方案
如果它在内存中,它将从内存中提供,否则将从磁盘中提取。(如果数据多于内存或集群启动时,这种区别很重要。)
不同的 API 都访问相同的数据。无论您使用 JCache(get、put)、SqlFieldsQuery 还是 JDBC/ODBC,都一样。
推荐阅读
- java - JaCoco MVN 未知块类型
- reactjs - 如何在 React 的 Material UI 库的选项卡组件中禁用波纹
- python - python logging.basicConfig 不会覆盖现有的日志文件
- apache-spark - 在 Spark 中读取文件时的分区数据
- ios - 如何使用 Mac-catalyst 应用程序的 CloudKit 数据库订阅调试“获取断言时出错”?
- python - UTF-8 is not saving txt file correctly - Python
- apache-nifi - 无法访问 NIFI UI?
- marklogic - 访问 SQL 视图的行引用的文档
- linux - 如何在 vscode 上打字更快?
- php - 通过 laravel 将多表行插入数据库