【问题标题】:Data Load to Ignite cache is very slow from Oracle Table从 Oracle 表加载到 Ignite 缓存的数据非常慢
【发布时间】:2020-01-27 08:40:21
【问题描述】:

我正在尝试使用 Cache Store Load Cache 方法将数据从 Oracle 表加载到 Ignite Cache。

以下是 Load Cache 方法中实现的逻辑,用于使用 Ignite Cache 从 Oracle 表中加载数据。

  1. JDBC连接器用于连接Oracle Table,数据在Result Set Cursor中可用。
  2. while 循环用于循环遍历结果集对象并将数据插入缓存中。

有没有其他方法可以将数据从 Oracle 表插入到 Ignite Cache。如果可能,请分享示例代码。

【问题讨论】:

  • 使用结果集游标加载 10 万条数据需要将近 1 小时的时间来点燃缓存
  • 你有自己的缓存存储实现吗?切换到CacheJdbcPojoStore 有帮助吗?

标签: ignite


【解决方案1】:

在这里您可以看到使用 Spark 的一种可能变体:

1)使用 Spark Data Frames 从 Oracle 加载数据

https://dzone.com/articles/read-data-from-oracle-database-with-apache-spark

2) 使用 Ignite Spark 集成将 Oracle 数据帧中的值存储到 Ignite:

https://apacheignite-fs.readme.io/docs/ignite-data-frame

String configPath = "client.xml";

SparkConf sparkConf = new SparkConf()
 .setAppName("Example");

SparkSession session = SparkSession.builder()
 .config(sparkConf)
 .getOrCreate();

Dataset < Row > oracleDataset = ...; //Read from Oracle DB

DataFrameWriter < Row > df = oracleDataset
    .write()
    .format(IgniteDataFrameSettings.FORMAT_IGNITE())
    .option(IgniteDataFrameSettings.OPTION_CONFIG_FILE(), configPath)
    .option(IgniteDataFrameSettings.OPTION_TABLE(), "Person")
    .option(IgniteDataFrameSettings.OPTION_CREATE_TABLE_PRIMARY_KEY_FIELDS(), "id, city_id")
    .option(IgniteDataFrameSettings.OPTION_CREATE_TABLE_PARAMETERS(), "template=partitioned,backups=1")
    .mode(Append);

df.save();

session.close();

同样,您可以使用其他流媒体工具,例如 Ignite Kafka 流媒体。

https://rmoff.net/2018/12/12/streaming-data-from-oracle-into-kafka-december-2018/

https://apacheignite-mix.readme.io/docs/kafka-streamer

您可以在此处查看所有 Ignite 集成:

https://apacheignite-mix.readme.io/docs/getting-started

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-26
    • 1970-01-01
    • 1970-01-01
    • 2014-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多