-
Notifications
You must be signed in to change notification settings - Fork 11
/
week-2.txt
183 lines (136 loc) · 7.19 KB
/
week-2.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
SYSTEM SIZING AND TUNING:
Quiz:
http://docs.mongodb.org/manual/faq/storage/ - more on storage
By default, which algorithm is used to determine which pages of memory are discarded by the kernel? - LRU(Least recently Used)
What offers the best performance in terms of Resident Memory? - Full data set fits into resident memory
Why would you want to pre-heat a specific subset of a MongoDB dataset? - You have not used a particular dataset, but you expect to be using that dataset in the immediate future.So, there wouldn't be any lag for users/application while accessing it.
You don't have enough SSD's to put your full data set on them; some must go into spinning media. Which of the following should be placed on spinning media in a read heavy system? - Capped collections, oplog - because capped collections have sequential access pattern.
**http://docs.mongodb.org/manual/administration/production-notes/** - Read them more often
Which of the following is a potentially bad system configuration for MongoDB?
NUMA System using MongoDB init scripts[Init script can handle it]
NUMA System with NUMA disabled in BIOS[No prob.]
- NUMA system running mongod manually [Answer]
non-NUMA system running mongod manually[No prob.]
Which of the following are recommended filesystems for use with MongoDB? - ext4, xfs [ext3 is supported but not recommended as it doesn't support fallocate()]
Which of the following is the recommendation for using MongoDB on NFS?
When using NFS ensure that your journal files and data files are stored on the same volume. [It is recommended to have the journal files on different storage, however this complicate backups]
- Avoid it if you can.[answer]
NFS is strongly recommended for use with MongoDB.
NFS significantly helps write performance.
Why should you allocate swap space when using MongoDB? Check all that apply.
For use by MongoDB
To keep the kernel from killing MongoDB when running short on memory[Yes] - As a consequence of OOM error
To give you as an administrator greater control over how memory is used on a system running MongoDB[Yes]
Which of the following can readahead settings effect? Check all that apply.
The efficiency of your data storage in memory[yes]
Seek times
Data locality
How often you access disk[yes]
Data access patterns
Increasing readahead will give the least increase in performance in which of the following scenarios?
Data to be read from spinning disks
Data to be read from optical storage
Data to be read from SSDs[yes] - it is recommended to have lower readahead for SSD's how low? 16sectors - 32 sectors
Sequential documents that are often accessed together
Documents that are accessed randomly
Which of the following scenarios might cause increases on the CPU usage metrics reported in the MMS hardware tab? Check all that apply.
Saturated I/O[Overloaded IO]
Large counts or distincts
Complex MapReduce operations
Large in-memory sorts
Aggregation queries [All]
Which of the following are settings you should consider when it's appropriate to reduce the disk space a mongod process consumes.
--nodisk
--smallfiles[yes]
--nojournal[yes, not for prod. hosts and should be used for testing/arbiter hosts]
--oplogSize[yes]
--noDataFiles
For which replica set members is it appropriate to use the --nojournal option?
primary
secondary
hidden secondary
priority 0 secondary
arbiter[yes, because all the above hosts has data]
Which of the following will enable you to reclaim disk space? Check all that apply.
Using the compact command
Using the resync command with a standalone mongodb instance
Using resync with a replica set[yes]
Using the repair command[yes]
Using the reclaim command
MongoDB tracks disk space usage. [false]
If you are going to run multiple mongod processes on the same host, which of the following should you do?
Benchmark memory usage under production load[yes]
Measure the number of file descriptors used by a process under production load[yes]
Follow MongoDB documentation guidelines for isolating processes and setting limits[There's nothing like this]
Benchmark IO usage under production load[yes]
A three node replica set with a primary and two data-bearing secondaries is the most common deployment. What are some reasons for this?
Provides a sufficient guarantee of high availability and distaster recovery for most applications[yes]
MongoDB runs most efficiently in this configuration
Enables you to pull out a single secondary temporarily (e.g., for an upgrade) without downtime or too much risk[yes]
The cost of production servers capable of running three mongod processes currently is something of a sweet spot in terms of price
This is the only configuration that permits three voting members and guarantees some redundancy
Which of the following are common reasons some deployments have more than three replica set nodes?
So that they may include a node purely for analytics[yes]
To include a node for backups[yes]
Because resources will permit additional nodes
To distribute a replica set across multiple data centers[yes]
To include a less powerful node you do not want clients to access, but require for some other purpose[yes]
From where do replica set secondaries sync by default?
From the primary
From the nearest member[yes]
From a secondary in the same data center
From a randomly selected member
From the nearest member unless that member is already syncing from a secondary
==============================================================================================================
H-w 2.1:
- Documents are often accessed in natural order sequentially
- You are using a spinning disk, rather than an SSD
===========================================================================================================
H-w 2.2:
- Scenario 1: RA = 16 or 32
- Scenario 2: RA = 1024
=============================================================================================================
H-w 2.3:
- Move your system to another machine with more memory
- Add an index for the variable(s) you are using to sort the documents
- If possible, perform a $match before the $sort in order to reduce the number of
==============================================================================================================
H-w 2.4:
Preparation, Importing DB, Checkup.
mongod --dbpath
mongo
> show dbs
admin (empty)
fragDB 0.453GB
local 0.078GB
> use fragDB
switched to db fragDB
> show collections
fragColl
system.indexes
> db.fragColl.stats().size
48000000
> db.fragColl.stats().storageSize
335900672
> db.runCommand({compact: 'fragColl'})
{ "ok" : 1 }
> db.fragColl.stats().size
48000000
> db.fragColl.stats().storageSize
66904064
Improvement of Storage Efficiency & reclaiming of disk space.
> (db.stats().dataSize + db.stats().indexSize) / db.stats().fileSize
0.11291854722159249
> (db.stats().dataSize + db.stats().indexSize)
53044848
> db.stats().fileSize
469762048
> db.repairDatabase()
{ "ok" : 1 }
> (db.stats().dataSize + db.stats().indexSize)
53044848
> db.stats().fileSize
201326592
==============================================================================================================
H-w 2.5:
- P to S1; S1 to S2; S2 to S3; S3 to S4