WavebreakmediaMicro - Fotolia
As more services are offered in the cloud, enterprises want to move databases off-premises to save space and money. There has been a lot of discussion on whether it's better to run a database on a dedicated cloud instance or use a database as-a-service. Even Amazon Web Services (AWS) offers two choices: Elastic Block Storage and Relational Database Service. But which AWS database service will match your enterprise's needs and database performance requirements?
Elastic Block Storage (EBS). As a block-level storage service, EBS offers persistent storage for AWS Elastic Compute Cloud (EC2) instances. Users can launch EC2 instances and attach an EBS volume as the root or additional device for persistence storage. Users can also install any relational database management system (RDBMS) within that EBS volume to manage the data.
Relational Database Service (RDS). As a managed database service, AWS RDS allows end users to set up and operate relational databases in the cloud. RDS offers ready to use services to scale databases, achieve high availability, perform automatic backup and restoration, and reach higher I/O performance levels.
EBS is persistent; RDS is consistent
AWS EBS block-level storage works with EC2 instances. It ranges from 1 GB to 1 TB in size; however, admins can increase that size by striping multiple volumes.
EBS has several advantages. Because it is persistent storage, even if an EC2 instance goes down, the data will not be lost. IT also provides excellent backup and restore options using snapshots, which can also help increase the size of your EBS volume during recovery.
Users can install any RDBMS -- unlike RDS, which is limited to four RDBMS (Microsoft SQL Server, MySQL, Oracle and PostgreSQL). And finally, if users host databases in EBS volumes, they own the database and are responsible for managing it. With full access to the database, end users can fine-tune and optimize it, as needed.
RDS, on the other hand, is a fully managed database, which means admins don't need to worry about installing or managing it. It offers high availability, known as multi-availability zones, or multi-AZ, which is ideal for production databases. And its backup and restore options feature automated backup to recover the last five minutes of data.
AWS RDS has read replicas with AWS MySQL, which can achieve horizontal scaling by distributing read-only loads to replicas. RDS also uses EBS to store data. And for larger databases, RDS internally stripes volumes to maintain performance. Other advantages include higher IOPS compared to EBS volumes and improved metrics with AWS CloudWatch, which helps gauge database performance levels.
But even though RDS appears to have a few more advantages over EBS, it isn't perfect. It has a few limitations admins should be familiar with. First, users do not have secure socket shell (SSH) access to database instances. Users also do not have full admin access to databases. Finally, a compulsory maintenance window may cause downtime in certain cases.
Maintain AWS database performance
Whether you choose EBS or RDS, database performance is critical. If jobs are running slowly in the company, cloud admins will have to field complaints from end users. There are a few tweaks admins can make to ensure performance in an AWS cloud database.
Select the appropriate EC2 or RDS instance size. The amount of bandwidth allocated to an instance differs depending on the size of the instance, which ultimately affects I/O performance. The bigger the instance, the better the performance will be. Admins should also use Provisioned IOPS storage, which meets the needs of I/O-intensive workloads.
Using EBS-optimized instances can also improve performance. With EBS, this provides dedicated throughput between EBS and EC2 instances. For RDS, admins should select the instance type that offers EBS-optimized bandwidth.
If you don't need dedicated I/O, use general-purpose storage (solid-state drives) for both EBS and RDS. It provides better performance compared to other volume storage options. Using the latest and most appropriate instance level also helps improve database performance. Striping multiple volumes together can also offer better performance. Finally, don't take frequent snapshots unless it's absolutely necessary. Because a snapshot is an incremental backup, it will affect the performance of your EBS volume each time it runs. If you have a high load on the database and you take snapshots at regular intervals, it can affect database performance.
Moving from EBS to RDS
Many companies have started with EBS and moved to RDS because it provides better options for production database management. Often, companies going through this transition have experienced subpar database performance levels. But that doesn't have to be the case.
Follow these tricks to ensure performance doesn't take an additional hit when moving from AWS EBS to RDS.
- Pick an RDS instance with a large amount of storage. Larger sizes above 100 GB use internal striping with EBS volumes and that can improve performance.
- Select an RDS instance that delivers dedicated EBS-optimized 500/1000 Mbps throughput. EBS-optimized instances help minimize contention between Amazon EBS I/O and other traffic from EC2 instances, reducing latency and improving throughput.
- Setup RDS with better Provisioned IOPS. For fast and consistent I/O performance, use higher IOPS (1,000+) because that maintains low latency and provides higher throughput.
- PIOPS is very important for random reads and writes, but when you have a sequential workload, you also have to consider database and instance sizes.
- If you have high read options, set up read replicas (MySQL) to improve database performance.
- RDS also provides metrics, such as CPU utilization, database connections and free storage space. Observe these metrics carefully and optimize the instance if you're not seeing the performance you want or expect.
- Enable automated backup and maintenance activities in off-peak hours.
- Fine-tune the database parameters with parameter groups.
- Use caching services, such as ElastiCache, or a managed caching service. Enabling a caching service means that some of the most frequently accessed data will be stored in cache (memory).
- When designing a new database plan, consider sharding for future database scalability.
Performance tuning for AWS databases is not magic; it does not follow a one-size-fits-all approach. Once you understand what your database requires, you can monitor and improve performance intelligently.
About the author:
Ofir Nachmani is a business technology advisor, blogger and lecturer. Ofir's extensive experience in the world of business technology has made his critically acclaimed blog, IamOnDemand.com, the go-to guide for modern technology startups and developers in the world of cloud computing. Today he advises organizations, leading them through new IT market modifications, while building and executing a modern go-to-market strategy.