MongoDB---performance optimization---(1)

Source: Internet
Author: User
Tags mongodb query

MongoDB Data Architecture


Upgrade resolution. Plan

Discover problems

A sudden influx of application server users, creating a slow server response


Checking the server, I found that each reaction was very slow, to 30ops


Inspection process


. Discovery of database queries slow
. Check the Index
. Check the memory footprint. Usage
. Check the TCP connection




Control Test 1


. Hardware configuration:
. Client:
. A. 2cpu,2g, memory. windows2008
. Service side:
. A. router:4cpu,4g, memory. centos6.5 64-bit
. A. Li Yun. mongod:2cpu,8g memory, centos6.5 64-bit
.1. Router into the line test. 200qps per second.


.2. The mongod into the test, 500QPS per second.
Summary: Make. With sharding architecture, the query will be more slow than direct to a single MONGO query.




Control Test 2


. Hardware configuration:
. Client:
2cpu,2.5g Memory, windows2008
. A. Li Yun, 2cpu. 2.0g Memory, windows2008
. Service side:
. A. Li Yun. Mongod:2cpu. 2.5g Memory, windows2008
.1.2cpu,2.5g the memory locally. Windows2008 into the line test. The query speed reaches 3000QPS, even can break through 5000QPS sometimes.
.2. In 2cpu,2.0g memory, windows2008 to Mongod in. Test, query Speed 500QPS.
. Summary: TCP pair.. The network has a very big impact.






Control Test 3


. Hardware configuration:
. Client:
. Physical machine, 2cpu,4.0g memory, windows2008
. Service side:
. Physical machine, mongod:2cpu,4.0g memory, centos6.5 64-bit
. Physical machine, router:2cpu. 4.0g of memory. centos6.5 64-bit
.1. Mongod into the line test. Query Speed 1000QPS.


.2. Router into the line test. Query Speed 500QPS.
Summary: The presence of a. A certain limit. So that the speed is capped.




Control Test 4


. Hardware configuration:
. Client:
. Ucloud,2cpu. 4.0g Memory, windows2008
. Service side:
. ucloud,mongod:2cpu,4.0g memory. centos6.5 64-bit
. Ucloud,router:2cpu. 4.0g memory, centos6.5 64-bit
.1. Mongod into the line test, query speed 2000QPS.
.2. Router into the line test, query speed 1000QPS.
Summary: Ucloud. Li Yun's machine performance is good.




Control Test 5


. Hardware configuration:
. Client:
. ucloud,16cpu,64.0g Memory, windows2008
. Service side:
. ucloud,mongod:16cpu,64.0g memory, centos6.5 64-bit
. Ucloud. router:16cpu,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.




Conclusion


1. 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.CLIENTCPU cores determines the speed of MongoDB queries.
3.tcp limit passed. Walk inside. Nets can be avoided.
4.linux OS beats windows.

So the MongoDB architecture is on Linux. Better than architecture on Windows.


Latest architecture




Latest architecture




Extreme Performance Test


. above. The latest schema in. Line test:
. Open 4 Iisclient, at the same time to router into. Line query.
The router can reach 20,000 queries per second.

Switch to a business control. That is capable of coping with 2000 people per second.




Performance conclusions


In order to ensure the normal operation of the online business. Row, the server where the database resides needs to 8cpu,16g memory.
. To ensure the integrity of the backup. So correct slave database backup, correct router standby. Backup is retained for 30 days.

Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

MongoDB---performance optimization---(1)

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.