Code Monkey home page Code Monkey logo

amazon-elasticache-caching-for-amazon-rds's Introduction

Amazon ElastiCache Caching for Amazon RDS

Optimize cost, increase throughput and boost performance of Amazon RDS workloads using Amazon ElastiCache

The purpose of this project is to help you reproduce test harness of Relational Database Management Systems (RDBMS) like Amazon Relational Database Service (RDS) with and without a Cache such as Amazon ElastiCache.

In-memory caching improves application performance by storing frequently accessed data items in memory, so that subsequent reads can be significantly faster than reading from the primary database that may default to disk-based storage.

Sample dataset

For practical purposes the data used for this test is the airportdb database with approximately 2GB in size and consists of 14 tables containing a total of 56 million records.

You can bring your own database and run your own queries as well to have an initial idea of the benefits caching can have over your specific workload.

Architecture

The following Architecture diagram shows the test environment using Amazon Elastic Compute Cloud (EC2) as the compute layer where 1 or more instances can be used to send requests to our databases RDS + ElastiCache. For this particular test Amazon ElastiCache for Redis is used, but note that a similar test can be done using Amazon ElastiCache for Memcached.

Architecture diagram of test environment

Deploy Infrastructure

Option 1: Deploy new resources with sample data

Prerequisites

  1. Clone this repository
git clone [email protected]:aws-samples/amazon-elasticache-caching-for-amazon-rds.git
cd amazon-elasticache-caching-for-amazon-rds
  1. Deploy the Infrastructure
cd infrastructure
# Create a Python environment
python3 -m venv .venv
source .venv/bin/activate
# Install required packages
pip install -r requirements.txt
cp .env.example .env
  1. Modify .env with Accound and AWS Region
AWS_ACCOUNT=<your_AWS_account_id>
AWS_REGION=<your_AWS_region>
  1. Run CDK deployment
cdk bootstrap
cdk synth
cdk deploy -c keyName=<your_keypair>

Option 2: Run tests on your existing infrastructure

Prerequisites

  • Python 3.8+
  • EC2 Instace with access to an ElastiCache and RDS clusters
  1. Log into the Bastion Host EC2 instance

  2. Clone this repository

git clone [email protected]:aws-samples/amazon-elasticache-caching-for-amazon-rds.git
cd amazon-elasticache-caching-for-amazon-rds

Run Performance Tests

  1. Configure performance test
cd performance
# Create a Python environment
python3 -m venv .venv
source .venv/bin/activate
# Install required packages
pip install -r requirements.txt
cp .env.example .env
  1. Configure ElastiCache and RDS details from the secret manager and cloudformation outputs on the .env file
ELASTICACHE_HOST="<dns_configuration_endpoint>"
ELASTICACHE_PORT=6379
MYSQL_HOST="<dns_configuration_endpoint>"
MYSQL_DB="db_name"
MYSQL_USER="admin"
MYSQL_PASS="secret_password"
MYSQL_PORT=3306
  1. Run Harness Test
python -m harness.main --rdbms MYSQL --threads 4 --queries 1000000 --read_rate 80

The output in the console should look similar to the following screenshot:

RDBMS-Cache_Test

Credits

License for the airportdb Database

This work is adapted from the Flughafen DB by Stefan Proell, Eva Zangerle, Wolfgang Gassler, which is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) License. To view a copy of this license, visit https://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons PO Box 1866, Mountain View, CA 94042.

FlughafenDB. (2015). Stefan Proell, Eva Zangerle, Wolfgang Gassler. www.flughafendb.cc. https://doi.org/10.5281/zenodo.3968361

AirportDB - FlughafenDB

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

amazon-elasticache-caching-for-amazon-rds's People

Contributors

amazon-auto avatar dependabot[bot] avatar rlunar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.