We will continue our discussion from where we had left in part 2.
If you haven’t looked into previous article, you can navigate to and go through second and third tips served in that discussion at this MySQL DB performance blog part 2 query parameters
If you want to read entire discussion from beginning, you can navigate to that text at this
MySQL DB performance blog part 1 query parameters
Presented below is more discovery on remaining optimization techniques to take your website or mobile application to the next level.
- Leverage the key-value cache store – Redis
Performance is matter of
- availability of huge physical memory and
- effective use of it.
Here infinite amount of disk space can not help to improve response time.
Therefore, requirement of newer types of tools or databases have come into existence.
And it is fulfilled by technology of key-value cache stores that are defined in-memory.
Redis is a flagship product in this technology.
Redis is in-memory key-value data store which is
- an open source and
- widely used
for
database caching.
Redis supports a variety of data structures including all those commonly used such as
- strings
- hashes
- lists
- sets and
- sorted lists
Redis was invented to boost performance rather simply delivering facilities of data storing and releasing in memory.
So it executes advance level functions of replication and transactions also.
In this text, we will see only basic input-output system to interact with Redis.
There are 3 methods
- Through command prompt
- Through Redis-CLI
- From PHP code itself
Redis server can be handled from local as well as remote connections.
If you want to start Redis server, run following command in terminal:
redis server
- By default, Redis allocates for itself the IP address 127.0.0.1 and port 6379.
- Redis can store data that is already in database as well as transaction limited data created on the fly
Database names within Redis are integers and given values of 0, 1, 2 and so on. To connect to Redis with website that is written in PHP, execute this code snippet:
$redisObject = new Redis();
if( !$redisObject->connect(‘127.0.0.1’, 6379))
die(“Can’t connect to Redis Server”);
We won’t cover here any explanation of how this code works and how to declare variables.
Above example was to show that you can leverage Redis for your website to earn performance boosting so that your visitors can be served content faster.
If you aren’t command geek or don’t like to work with terminal, you may download, install and run Redis Desktop Manager (RDM).
It will allow you to manage this top-notch memory conservative component fully in graphical way.
RDM has many features including
- It supports SSH and SSL and is cloud ready
- It can display data in many formats from itself, without intermediary conversion tool required
- We need only single instance of RDM to connect to multiple Redis servers
- We can add new keys to specific database from many databases opened simultaneously in Redis
- RDM can add more data to a selected key.
Before finishing this 3 blogs series text, let us understand last technique of database performance optimization – usage of one analogous product to Redis.
- Multithreaded key-value cache store – Memcached
Notice that Redis and Memcached are NOT full-fledged databases.
They only support data retrieval and storage which is already fetched by RDBMS, NoSQL or other types of databases from disk storage.
This way we decrease user response time and increase user experience.
While most of benefits are awarded to Redis including exceptional feature of handling richer data structures, Memcached has 2 distinctions
- It is lightweight
- It can consume multiple CPU cores
These functions are NOT forte of Redis.
By default, Memcached server runs on the IP address 127.0.0.1, and on the port 11211.
Data can flow in to Memcached from external APIs or from database.
To apply individual techniques to increase data and disk related performance, please dive into specific text entirely written for Memcached.
In these 3 parts of discussion, we saw many things for web application performance improvement from MySQL database perspectives.
Question is, how you can trust these ?
After and before implementation, you can observe statistics and required figures from benchmarking with help from different industry standard tools like
- Apache JMeter
- ApacheBench
- Siege
- XDebug
And many more.
Whether your web store is made up from WordPress, Magento, Drupal or different CMS, you will have compared and succeeded over previous release of website assuming you use versions PHP 7 or greater than that and applied these techniques properly.
Continue exploring more at..
https://www.blisswebsolution.com
Simply to read more articles on Web application development areas or related to
open source databases and technologies, navigate to
https://www.blisswebsolution.com/blog/
If you are a tech person or MySQL update related news interests you, you can attend our discussion forum without any obligation, just drop an e-mail at enquiry@blisswebsolution.com.