to ensure that different hosts generate different machine hash values, to ensure that there is no conflict in the distribution, This is why the strings in the middle of the objectid generated by the same machine are identical. 3) PIDThe process ID. The machine above is to ensure that the objectid generated in different machines do not conflict, and the PID is to be in the same machine different MongoDB process generated objectid conflict, the next "a
[MongoDB] Eight optimization skills and eight MongoDB skillsTip 1: Minimize disk access to memory much faster than disk access. Therefore, the essence of optimization is to minimize disk access.The read speed of the memory is 1 million times faster than that of the disk. Reading a disk takes a long time. Several Simple
Tip 1: Minimize disk access to memory much faster than disk access. Therefore, the essence of optimization is to minimize disk access. The read speed of the memory is 1 million times faster than that of the disk. Reading a disk takes a long time. Several Simple Methods: Using SSD (solid state drive); Increasing the memory can reduce hard disk reading and
Tip 1: Minimize disk access to memory much faster than disk access. Therefore, the essence of
When a new Web machine node is added to the project, the performance of its MongoDB cluster is found to be impacted, at the peak of the request, and the MongoDB response time becomes very long.
Monitoring found that the number of connections MongoDB at peak times reached around 1100~1500, which resulted in considerable memory overhead due to the need for each co
turn on the Profiling function To optimize for slow queries: MongoDB can monitor data through profile to optimize it.To see whether the profile function is currently open with commandsDb.getprofilinglevel () returns level with a value of 0|1|2, meaning: 0 for off, 1 for slow command, 2 for allDb.setprofilinglevel (level); #level等级, value ibid.At level 1, the slow command defaults to 100ms and changes to Db.setprofilinglevel (LEVEL,SLOWMS) such as Db.
field query. Technique VI, by establishing a hierarchical document to speed up the scan the array is organized hierarchically, not only to make it look more organized, but also to allow MongoDB to query quickly when there are no indexes at all. If the document has no hierarchy, MongoDB must traverse each field in the document. Reasonable use of hierarchies can reduce M
Below are some common optimization settings recommended by MongoDB. Selecting an appropriate parameter value in the production environment, such as the pre-read value and the number of default file descriptors, will greatly improve the system performance.
Below are some common optimization settings recommended by MongoDB
text search needs 10+s, is the need for 1s.
MongoDB client configuration, you can propose to make spring injection, set the maximum number of connections and so on.
Mongoclientoptions options =
mongoclientoptions.builder (). Maxwaittime (1000 * 2)
. Connectionsperhost (500 ). Build ();
Mongoclient = new Mongoclient (arrays.aslist new ServerAddress ("10.205.68.57", 8700),
new ServerAddress (" 10.205.68.15 ", 8700),
new ServerAddress (" 10.205
MongoDB paging is very simple, this article mainly talk about the problems of paging, as well as the optimization scheme From the traditional web to the mobile API, we all face the same problem, such as Ajax get size display, etc., will force you to paging For example, my project uses Ratchet to do H5 framework, its push.js is Ajax get loading other pages, the page is too large to error. Pagination descript
of setting method and level, one is by adding –slowms boot parameter configuration. The second is to invoke Db.setprofilinglevel with the second argument:
Db.setprofilinglevel (level, SLOWMS)
2. Query Profiling Records
Unlike MySQL's slow query log, the MongoDB profile record is directly present in the system DB, and the record location is System.profile, so we'll just have to check the collection record to get our profile records. Lis
Description: The optimization case is to express the meaning of the individual parameters, combining the analysis of the business with the logical implementation, and how to create the index and column order is selected (no longer described here)Environment Description :MongoDB version 3.0.9, replica set 3 node, memory 64g,cpu core, disk 2TB SSD, using WT storage engine ...The amount of data in this table i
Tags: MongoDB performance optimizationMongoDB Linux performance optimization: https://docs.mongodb.com/manual/administration/production-notes/#allocate-sufficient-ram-and-cpuPerformance optimization:1. Close the Atime storage volume that contains the database files.2, according to the recommendations in the Ulimit reference, the file descriptor limit,-n User proc
, what you need to do as a technician is to increase the performance of the software and the number of users at the same time, even faster than the increase in user volume.
MongoDB Performance Optimization
The database performance has the vital influence to the software overall performance, to the MongoDB database common performance
large and the CPU should be multi-core and multi-thread. However, some databases do not have strict requirements on multi-core CPU, such as: MongoDB, mongoDB has high memory requirements! MySQL's InnoDB engine has a high CPU utilization rate. Try to use a powerful CPU!
System Selection
1. The system must be a 64-bit system, either linux or unix. linux has many options, and CentOS Ubuntu kernel is commo
directory under DBPath to mount a hard disk device in the index directory so Indexes and data are separated. Set Directoryperdb to a different directory per database, preferably mounted on a different hard disk device for each directory.
Compression: Wiredtiger provides two kinds of data compression methods for snappy and zlib. Snappy provides low compression ratio but low performance loss, zlib compression ratio, high performance loss, through Storage.wiredTiger.collectionConfig.blockCompr
Mongdb is used in the project. When the data volume is small, it is the same as that of relational databases. Mongdb becomes very slow when data operations change frequently, such as continuous query operations on Data Tables of the hundreds of thousands.
Why?
This is the mongdb operation in spring. Spring's mongotemplate only encapsulates the source method. If there are such problems in spring, the same problem occurs when you directly use the Source Method for Data operations.
The follow
indexes in test table
Db.test.fropIndexes ();
Delete the name index from the test table
Db.test.dropIndex ({name:1});
To parse an SQL statement using the index condition command:
Db.test.find (). explain ();
Performance optimization:
Explain execution plan
MongoDB provides a explain command to learn how a query request is handled by the system. The explain command provides a good view of how the system u
the background so that other database activities are not blocked when the index is built. The default value is False.
uniqueA Boolean that creates a unique index. The default value is False.
nameA String that specifies the name of the index. If not specified, MongoDB generates an indexed field with the name and sort order concatenation.
dropDups, Boolean, when a unique index is created, only the first one is retained if duplicate delet
,64.0g memory, centos6.5 64-bit.1. Mongod into the line test, query speed 13000QPS..2. Router into the line test, query speed 10000QPS.Summary: Finally find the problem root knot, clientcpu the number of cores determines the speed of MongoDB query.Conclusion1. Li Yun's cloud host has made certain restrictions, resulting in. Anyway, set the system. Database configuration, all. Unable to break through. An order of magnitude of QPS.The number of 2.CLIENT
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.