Heroku Django application slower after moving postgres database to Amazon free RDS - django

I have a pilot Django project installed on Heroku using the free tier and the free Postgres database. However due to the size limitation on Heroku, I moved the database to Amazon RDS free tier which offers a lot more space and no row limit.
However after the move I notice a very slow performance in my Django app! Is there a way to reconfigure my setup to make my application/database go faster?

If it's the "free tier" of RDS, you are using a very small database (in terms of CPU and memory) so it shouldn't come as a surprise that it is slow. Specifically, the free tier is a t2.micro, which has one virtual CPU and 1gb of memory.
Also, your storage type (magnetic, ssd, provisioned iops) may make a substantial difference. You can observe the disk stats in cloudwatch for the RDS instance to see if that's the problem.

Related

How to Load Balance RDS on AWS

How can I load balance my Relational Database on AWS so that I don't have to pay for a large server that I don't need 99% of the time? I am pretty new to AWS so I am not totally sure if this is even possible. My app experiences surges (push notifications) that would crash the smaller DB instance class, but the larger (r5.4xlarge) isn't needed 99% of the time. How can I avoid paying for the larger instance? We are using MySQL.
This is the max CPUs utilization over the past 2 weeks for 16 CPUs and 128 GiBs RAM

Suitable Google Cloud Compute instance for Website Hosting

I am new to cloud computing, but want to use it to host a website I am building. The website will be a data analytics site, and each user will interacting with a MySQL database and reading data from text files. I want to be able to accommodate about 500 users at a time. The site will likely have around 1000-5000 users fully scaled. I have chosen GCP, and am wondering if the e2-standard-2 VM instance would be enough to get started. I will also be using a GCP HA MySQL server, I am thinking that 2 vCPU's and 5GB memory will be enough, with 50GB high availability SDD storage. Any suggestions would be appreciated? Also, is there anything other service I will need? Thank you!!
Your question is irrelevant. On Google Cloud Platform you have real time monitoring for CPU and RAM usage so you if your website is gaining more users you can just upgrade or downgrade your CPU or RAM with 2 or 3 mouse clicks. Start small and upgrade later if you see CPU or RAM is getting close to 100% usage. Start with a N1 chip micro instance 600MB RAM.

How to increase RAM size and database storage capacity in AWS

I have AWS linux based server with one project, and now I want to deploy another project on the same server. For this I want to know whether my existing memory is enough or should I have to increase the memory limit, and please let me know how to increase the memory limit.
Please refer the below images for available memory space.
There are two approaches to using a database in AWS.
You can install the database on the Amazon EC2 instance. You will then be responsible for configuring and maintaining the database and doing backups. The up-side is that it can run on the same EC2 instance as your application.
Or, you can use Amazon RDS to provide a database. Amazon RDS can install, configure and operate the database for you, including taking backups. It runs on a separate computer so there are additional costs involved, but there are many benefits to keeping a database separate from the application, such as allowing you to scale your application separately to the database. Large applications often run across multiple computers and they can all connect to the one database on Amazon RDS.
From your description, it looks like you are going with the first option. You can increase the disk capacity of the Amazon EC2 instance by increasing the size of the Amazon EBS disk volume (and then do a reboot). If you desire more RAM, then Stop the instance, change the Instance Type to something larger, then Start the instance again.

Migrating from AWS RDS to an AWS EC2 running MySQL

Yes, fellow SOrs, I'm doing it backwards. I tried an AWS RDS but the CPU seems to be spiking so often that I need the flexibility of an EC2 to run some fine tuning. I'm not a MySQL expert, so I'm asking:
How can I create a setup on the EC2 so that it reads and replicates my RDS?
Ideally I'd do the switch in real time via DNS but first I need the EC2 to act like a clone of the RDS updating with any new data happening between now and the actual migration period.
Any pointers are much appreciated. Thanks!
Why can't you use mysql-tuner with RDS?
You shouldn't need to run sysbench, since Amazon handles OS level tuning for you on RDS
Aurora is a drop-in replacement for MySQL and will scale better than any MySQL cluster you could setup on EC2
You should be addressing why your Wordpress instance is hammering the database so much instead of trying to optimize the database.
You should put a CDN in front of your Wordpress site and cache as much as you can to reduce the load on both your web server and database server. It looks like there are also solutions out there for using Redis to cache data so that Wordpress doesn't have to constantly go back to MySQL for data.
Amazon provides the CloudFront CDN, but I would also recommend looking into CloudFlare.
Honestly, given your number of concurrent users, unless you have tons of dynamic constantly changing content, you should be able to run your entire site on a t2.micro with CloudFlare in front of it with cache everything enabled.
I'd like to offer an update:
Mark B's input has been extremely valuable as I have discovered that I can run mysql tuner remotely and touch the RDS. Therefore there was no need to migrate after all.
The RDS CPU spikes were due to a large amount of non-INDEX JOINs.
I have added indexes and the results are fantastic:

How to change storage size while restoring RDS from snapshot?

I want to restore RDS using a snapshot.But old RDS is having 50 GB allocated storage and magnetic type allocated storage. I took snapshot of this RDS and want to restore it to general purpose SSD type. But as SSD requires 100 GB minimum. How can we restore new RDS?
Try restoring to the same type of RDS (50GB, magnetic) and then upgrading the hardware features to the new ones (100GB, general purpose SSD).
Be aware that when you change hardware settings your RDS will go offline for a few minutes for upgrading, so your application will disconnect from the database. If it is a 24/7 app, perform this during maintanance window.