从本地计算机连接时,AWS RDS非常缓慢 [英] AWS RDS painfully slow when connecting from local machine

查看:439
本文介绍了从本地计算机连接时,AWS RDS非常缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已启动并运行一个AWS RDS实例.当从我的网站(也在同一地区的AWS上)查询数据库时,它运行良好.但是,如果我尝试从本地开发计算机连接到数据库,则执行任何查询都需要AGES.有人知道为什么吗?我打开了安全组以允许连接(当我尝试从本地计算机连接时).

I have an AWS RDS instance up and running. When the DB is queried from my website (also on AWS, same region) it runs beautifully. But, if I try to connect to the database from my local developments machine it takes AGES for any query to execute. Does anyone know why? I have opened up the security group to allow connections (while i try to connect from the local machine).

推荐答案

此类问题可能有多种原因.有些原因可能如此明显,但出于答案的完整性而提及它们.您已经说过查询执行速度很慢,所以我认为连接建立成功,并且网络ACL,安全组等都没有问题.

There could be multiple reasons for a problem like this. Some reasons might be so obvious, but mentioning them for the completeness of the answer. You have said that queries execute slow, so I assume that connection establishes successfully and there is no problem with Network ACLs, Security Groups etc.

原因1:您的互联网连接速度太慢

这可能是由于许多原因.请参阅以下内容...

This could be due to many reasons. See the following...

  • 另一台使用您的互联网带宽的设备
  • 您在同一台设备上同时进行了一些并行下载
  • 您的互联网配额已超出
  • ISP速度问题

无论出于何种原因,这样的问题都会在一段时间后得到解决.使用.

For whatever reason, a problem like this will be solved after some time. Check your internet speed using this.

原因2:超出RDS实例上的最大连接数

您可能会达到MySQL的最大进程数限制.因此,当您连接并发出任何命令时,如果允许运行的进程数已饱和,则您必须等待,并且请求进入队列.但是,如果没有插槽,则超时.

You could be hitting a limit on the maximum number of processes for MySQL. So, when you connect and issue any command, then if the number of processes allowed to run are saturated, then you have to wait and your request goes into queue. But if you don't get a slot then after that it timeouts.

连接总数取决于您使用的实例类型.您可以检查并在数据库参数组选项中进行设置.搜索max_connections.

The total number of connections depends on the instance type you are using. That you can check and set in the DB parameters group option. Search for max_connections.

原因3:地理网络延迟

您的网站位于同一区域,因此到达RDS实例的网络跳数较少.但是您的本地计算机可能要经过多个跃点才能到达RDS并返回.通常,AWS相当快并且网络稳定,但是您可能会注意到某些协议的延迟问题.

Your website, being on the same region has a lower number of network hops to reach the RDS instance. But You local machine might take multiple hops to reach the RDS and return back. Generally AWS is pretty fast and has a stable network but you might notice latency issues for some protocols.

这不太可能,但这仍然可能是一个原因.

This is highly unlikely, but still could be a reason.

原因4:您的网络带宽不足

要查询多个记录,您的带宽可能不足以以惊人的速度返回它们.因此,您会看到数据库查询的速度缓慢.

To query for multiple records, your bandwidth might not be enough to return them in blazing speeds. Hence, you see the slowness in database queries.

这篇关于从本地计算机连接时,AWS RDS非常缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆