SlideShare a Scribd company logo
From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 1
From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 2
With the increasing number of apps going live on the web, it's becoming common to see
that they use multiple servers. This is mainly due to scalability and availability purposes. But,
these types of applications are also often not as responsive as they should be. Using a simple
gem called DynamoDB and Memcached will allow you to achieve higher performance in your
Rails app. Let me explain,
What is Memcached
Memcached is a high performance, free and open source distributed memory caching system
used to speeding up dynamic web applications by alleviating database load. Memcached is
simple yet powerful. Its simple design promotes quick deployment, ease of development, and
solves many problems facing large data caches.
It is used for speeding up dynamic web applications by reducing database load. In other words,
every time a database request is made it adds additional load to the server. Memcached
reduces that load by storing data objects in dynamic memory (think of it as short-term memory
for applications). Memcached stores data based on key-values for small arbitrary strings.
How does Memcached work?
Memcached is comprised of four main components
1. Client software - Which is given a list of available Memcached servers
2. A client-based hashing algorithm - Chooses a server based on the "key"
3. Server software - Stores values and their keys into an internal hash table
4. LRU - Determines when to throw out old data or reuse memory
Each item is comprised of a key, expiration time, and raw data.
From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 3
At a high-level Memcached works as follows:
1. The client requests a piece of data which Memcached checks to see if it is stored in
cache.
2. There are two possible outcomes here:
1. If the data is stored in cache: return the data from Memcached (no need to
check the database).
2. If the data isn't stored in cache: query the database, retrieve the data, and
subsequently store it in Memcached.
3. Whenever information is changed or the expiry value of an item has expired,
Memcached updates its cache to ensure fresh content is delivered to the client.
A few important points about Memcached architecture include:
Data is only sent to one server.
Servers don't share data.
Servers keep values in RAM. If RAM runs out the oldest value is discarded.
What is DynamoDB
Amazon DynamoDB is a fully managed NoSQL database service that provides fast and
predictable performance with seamless scalability. With DynamoDB, you can create database
tables that can store and retrieve any amount of data and serve any level of request traffic. You
can scale up or scale down your tables' throughput capacity without downtime or performance
degradation.
DynamoDB is a particularly good fit for the following use cases
Applications with large amounts of data and strict latency requirements
Server less applications using AWS Lambda
From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 4
Data sets with simple, known access patterns
Installing Memcached
There are a few ways you can install Memcached. Depending on which system you're using, the
method will vary. As outlined on the official Memcached Installation Wiki, installation from a
package is simple.
Using Memcached with DynamoDB in Rails
Memcached is a quick in-memory protest reserving framework that can make Rails run much
quicker with not very many changes. Memcached will work on any database used in Rails
application.
When the table is small and request volume is low this isn’t much of an issue, but as your
database and user volume grow, these can impact the performance of your application. In such
cases Memcached plays an important role to reduce the database load by caching the request
object in memory.
To use Memcached in Rails app, follow the below steps
Install dalli gem
gem 'dalli'
Add "dalli" gem to your gem file and install it.
Development/Production file
config.cache_store = :dalli_store
From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 5
config.action_controller.perform_caching = true
Add the above lines in your development.rb or production.rb file as per the requirement
Add Memcached in your method
search_query = "user_id = :user_id AND is_approved = :is_approved"
search_param = {":user_id" => params[:user_id], ":is_approved" => 't'}
all_games = Rails.cache.fetch('all_lists', expires_in: 2.minutes)
{
do_scan(Article.table_name,search_query,search_param)
}
The above query syntax is an example of combination of Memcached and DynamoDB. In this
example once the query executed and the result will store in the "all_list" key of the
Memcached and expire after 2 minutes automatically.
Conclusion:
DynamoDB and Memcached is a powerful combination for your Rails app. If you're looking to
improve the performance of your Rails application, this may be the solution for you.
DynamoDB and Memcached involves storing information in an external database, which can be
retrieved with a single call. This will allow you to avoid the constant querying of data from your
application's memory.
From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 6
There are many benefits to this gem, but most importantly, increased response time for your
application. Faster response times mean less downtime and more satisfied customers.
You have rails application but don’t know how to maximize the performance with DynamoDB
and Memcached. Andolasoft has experienced rails developer who has good hands on
DynamoDB and Memcached. So fell free to discuss about your project. Book a free consultation
Ad

Recommended

PDF
Introducing windows server_app_fabric
Marco Titta
 
PPTX
Scalable Web Architecture and Distributed Systems
hyun soomyung
 
PPTX
Caching up is hard to do: Improving your Web Services' Performance
RTigger
 
PPTX
Cassandra vs. MongoDB
ScaleGrid.io
 
PDF
A to z for sql azure databases
Antonios Chatzipavlis
 
PPTX
DBaaS - The Next generation of database infrastructure
Emiliano Fusaglia
 
DOC
No sql exploration keyvaluestore
Balaji Srinivasaraghavan
 
PPT
Web Server Hardware and Software
webhostingguy
 
PPTX
high performance databases
mahdi_92
 
PDF
Consistent join queries in cloud data stores
João Gabriel Lima
 
PDF
SQL Server 2016 novelties
MSDEVMTL
 
PPT
Mule database-connectors
Phaniu
 
PDF
Scalable web architecture
Kaushik Paranjape
 
PPTX
Getting the most out of MariaDB MaxScale
MariaDB plc
 
PPTX
EEDC 2010. Scaling Web Applications
Expertos en TI
 
ODP
Caching Strategies
Michal Špaček
 
PPTX
Data Management
Mufaddal Nullwala
 
PPTX
Java script framework
Debajani Mohanty
 
PDF
Using all of the high availability options in MariaDB
MariaDB plc
 
PDF
Geek Sync | Planning a SQL Server to Azure Migration in 2021 - Brent Ozar
IDERA Software
 
PPTX
Azure SQL Database
Palash Debnath
 
PPTX
MinneBar 2013 - Scaling with Cassandra
Jeff Smoley
 
PPT
Gavin M
Ontico
 
PDF
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
PDF
Sql server 2016 new features
Ajeet Singh
 
PDF
Parameter substitution in Aginity Workbench
Mary Uguet
 
PPTX
Introduction To MongoDB
ElieHannouch
 
PPTX
SQL server part 1
Birhanu Dagnew Sendek
 
PDF
Kickin' Ass with Cache-Fu (with notes)
err
 
PDF
Memcached Presentation
Asif Ali
 

More Related Content

What's hot (20)

PPTX
high performance databases
mahdi_92
 
PDF
Consistent join queries in cloud data stores
João Gabriel Lima
 
PDF
SQL Server 2016 novelties
MSDEVMTL
 
PPT
Mule database-connectors
Phaniu
 
PDF
Scalable web architecture
Kaushik Paranjape
 
PPTX
Getting the most out of MariaDB MaxScale
MariaDB plc
 
PPTX
EEDC 2010. Scaling Web Applications
Expertos en TI
 
ODP
Caching Strategies
Michal Špaček
 
PPTX
Data Management
Mufaddal Nullwala
 
PPTX
Java script framework
Debajani Mohanty
 
PDF
Using all of the high availability options in MariaDB
MariaDB plc
 
PDF
Geek Sync | Planning a SQL Server to Azure Migration in 2021 - Brent Ozar
IDERA Software
 
PPTX
Azure SQL Database
Palash Debnath
 
PPTX
MinneBar 2013 - Scaling with Cassandra
Jeff Smoley
 
PPT
Gavin M
Ontico
 
PDF
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
PDF
Sql server 2016 new features
Ajeet Singh
 
PDF
Parameter substitution in Aginity Workbench
Mary Uguet
 
PPTX
Introduction To MongoDB
ElieHannouch
 
PPTX
SQL server part 1
Birhanu Dagnew Sendek
 
high performance databases
mahdi_92
 
Consistent join queries in cloud data stores
João Gabriel Lima
 
SQL Server 2016 novelties
MSDEVMTL
 
Mule database-connectors
Phaniu
 
Scalable web architecture
Kaushik Paranjape
 
Getting the most out of MariaDB MaxScale
MariaDB plc
 
EEDC 2010. Scaling Web Applications
Expertos en TI
 
Caching Strategies
Michal Špaček
 
Data Management
Mufaddal Nullwala
 
Java script framework
Debajani Mohanty
 
Using all of the high availability options in MariaDB
MariaDB plc
 
Geek Sync | Planning a SQL Server to Azure Migration in 2021 - Brent Ozar
IDERA Software
 
Azure SQL Database
Palash Debnath
 
MinneBar 2013 - Scaling with Cassandra
Jeff Smoley
 
Gavin M
Ontico
 
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
Sql server 2016 new features
Ajeet Singh
 
Parameter substitution in Aginity Workbench
Mary Uguet
 
Introduction To MongoDB
ElieHannouch
 
SQL server part 1
Birhanu Dagnew Sendek
 

Similar to How to boost performance of your rails app using dynamo db and memcached (20)

PDF
Kickin' Ass with Cache-Fu (with notes)
err
 
PDF
Memcached Presentation
Asif Ali
 
PDF
Scaling Rails with memcached
elliando dias
 
PDF
Memcached Code Camp 2009
NorthScale
 
PDF
Memcached Presentation @757rb
Ken Collins
 
KEY
Memcached: What is it and what does it do?
Brian Moon
 
PDF
Gear6 and Scaling Website Performance: Caching Session and Profile Data with...
Gear6
 
PDF
Key-Value-Stores -- The Key to Scaling?
Tim Lossen
 
PDF
Mysql wp memcached
kbour23
 
PPTX
Memcached
Shrawan Kumar Nirala
 
PDF
Mysql wp memcached
sharad chhetri
 
KEY
Caching, Memcached And Rails
guestac752c
 
PDF
No sql presentation
Saifuddin Kaijar
 
PDF
Wiktor Schmidt, RuPy 2008, Caching in Rails
Netguru
 
PPTX
Caching
Nascenia IT
 
PDF
Membase East Coast Meetups
Membase
 
PPTX
Membase Meetup 2010
Membase
 
PDF
Gear6 Webinar - MySQL Scaling with Memcached
Gear6
 
PDF
Membase Intro from Membase Meetup San Francisco
Membase
 
PDF
Application Caching: The Hidden Microservice
Scott Mansfield
 
Kickin' Ass with Cache-Fu (with notes)
err
 
Memcached Presentation
Asif Ali
 
Scaling Rails with memcached
elliando dias
 
Memcached Code Camp 2009
NorthScale
 
Memcached Presentation @757rb
Ken Collins
 
Memcached: What is it and what does it do?
Brian Moon
 
Gear6 and Scaling Website Performance: Caching Session and Profile Data with...
Gear6
 
Key-Value-Stores -- The Key to Scaling?
Tim Lossen
 
Mysql wp memcached
kbour23
 
Mysql wp memcached
sharad chhetri
 
Caching, Memcached And Rails
guestac752c
 
No sql presentation
Saifuddin Kaijar
 
Wiktor Schmidt, RuPy 2008, Caching in Rails
Netguru
 
Caching
Nascenia IT
 
Membase East Coast Meetups
Membase
 
Membase Meetup 2010
Membase
 
Gear6 Webinar - MySQL Scaling with Memcached
Gear6
 
Membase Intro from Membase Meetup San Francisco
Membase
 
Application Caching: The Hidden Microservice
Scott Mansfield
 
Ad

More from Andolasoft Inc (20)

PDF
Scalable Mobile App Development for Business Growth1 (1).pdf
Andolasoft Inc
 
PDF
Latest Facts and Trends in Fitness App Development
Andolasoft Inc
 
PDF
Challenges of React Native App Development_ Effective Mitigation Strategies.pdf
Andolasoft Inc
 
PDF
How To Use Server-Side Rendering with Nuxt.js
Andolasoft Inc
 
PDF
Essential Functionalities Your Real Estate Web App Must Have.pdf
Andolasoft Inc
 
PDF
A Complete Guide to Developing Healthcare App
Andolasoft Inc
 
PDF
Game-Changing Power of React Native for Businesses in 2024
Andolasoft Inc
 
PDF
A Complete Guide to Real Estate Website Development
Andolasoft Inc
 
PDF
How to Build Cross-Platform Mobile Apps Using Python
Andolasoft Inc
 
PDF
Impact of AI on Modern Mobile App Development
Andolasoft Inc
 
PDF
How to Optimize the SEO of Shopify Stores
Andolasoft Inc
 
PDF
14 Tips On How To Improve Android App Performance
Andolasoft Inc
 
PDF
The Ultimate Guide to Setting Up Your WooCommerce Store
Andolasoft Inc
 
PDF
Ranking The Best PHP Development Companies in the World
Andolasoft Inc
 
PDF
Top 8 WordPress Design and Development Trends of 2023
Andolasoft Inc
 
PDF
List of 10 Best WordPress Development Companies
Andolasoft Inc
 
PDF
WooCommerce vs Shopify: Which is Better For Your Online Store
Andolasoft Inc
 
PDF
Why Choose WooCommerce For Your eCommerce Store
Andolasoft Inc
 
PDF
Django Workflow and Architecture
Andolasoft Inc
 
PDF
Service Oriented Architecture in NodeJS
Andolasoft Inc
 
Scalable Mobile App Development for Business Growth1 (1).pdf
Andolasoft Inc
 
Latest Facts and Trends in Fitness App Development
Andolasoft Inc
 
Challenges of React Native App Development_ Effective Mitigation Strategies.pdf
Andolasoft Inc
 
How To Use Server-Side Rendering with Nuxt.js
Andolasoft Inc
 
Essential Functionalities Your Real Estate Web App Must Have.pdf
Andolasoft Inc
 
A Complete Guide to Developing Healthcare App
Andolasoft Inc
 
Game-Changing Power of React Native for Businesses in 2024
Andolasoft Inc
 
A Complete Guide to Real Estate Website Development
Andolasoft Inc
 
How to Build Cross-Platform Mobile Apps Using Python
Andolasoft Inc
 
Impact of AI on Modern Mobile App Development
Andolasoft Inc
 
How to Optimize the SEO of Shopify Stores
Andolasoft Inc
 
14 Tips On How To Improve Android App Performance
Andolasoft Inc
 
The Ultimate Guide to Setting Up Your WooCommerce Store
Andolasoft Inc
 
Ranking The Best PHP Development Companies in the World
Andolasoft Inc
 
Top 8 WordPress Design and Development Trends of 2023
Andolasoft Inc
 
List of 10 Best WordPress Development Companies
Andolasoft Inc
 
WooCommerce vs Shopify: Which is Better For Your Online Store
Andolasoft Inc
 
Why Choose WooCommerce For Your eCommerce Store
Andolasoft Inc
 
Django Workflow and Architecture
Andolasoft Inc
 
Service Oriented Architecture in NodeJS
Andolasoft Inc
 
Ad

Recently uploaded (20)

PDF
University Campus Navigation for All - Peak of Data & AI
Safe Software
 
PDF
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
 
DOCX
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
 
PDF
Simplify Task, Team, and Project Management with Orangescrum Work
Orangescrum
 
PPTX
HYBRIDIZATION OF ALKANES AND ALKENES ...
karishmaduhijod1
 
PDF
Heat Treatment Process Automation in India
Reckers Mechatronics
 
PDF
Introduction to Agile Frameworks for Product Managers.pdf
Ali Vahed
 
PPTX
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
 
PDF
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
PDF
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
PPTX
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
Jamie Coleman
 
PDF
Which Hiring Management Tools Offer the Best ROI?
HireME
 
PDF
Decipher SEO Solutions for your startup needs.
mathai2
 
PPTX
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
pcprocore
 
PDF
Humans vs AI Call Agents - Qcall.ai's Special Report
Udit Goenka
 
DOCX
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
 
PPTX
Key Challenges in Troubleshooting Customer On-Premise Applications
Tier1 app
 
PPTX
IObit Driver Booster Pro 12 Crack Latest Version Download
pcprocore
 
PDF
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
PPTX
Simplify Insurance Regulations with Compliance Management Software
Insurance Tech Services
 
University Campus Navigation for All - Peak of Data & AI
Safe Software
 
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
 
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
 
Simplify Task, Team, and Project Management with Orangescrum Work
Orangescrum
 
HYBRIDIZATION OF ALKANES AND ALKENES ...
karishmaduhijod1
 
Heat Treatment Process Automation in India
Reckers Mechatronics
 
Introduction to Agile Frameworks for Product Managers.pdf
Ali Vahed
 
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
 
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
Jamie Coleman
 
Which Hiring Management Tools Offer the Best ROI?
HireME
 
Decipher SEO Solutions for your startup needs.
mathai2
 
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
pcprocore
 
Humans vs AI Call Agents - Qcall.ai's Special Report
Udit Goenka
 
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
 
Key Challenges in Troubleshooting Customer On-Premise Applications
Tier1 app
 
IObit Driver Booster Pro 12 Crack Latest Version Download
pcprocore
 
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
Simplify Insurance Regulations with Compliance Management Software
Insurance Tech Services
 

How to boost performance of your rails app using dynamo db and memcached

  • 1. From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 1
  • 2. From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 2 With the increasing number of apps going live on the web, it's becoming common to see that they use multiple servers. This is mainly due to scalability and availability purposes. But, these types of applications are also often not as responsive as they should be. Using a simple gem called DynamoDB and Memcached will allow you to achieve higher performance in your Rails app. Let me explain, What is Memcached Memcached is a high performance, free and open source distributed memory caching system used to speeding up dynamic web applications by alleviating database load. Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. It is used for speeding up dynamic web applications by reducing database load. In other words, every time a database request is made it adds additional load to the server. Memcached reduces that load by storing data objects in dynamic memory (think of it as short-term memory for applications). Memcached stores data based on key-values for small arbitrary strings. How does Memcached work? Memcached is comprised of four main components 1. Client software - Which is given a list of available Memcached servers 2. A client-based hashing algorithm - Chooses a server based on the "key" 3. Server software - Stores values and their keys into an internal hash table 4. LRU - Determines when to throw out old data or reuse memory Each item is comprised of a key, expiration time, and raw data.
  • 3. From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 3 At a high-level Memcached works as follows: 1. The client requests a piece of data which Memcached checks to see if it is stored in cache. 2. There are two possible outcomes here: 1. If the data is stored in cache: return the data from Memcached (no need to check the database). 2. If the data isn't stored in cache: query the database, retrieve the data, and subsequently store it in Memcached. 3. Whenever information is changed or the expiry value of an item has expired, Memcached updates its cache to ensure fresh content is delivered to the client. A few important points about Memcached architecture include: Data is only sent to one server. Servers don't share data. Servers keep values in RAM. If RAM runs out the oldest value is discarded. What is DynamoDB Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. With DynamoDB, you can create database tables that can store and retrieve any amount of data and serve any level of request traffic. You can scale up or scale down your tables' throughput capacity without downtime or performance degradation. DynamoDB is a particularly good fit for the following use cases Applications with large amounts of data and strict latency requirements Server less applications using AWS Lambda
  • 4. From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 4 Data sets with simple, known access patterns Installing Memcached There are a few ways you can install Memcached. Depending on which system you're using, the method will vary. As outlined on the official Memcached Installation Wiki, installation from a package is simple. Using Memcached with DynamoDB in Rails Memcached is a quick in-memory protest reserving framework that can make Rails run much quicker with not very many changes. Memcached will work on any database used in Rails application. When the table is small and request volume is low this isn’t much of an issue, but as your database and user volume grow, these can impact the performance of your application. In such cases Memcached plays an important role to reduce the database load by caching the request object in memory. To use Memcached in Rails app, follow the below steps Install dalli gem gem 'dalli' Add "dalli" gem to your gem file and install it. Development/Production file config.cache_store = :dalli_store
  • 5. From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 5 config.action_controller.perform_caching = true Add the above lines in your development.rb or production.rb file as per the requirement Add Memcached in your method search_query = "user_id = :user_id AND is_approved = :is_approved" search_param = {":user_id" => params[:user_id], ":is_approved" => 't'} all_games = Rails.cache.fetch('all_lists', expires_in: 2.minutes) { do_scan(Article.table_name,search_query,search_param) } The above query syntax is an example of combination of Memcached and DynamoDB. In this example once the query executed and the result will store in the "all_list" key of the Memcached and expire after 2 minutes automatically. Conclusion: DynamoDB and Memcached is a powerful combination for your Rails app. If you're looking to improve the performance of your Rails application, this may be the solution for you. DynamoDB and Memcached involves storing information in an external database, which can be retrieved with a single call. This will allow you to avoid the constant querying of data from your application's memory.
  • 6. From the Resource Library of Andolasoft.Inc | Web and Mobile App Development Company 6 There are many benefits to this gem, but most importantly, increased response time for your application. Faster response times mean less downtime and more satisfied customers. You have rails application but don’t know how to maximize the performance with DynamoDB and Memcached. Andolasoft has experienced rails developer who has good hands on DynamoDB and Memcached. So fell free to discuss about your project. Book a free consultation