Application of Redis memory database in Exchange room

Source: Internet
Author: User
Tags memcached redis server

This paper discusses the current situation and shortcomings of the existing Exchange conference Room application, and introduces the application of Redis memory database in Exchange room, gives a high-performance application architecture, adopts key technology and key realization process, and finally realizes greatly improving system performance and improving user experience. And it provides an effective reference for the optimization of other information systems.

I. Introduction to the REDIS memory database

Key-value Storage systems are a popular topic, especially when it comes to building large-scale Internet applications such as search engines, instant messaging, peer-to-peer, game servers, SNS, and providing cloud computing services.

Key-value Storage System more attention to the massive data access performance, distributed, extensibility support, do not need some characteristics of traditional relational database, such as: Schema, transaction, full SQL query support and so on.

Redis is a key-value storage system, also known as an in-memory database. Similar to memcached, it supports storing more value types, including string (string), list (linked list), set (set), and Zset (ordered collection). These data types support Push/pop, Add/remove, and intersection-set and difference sets, and richer operations, and these operations are atomic. Based on this, Redis supports sorting in a variety of different ways. As with memcached, 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.

Second,the application of Redis memory database analysis

(i) Some of the scenarios that Redis applies To

1, take the latest n data operation;

2, the leaderboard application, take top n operation;

3, the need to accurately set the expiration time of the application;

4, the counter application;

5, Uniq operation, to obtain a period of time all data row weight value;

6, real-time system, anti-spam system;

7, pub/sub build real-time message system;

8, build the queue system;

9, Cache.

(ii) The typical application of Redis in Sina Weibo

Currently the world's largest redis users are Sina Weibo, there are more than 200 physical machines in Sina, more than 400 ports are running Redis, there are +4g data running on Redis to provide services for Weibo users.

There are a number of deployment scenarios for the Sina Weibo Redis, which can be divided into the following 2 types:

The first is that the application accesses the Redis database directly

Figure one application direct access to Redis

The second is that the application accesses Redis directly and only accesses MySQL if the Redis access fails

Figure two application direct access to Redis fails when accessing MySQL

(iii) Analysis of the current status of Exchange room applications

At present, the company meeting room application has been implemented in Outlook, the function of meeting room request automation (no manual intervention) has been realized, and the meeting room data has been accumulated for more than one year, but there are serious defects in the meeting room view or query in Outlook Calendar. If unable to view the meeting applicant or participant's Department and application time and other information, can not be aggregated statistics and data export, etc., resulting in the conference Room analysis and assessment. Because the meeting rooms in Outlook are stored in exchange's dedicated database, and exchange's dedicated database differs greatly from a common relational database such as Oracle, Ms SQL Server, and MySQL, it does not have a common driver or API interface. But Microsoft has provided a basis for. NET technology's dedicated API interface can programmatically access Exchange room data.

Because the company has implemented Windows domain management, and the Exchange mail server is integrated and bound with the domain, the room applicant's e-mail address matches the e-mail properties of the user of the Windows Active Directory one by one, and the Active Directory user has the attributes of the organization's structure (such as departments, sections , groups and other information), which creates the necessary conditions for two development integrations for meeting room queries.

At the same time through a dedicated API interface for two development queries in the performance of a large bottleneck, especially when the cross-month query, time-consuming (may cause the system suspended animation phenomenon), the user experience is poor.

At present, the conference room can be applied 7 days in advance, but for the history of conference room application data will not make any change operation, so for historical data can be timed synchronization to the cache, this paper uses the conference room history Data timing synchronization to Redis, in order to improve the computational performance, At the same time, all the in-service user information in Windows Active Directory is also synchronized to Redis, and a high-performance application architecture is given, which effectively solves the problem of system performance and data history archiving (such as the use of real-time transaction query mechanism, once a conference room is deleted, it will cause all of its data to be lost. Not able to query), not only greatly improve the user experience, but also for the conference Room Analysis and Assessment provides a platform.

III. application of Redis memory database in Exchange room

(a) Overall application structure

figure three Redis memory database overall application architecture in Exchange room

Based on the present situation analysis of the Conference room application, the core of the architecture is to synchronize the historical meeting room application data to the Redis memory database, and for the present and future time meeting room data (currently 7 days in advance), the Exchange Room database is queried in real time through the private interface. Depending on the user's choice of query time, the system automatically determines which database is accessed or data is merged (data from historical data to current or future time), significantly improves the user experience by reducing access to the Exchange Room database to improve query performance, and integrates with users of Windows Active Directory. Provide data support for conference room analysis and assessment.

(ii) Introduction to key technologies

1, Servicestack.redis Drive

Servicestack.redis is one of the most popular open source C # drivers for accessing and reading Redis, which encapsulates a number of methods and objects, making two development fairly easy, such as providing basic Key/value key-value pair operations, storing objects, storing table objects, Use the client link pool mode to increase link speed, and more.

This article uses the Servicestack.redis to develop two times, through the two development interface to the Exchange conference room and the Windows Active Directory of all in-service user data synchronization Redis, while the historical room data to provide a query interface.

2. Microsoft.Exchange.WebServices Class Library

The Microsoft.Exchange.WebServices class Library is the official Microsoft-provided API for accessing Exchange mail servers, such as the ability to read conference room data, mail, contacts, schedules, etc. based on such library programming Custom development can be tailored to meet the needs of different applications.

This article mainly uses this kind of library to read the meeting room data, and unifies the Systemcomponent.adhelper class library to read the meeting applicant and the participant's Department information.

3. Systemcomponent.adhelper Class Library

The Systemcomponent.adhelper class library is a generic class library that I have developed for the BPM project to operate Windows Active Directory (organizational unit, group, user) that can be reused and is now widely used in BPM projects.

This article mainly uses this kind of library to obtain the meeting applicant and the participant's department information according to the e-mail.

4. Quartz.net Operation Framework

Quartz.net is an open-source job scheduling framework, which is a. Net migration of the Opensymphony Quartz API, written in C # that can be used in WinForm and ASP. It provides a great deal of flexibility without sacrificing simplicity. It can be used to create simple or complex schedules for the execution of a job. It has many features, such as database support, clustering, plugins, support for cron-like expressions, and so on.

This article mainly uses this job framework to develop a custom synchronization program that synchronizes Exchange room data to Redis in a timed synchronization and runs in Windows services (automating jobs without the need for manual intervention).

(iii) Key implementation process

1. Synchronize Exchange room data and all active users of Windows activity directory to Redis in a timed synchronization

Mainly through the above key technologies for two development and integration into the Windows Service program, the development of completed program file list such as:

Figure Four timed synchronization of Exchange room and Windows Active Directory user program Files list

Post-Deployment Services in Windows such as:

Figure Five timed synchronization of Exchange room and Windows Active Directory user to Redis service

The configuration file for the service (which defines the period of data synchronization, the meeting room that needs to be synchronized, the user path of the Active Directory, and so on), such as:

Figure six synchronizing Exchange room and Windows Active Directory users to the Redis service profile in a timed synchronization

By setting up Redis persistence in a Redis profile, that is, Redis asynchronously writes in-memory data to the local Redis database (DUMP.RDB), this article configures the automatic synchronization of yesterday's Exchange room data to redis every 4 o'clock in the morning, such as:

Figure VII Redis persistence

The benefit of persistence is that the memory data is not lost even if the Redis server is restarted (Redis service is automatically loaded into memory based on the local Redis database), thus greatly improving system reliability and availability. and portability is good (as long as the copy of the Dump.rdb file can be ported to other REDIS servers).

2, custom-developed meeting room query assistant

Read room history data from the Redis memory database (no changes to the data) by making a custom-developed meeting room query Assistant to read the room data in advance request from the Exchange Room database (data may change at any time), through a two-part data combination, On the one hand, improve the system performance, on the other hand to ensure the accuracy of data, the tool main interface such as:

Figure Eight Client Outlook Room report Query assistant
The system can query according to the meeting time period and the meeting room list condition, and support to export to Excel file in the way that you see, facilitate two times processing (statistic analysis, appraisal), for example:

Figure nine Outlook Room report query after export

In order to facilitate full staff sharing and querying, in addition to providing client query tools (mainly for meeting room managers and performance appraisal staff), can be developed two times in the Enterprise Portal to show, such as:

Figure 10 Enterprise Portal Outlook Room report query

(iv) Practical application effect analysis

Take the HP Z600 Workstation PC Test as an example, specific hardware information such as:


Figure 11 HP Z600 Workstation PC hardware information

Performance comparison analysis of the Redis memory database and direct read Exchange room data, such as:


Figure 12 Performance analysis of Redis memory database and Exchange Room database read

As you can see from Figure 12, the reading of the Redis memory database is around 0.5 seconds, the length of the meeting time period has a small impact on redis performance, and the length of the meeting time period for the Exchange Room database is significant, with performance differences of dozens of times to hundreds of times times. Using a Redis memory database is a good solution, both in terms of performance and user experience.

Iv. Summary

This paper presents a solution based on Redis memory database in Exchange Room application, and gives the corresponding key technology and realization process, and finally analyzes the application effect. The solution can meet the needs of end users and management in terms of function, performance and so on, it is very flexible in system architecture, extensibility and portability, and development components are very easy to reuse.

It provides an effective reference for the optimization of high performance and high concurrency scenarios and other related information systems, and a new application architecture based on Redis memory database can be optimized and improved according to the present paper.

Note: This is the small application I developed three years ago, but more practical, now the company has been stable operation for three years, the idea of optimization can be used for reference! In addition, I recently found a new job, mainly two direction of the job: in the party (Enterprise) hope to find an information manager-related posts, in Party B (software company) Technical manager, Project manager, System architect, etc. can be considered, the requirements of the work place: Ningbo, Hangzhou, Shanghai!

At the same time welcome to pay attention to my subscription number qyxxhqy, not regularly update the forefront of enterprise information technology and applications, welcome to scan attention, QR code as follows:

This blog for the Software Life original, welcome reprint, reprint please indicate source: http://www.cnblogs.com/nbpowerboy/p/4322724.html. Deductive or for commercial purposes, but must retain the attribution software of this article life (including links). If you have any questions or authorization to negotiate, please leave me a message.

Application of Redis memory database in Exchange room

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.