When connecting to my AWS RDS from my AWS machine it works great, but when trying to connect from my local machine - it takes a lot of time.
It is slow when executing some queries(for some it takes longer than others).
Slow means more than 5 seconds for a query that takes less than 1 second on my production server.
My production server & RDS are in N.virginia (USA) while I am in Israel.
When uploading my project to the production server it works fast (less than a second for the query), but when working from my local network it takes more than 5 seconds!
I was looking for an answer all over the web with no success.
For local development consider setting up a development database on your workstation. You can install the database on your machine for development and configure your project to connect to it instead of production. This is generally a considered a best practice anyway.
Another consideration is to setup a database closer to your region. Check this page for services in your area.
Related
We have a java application running on Tomcat that was hosted on AWS EC2 with a RDS database. We migrated the application to Azure, and the performance dropped significantly. In EC2 we had a md5.large machine (2 CPUs, 8GB) and in Azure we have P2V2 (2 CPUs, 7GB).
The database stayed in RDS, so one of our hypothesis is that we are losing performance with database traffic, since they are on different hosts now. Could that be it? If so, would creating a VPN help in any way?
The short answer is yes, you will now have lag between your application server and the DB. The VPN would not make that much of a difference. What you want is to have your DB close to your application server again. One of the ways to do that would be to either also migrate your RDS to Asure or if your RDS need to stay in AWS then see if you can replicate your DB to Asure (Depends on DB type).
Imagine two cases:
I have web server running in an EC2 instance and it is connected to the database in the RDS, the managed database service.
I have web server and database running in the same EC2 instance.
Is my database in RDS going to be slower to access because it's not in the same machine?
How many milliseconds, approximately, does it add to your latency between the two?
Does this become bottleneck?
What about other managed database services like Azure, GCP, Digital Ocean, etc?
Do they behave the same?
Yes, it will be slower to RDS instances from your Webserver than a database on the same host, because you need to go over the network and that adds latency.
The drawback of running the DB on the same server is that you can't use a managed service to take care of your database and you're mixing largely stateless components (webserver) with stateful components (database). This solution is typically not scalable either. If you add more webservers, things get messy.
Don't know about Azure, GCP or Digital Ocean, but I'd be very surprised if things are different there. There's good reasons to separate these components.
Today I set up my first VM instance on Google Cloud Platform.
I wanted to install a simple lampp server with apache, php and MySQL.
And this is what I have done (ssh and a bunsh of apt-get install).
Everything works fine!
Now I heard that these instances are suppose to be scalable, which means if I have 100,000 http requests per second on my server it shouldn't lag.
So why do I need to select the RAM to install on my VM instance (shouldn't I pay according to the resources my VM use)?
Because I chose 2Go but will my instance be able to serve the 100,000 http request per s?
If not, what is the point to choose a VM instance instead of a VPS or dedicated server (because I can also choose my RAM on these solutions)?
I currently develop a small Java web application with following stack: Java 8, Spring Boot, Hibernate, MariaDB, Docker, AWS (RDS, Fargate, etc.). I use AWS to deploy and to run my application. My java web application runs inside of the docker container, which is managed by AWS Fargate; this web application communicates with Amazon RDS (MariaDB instance) via injected secrets and doesn't need to go through public internet for this kind of communication (instead it uses VPC). My recent problems have begun after I've managed to roll out an software update, that enforced me to make some manual database changes with use of MySQL Workbench and I could not perform this because of local connectivity problems.
Therefore my biggest problem right now is the connectivity to the database from the local machine - I simply can't connect to the RDS instance via MySQL Workbench or even from within the IDE (but it used to work before without such problems). MySQL Workbench gave me following error message as a hint:
After check of given hints from MySQL Workbench I've also checked that:
I use valid database credentials, URL and port (the app in Fargate has the same secrets injected)
Public accessibility flag on RDS is (temporarily) set to "yes"
database security group allows MySQL/Aurora connections from my IP Address range (I've also tested the 0.0.0.0/0 range without further luck)
Therefore my question is: what else should I check to find out the reason of my connectivity failure?
After I've changed my laptop network by switching to the mobile internet the connectivity problem was solved - therefore I suspect, that my laptop was not able to establish the socket connection from the previous network (possibly the communication port or DNS was blocked).
Therefore also don't forget to check the network connectivity by establishing a socket connection like it is described in this answer.
I have a mysql server hosted by AWS RDS, which is intermittently uncontactable. I've been doing a lot of development today on a page that, although hosted locally, executes a query against the remote server on each page load, and I've discovered that every few minutes, I suddenly can't reach the server - it only lasts for a few seconds, but during that time I get the error SQLSTATE[HY000] [2003] Can't connect to MySQL server from any attempt to reach it.
Existing, already open connections (i.e. from the command line client) are not affected, and can run queries as normal. It's only establishing a new connection that is impossible.
Why does this happen? How can I track down the cause?
You might be using a instance type too small, t1.micro and t2 instances can show that behavior sometimes. What instance-type are you using?
Your CPU capacity might be throttled, and that could be the reason you see intermittent performance.