Reprint: http://www.ikende.com/blog/00f2634be4704b79a3e22439edeb1343
Since MSMQ's message interaction requires both read and write operations on the disk, it is relatively effective to improve the message throughput of MSMQ to improve disk read and write capabilities. You can simply put MSMQ messages, Logs and other files are stored on different disks to reduce MSMQ's reliance on one disk IO to achieve higher read and write performance. Since MSMQ is generally storing pipelining data, it is a good choice to put the MSMQ storage into memory if the message structure is small and the consumption accumulation is low. This can greatly improve the read and write performance of MSMQ (disadvantage: The loss of some data in the power outage). Some implementations and simple tests for MSMQ memory storage are available below.
Building Memory Disks
first to create a disk from memory, this can be achieved through a number of tools, the choice of Dataram RAMDisk (this tool if the virtual 4G below the space is free). For how much memory to analyze, according to the actual situation, The following is a simple analysis of 2G space to build a disk out. If you store a small amount of messages and the message stays short, it's actually enough.
once created, just click the Start RAMDisk button to create a memory disk.
Make a memory disk backup
The
risk of completely storing the data in memory is relatively large, and it is possible to write the data of the memory disk into a mirror file according to the actual need. Dataram RAMDisk This tool to be thoughtful it provides a memory disk for the data source of the mirror file and the settings of the periodic save mirror image.
Save the mirror image information according to the actual situation set.
Change the MSMQ storage path
when the memory disk is built, you only need to point the MSMQ file storage path to the memory disk.
Performance Test Comparison
Does the overall read/write efficiency increase when MSMQ stores point to the memory disk? Here's a simple test.
[Protocontract] Public classEmployee {[Protomember (1)] Public stringEmployeeID {Get;Set; } [Protomember (2)] Public stringFirstName {Get;Set; } [Protomember (3)] Public stringLastName {Get;Set; } [Protomember (4)] Public stringTitle {Get;Set; } [Protomember (5)] Public stringAddress {Get;Set; } [Protomember (6)] Public stringCity {Get;Set; } [Protomember (7)] Public stringRegion {Get;Set; } [Protomember (8)] Public stringPostalCode {Get;Set; } [Protomember (9)] Public stringNotes {Get;Set; } [Protomember (Ten)] Public stringExtension {Get;Set; } } [Protocontract] Public classOrder {[Protomember (1)] Public stringOrderID {Get;Set; } [Protomember (2)] Public stringCustomerID {Get;Set; } [Protomember (3)] Public stringEmployeeID {Get;Set; } [Protomember (4)] PublicDateTime OrderDate {Get;Set; } [Protomember (5)] PublicDateTime RequiredDate {Get;Set; } [Protomember (6)] Public stringShipName {Get;Set; } [Protomember (7)] Public stringshipaddress {Get;Set; } [Protomember (8)] Public stringShipCity {Get;Set; } [Protomember (9)] Public stringShipRegion {Get;Set; } [Protomember (Ten)] Public stringShippostalcode {Get;Set; } [Protomember ( One)] Public stringShipCountry {Get;Set; } }
Normal disk test results
Memory Disk test results
Summarize
from the test structure, the revenue of the memory disk is very obvious. Both receive messages and send messages with a 1/3 increase. Because the message is not large, in the queue for a long time, after running more than 300 million messages dispatched after the memory occupied space only used 30MB, In such a small space the memory disk of the mirror like a short time into a save should not have much problem. However, there is a risk of memory disk, if your business scheduling message is not allowed to be lost at all, it is still not recommended to use memory disk for MSMQ storage.
This test result also illustrates a problem, if you want to improve the throughput capacity of MSMQ, a read-write efficient disk is more important.
Increase MSMQ's message throughput through memory disks