database - Memory consumption in Apache Ignite - BinaryObject vs concrete class vs SQL
问题描述
I'm wondering how to save data in Ignite. To my understanding there are three methods:
- Using a data grid with BinaryObject as value - the main advantage is that the object can be dynamic.
- Using a data grid with a concrete class (e.g. Employee) as value.
- Using the SQL interface, and using predefined schemas.
Do you know if there are any differences in terms of memory consumption between these methods? I suspect that at least when using BinaryObject, the system must save the keys (some serialized representation), so it may take more memory than the other methods.
What is the most cost-effective method?
Thanks! Gal
解决方案
There is no difference between these methods in terms of occupied space. Any of the mentioned approaches can be used to access the same data, since all of them operate over BinaryObject format. But they are different in other ways.
When using POJO classes, serialization and deserialization into binary format happens on every data access or modification. This method leads to higher CPU usage and heap memory consumption. Note, that stored memory stays the same, but the footprint grows.
BinaryObject approach is more effective in terms of performance, because it doesn't require serialization. BinaryObject interface works directly with the serialized representation.
SQL also operates over BinaryObjects without deserialization, so there is not much difference between approaches 1 and 3. SQL has a few points, that should be taken into account though. See https://apacheignite-sql.readme.io/docs/performance-and-debugging
推荐阅读
- java - Spark SQL 执行失败并出现错误:java.lang.NoClassDefFoundError: org.codehaus.janino.InternalCompilerException
- windows - Robot Framework如何最大化windows应用程序
- angular - Angular 自定义预加载策略
- r - 在R中循环数据框的行
- git - 如果存在,则与 origin/develop 合并,否则与 origin/master 合并
- javascript - 使用 Angular [Chrome] 处理后退按钮
- rust - LLDB 中的调用堆栈仅显示一帧 (Windows)
- javascript - 使用 html 和 javascript 使用表单将新项目添加到容器
- mysql - 所选 cid 的第一行然后显示其他行
- javascript - 我应该向我的 Next.js 项目添加自定义后端吗?