[英]handling large payload size in serverless app architecture
I have a serverless web app that is hosted on AWS.我有一个托管在 AWS 上的无服务器 web 应用程序。
Backend:后端:
1- Codebuild that fetch data from mysql DB and put it into dynamoDB 1- 从 mysql 数据库获取数据并将其放入 dynamoDB 的代码构建
2- API Gateway to send request to the Lambda that fetch all items in the dynamoDB 2- API 网关发送请求到 Lambda 获取 dynamoDB 中的所有项目
Front end:前端:
1- Angular JS code that send end flag(LastEvaluatedKey ) via API request to lambda 1- Angular 通过 API 请求向 lambda 发送结束标志(LastEvaluatedKey)的 JS 代码
2- Angular UI component primeng that show response in a table, the page takes large time to load. 2- Angular 在表格中显示响应的 UI 组件 primeng,页面加载时间较长。
The data in dynamo DB is pretty HUGE , and I'm doing a pagination on Lambda side to bring 100 record each time until it is completed. dynamo DB 中的数据非常巨大,我正在 Lambda 端进行分页,每次都带来 100 条记录,直到完成。
issue : on UI side, it takes large time to bring the full data, how can I enhance this to provide more user friendly experience?问题:在 UI 方面,获取完整数据需要很长时间,我该如何增强它以提供更友好的用户体验?
So your table is 6.7MB and you are doing a full table Scan
which will require you to read the entire dataset, resulting in 7 Scan
requests, each holding 1MB of data before filters are applied.所以你的表是 6.7MB,你正在做一个全表
Scan
,这将需要你读取整个数据集,导致 7 个Scan
请求,每个请求在应用过滤器之前持有 1MB 的数据。
As you've come to know, this approach is not scalable, as the performance of your query will degrade over time as data grows (the exact issue NoSQL was created to combat).正如您所知,这种方法不可扩展,因为随着数据的增长,您的查询性能会随着时间的推移而降低(创建确切的问题 NoSQL 是为了解决这个问题)。
My advice to you is to create a schema that allows you to use more efficient queries such as GetItem
or Query
where you only target the specific data tou require rather than the entire table.我对您的建议是创建一个模式,让您可以使用更高效的查询,例如
GetItem
或Query
,您只针对您需要的特定数据而不是整个表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.