Appsync vs Apollo GraphQl性能
AWS提出了为Appsync创建LAMBDA解析器的理由,该解析器将执行不同的操作。由于单个查询可能会导致对多个操作的调用,因此AppSync将多次调用Lambda解析器。我认为每个调用将有助于该请求的总体延迟。与Apollo或Express GraphQl Server的无服务器实现相比(GraphQl Server和在单个Lambda函数中运行的解析器)的实现。
参考。 https://docs.aws.amazon.com/ appsync/最新/devguide/tutorial-lambda-resolvers.html
exports.handler = (event, context, callback) => {
switch(event.field) {
case "operation_1": {/* ... */}
case "operation_2": {/* ... */}
case "operation_3": {/* ... */}
...
default: {/* ... */}
}
};
AWS makes a case to create a lambda resolver for AppSync that will perform different operations. Since a single query may result in calls to multiple operations, AppSync will invoke the lambda resolver multiple times. I think each invocation will contribute to the overall latency for the request. How does this compare to serverless implementation of Apollo or Express GraphQL Server (GraphQL Server and Resolvers running inside a single lambda function).
Ref. https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-lambda-resolvers.html
exports.handler = (event, context, callback) => {
switch(event.field) {
case "operation_1": {/* ... */}
case "operation_2": {/* ... */}
case "operation_3": {/* ... */}
...
default: {/* ... */}
}
};
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论