The Windows environment. NET using Redis cache

Source: Internet
Author: User
Tags rabbitmq redis server

About Redis

Redis is an open source, a distributed NoSQL database system that uses the C language for "key/value" type data, characterized by high performance, persistent storage, and adapting to high concurrency scenarios. Redis is purely for the application, it is a high-performance Key-value database, and provides a variety of language APIs

The performance test results indicate that the set operation can be up to 110,000 times per second, and the get operation is 81,000 times/sec (of course different Server configuration performance differs).

Redis currently offers five types of data: string (String), list (linked list), hash (hash), set (set), and Zset (sorted set) (ordered set)

Redis development and maintenance is very active, although it is a Key-value database storage system, but it natively supports MQ functionality, so it can be used as a lightweight queue service. For RABBITMQ and Redis on-board and out-of-team operations, each execution 1 million times, every 100,000 times the execution time is recorded. The test data is divided into 128Bytes, 512Bytes, 1K and 10K four different sizes of data. The experiment shows that when the data is compared with the RABBITMQ, the performance of the Redis is higher than that of the 10k,redis when the data is larger than the size of the queue, and the Redis shows very good performance regardless of the data size. And RABBITMQ's performance is much lower than Redis.

The comparison between Redis and memcached

1.Memcached is multi-threaded, and Redis uses a single thread.

2.Memcached uses a pre-allocated memory pool to store data in a way that Redis uses on-site memory, and can configure virtual memory.

3.Redis can be persistent, master-slave replication, to achieve fault recovery.

4.Memcached is a simple key and value, but the Redis support data type is much more.

Redis storage is divided into memory storage, disk storage. From this point, it also shows that Redis and memcached are different. Redis is like memcached, where data is cached in memory to ensure efficiency. The difference is that Redis periodically writes the updated data to disk or writes the modified operation to the appended record file, and Master-slave (Master-Slave) synchronization is implemented on this basis.

Redis has two storage methods, the default is the snapshot way, the implementation method is to periodically persist the memory snapshot (snapshot) to the hard disk, the disadvantage is that if the crash occurs after persistence, it will lose a piece of data. As a result of the perfectionist's push, the author added the AoF way. AoF that is append only mode, the Operation command is saved to the log file while writing the memory data, in a system with tens of thousands of concurrent changes, the command log is a very large amount of data, the management maintenance costs are very high, recovery rebuild time will be very long, which leads to the loss of AOF high-availability intention. What's more, Redis is a memory data structure model, and all of the advantages are based on the efficient atomic operation of complex memory structures, so that aof is a very uncoordinated part.

In fact, the main purpose of AOF is data reliability and high availability.

Redis Installation

At the end of the article I provided the download package, of course you can also go to the official website to download the latest version of Redis Http://pan.baidu.com/s/1pK8BMGF

Copy the service program to a directory on a disk, such as:

File Description:

Redis-server.exe: Service Program

Redis-check-dump.exe: Local Database check

Redis-check-aof.exe: Update log check

Redis-benchmark.exe: Performance test to simulate the simultaneous sending of M-Sets/gets queries by n clients.

Redis-cli.exe: After the server is turned on, our clients can enter various commands to test

1. Open a CMD window and use the CD command to switch to the specified directory (F:\Redis) to run Redis-server.exe redis.conf

2. Reopen a CMD window, use the CD command to switch to the specified directory (F:\Redis) to run Redis-cli.exe-h 127.0.0.1-p 6379, where 127.0.0.1 is local ip,6379 is the default port on the Redis server (This enables a client program to test for special instructions).

You can set this service as a Windows system service, download the Redis service installation software, and install it.

If your computer is a 64bit system, you can download http://pan.baidu.com/s/1slPcW93

Once the Redis service is installed, we will see it in the service of the computer

Then start the service.

Next, when using Redis, you need to download the C # driver (also known as the C # Development library), such as:

Source Address: Http://pan.baidu.com/s/1hr8kdOo

The Windows environment. NET using Redis cache

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.