简体   繁体   English

React Native + AWS AppSync - 最大数据存储

[英]React Native + AWS AppSync - maximum data storage

I'm building an offline application which needs to store around 30,000 records.我正在构建一个需要存储大约 30,000 条记录的离线应用程序。

Will AWS AppSync have any performance issues with a data set of this size? AWS AppSync 是否会对这种规模的数据集产生任何性能问题?

I've used redux w/ redux-persist in the past, which saves the store offline, then refetchs and places in memory when the app launches.我过去使用过带有 redux-persist 的 redux,它可以离线保存商店,然后在应用程序启动时重新获取并放置在内存中。 This causes fairly huge memory issues, especially when querying the data.这会导致相当大的内存问题,尤其是在查询数据时。

I'm wondering if AppSync has the ability to use Realm or SQLite for offline storage and querying.我想知道 AppSync 是否有能力使用 Realm 或 SQLite 进行离线存储和查询。

Thanks.谢谢。

This is an old question, but for posterity: AWS Amplify's DataStore fulfills precisely this role.这是一个古老的问题,但对于后代来说: AWS Amplify 的 DataStore正好完成了这个角色。 It works with data locally and handles syncing to and from AppSync behind the scenes.它在本地处理数据,并在后台处理与 AppSync 的同步。 You write pretty simple, concise things like this:你写的非常简单,简洁的东西是这样的:

// putting data
DataStore.put(new YourModel({ ... });

// getting data
const records = DataStore.query(YourModel);

// getting realtime updates
const subscription = DataStore.observe(YourModel).subscribe(msg => {
  console.log(msg.model, msg.opType, msg.element);
});

DataStore runs these queries against local storage (implementation of which varies by platform), performs sync's and established subscriptions for you behind the scenes (when online). DataStore针对本地存储(其实现因平台而异)运行这些查询,在幕后(在线时)为您执行同步和已建立的订阅。

Refer to the docs for more complete information.有关更完整的信息,请参阅 文档

In addition to the previous answer, and to respond to your mention of sqlite, Amplify DataStore uses IndexedDB by default for local storage.除了上一个答案,为了回应您提到的 sqlite,Amplify DataStore 默认使用 IndexedDB 进行本地存储。 This storage is persistent across browser restarts and machine restarts.此存储在浏览器重新启动和机器重新启动时是持久的。 Based on my research IndexedDB can store up to 50MB for a DataStore app if the user has disk space for it.根据我的研究,如果用户有磁盘空间,IndexedDB 最多可以为 DataStore 应用程序存储 50MB。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM