如何重复使用连接或使用Apollo-Server REST DataSource的GraphQl中的连接池
我有一个带有apollo-server
和apollo-datasource-rest
库的GraphQl Server作为处理REST DataSource Connections的库。
由于大量的并发请求,我面临着一个从GraphQL到我的云托管服务的太多连接的问题。
当GraphQL Server向REST服务发出请求时,通过使用用于出站连接的azure snat
但是,由于每个新请求上的连接数量很高,因此SNAT端口的连接数量大。
避免此问题的可能方法之一是使用连接池或重用新请求的现有连接本文。
我的问题是如何重用阿波罗 - 服务器中的现有连接或如何实现连接池,以便我解决此问题。
I have a GraphQL server with apollo-server
and apollo-datasource-rest
as library to handle REST datasource connections.
I am facing an issue of opening too many connections from GraphQL to my cloud hosted services due to a high number of concurrent requests.
When the GraphQL server fires a request to a REST service there is a middle step in the cloud infrastructure to get service's private ip by using Azure SNAT for outbound connections
However, due to the high number of connections on every new request the SNAT ports get exhausted.
One of the possible ways to avoid this problem is to use connection pooling or reuse existing connections for new requests according to this article.
My question is how to reuse existing connections in Apollo-server or how to implement connection pooling so I solve this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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