-
Notifications
You must be signed in to change notification settings - Fork 224
/
search.conf
executable file
·377 lines (305 loc) · 13 KB
/
search.conf
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
ditto {
service-name = "search"
mapping-strategy.implementation = "org.eclipse.ditto.thingsearch.api.ThingSearchMappingStrategies"
persistence.operations.delay-after-persistence-actor-shutdown = 5s
persistence.operations.delay-after-persistence-actor-shutdown = ${?DELAY_AFTER_PERSISTENCE_ACTOR_SHUTDOWN}
extensions {
search-update-observer = org.eclipse.ditto.thingsearch.service.updater.actors.DefaultSearchUpdateObserver
query-criteria-validator = org.eclipse.ditto.thingsearch.service.persistence.query.validation.DefaultQueryCriteriaValidator
caching-signal-enrichment-facade-provider = org.eclipse.ditto.thingsearch.service.persistence.write.streaming.DittoCachingSignalEnrichmentFacadeProvider
search-update-mapper = org.eclipse.ditto.thingsearch.service.persistence.write.streaming.DefaultSearchUpdateMapper
}
mongodb {
database = "search"
database = ${?MONGO_DB_DATABASE}
pool {
minSize = 0
minSize = ${?MONGO_DB_CONNECTION_MIN_POOL_SIZE}
maxSize = 1000
maxSize = ${?MONGO_DB_CONNECTION_POOL_SIZE}
# 0 = no limit, negative value = ignore, use client default
maxIdleTime = -1s
maxIdleTime = ${?MONGO_DB_CONNECTION_POOL_IDLE_TIME}
maxWaitTime = 30s
maxWaitTime = ${?MONGO_DB_CONNECTION_POOL_WAIT_TIME}
jmxListenerEnabled = false
jmxListenerEnabled = ${?MONGO_DB_CONNECTION_POOL_JMX_LISTENER_ENABLED}
}
breaker {
# defines after how many failures the circuit breaker should open
maxFailures = 5
maxFailures = ${?BREAKER_MAXFAILURES}
timeout {
# MongoDB Timeouts causing the circuitBreaker to open - "0s" disables timeouts opening the breaker
call = 5s
call = ${?BREAKER_TIMEOUT}
# after this time in "Open" state, the cicuitBreaker is "Half-opened" again
reset = 10s
reset = ${?BREAKER_RESET}
}
}
monitoring {
commands = true
commands = ${?MONGODB_MONITORING_COMMANDS_ENABLED}
connection-pool = true
commands = ${?MONGODB_MONITORING_CONNECTION_POOL_ENABLED}
}
}
search {
mongo-hints-by-namespace = ${?MONGO_HINTS_BY_NAMESPACE}
index-initialization {
# indices should be created within this application
enabled = true
enabled = ${?INDEX_INITIALIZATION_ENABLED}
}
query {
persistence {
# read preference is one of: primary, primaryPreferred, secondary, secondaryPreferred, nearest
readPreference = ${ditto.mongodb.options.readPreference}
readPreference = ${?QUERY_PERSISTENCE_MONGO_DB_READ_PREFERENCE}
# read concern is one of: default, local, majority, linearizable, snapshot, available
readConcern = ${ditto.mongodb.options.readConcern}
readConcern = ${?QUERY_PERSISTENCE_MONGO_DB_READ_CONCERN}
}
}
# How simple fields (root level, primitive type) are mapped during query parsing
# Note: fields without leading slash are excluded from authorization check
simple-field-mappings {
thingId = "_id"
namespace = "_namespace"
policyId = "/policyId"
_revision = "/_revision"
_modified = "/_modified"
_created = "/_created"
definition = "/definition"
}
updater {
max-idle-time = 25h
max-idle-time = ${?ACTIVITY_CHECK_INTERVAL}
event-processing-active = true
event-processing-active = ${?EVENT_PROCESSING_ACTIVE}
# how often to poll shard region for state updates
sharding-state-poll-interval = 15s
sharding-state-poll-interval = ${?SHARDING_STATE_POLL_INTERVAL}
force-update-probability = 0.00
force-update-probability = ${?FORCE_UPDATE_PROBABILITY}
force-update-after-start-enabled = false
force-update-after-start-enabled = ${?FORCE_UPDATE_AFTER_START_ENABLED}
force-update-after-start-timeout = 5m
force-update-after-start-timeout = ${?FORCE_UPDATE_AFTER_START_TIMEOUT}
force-update-after-start-random-factor = 1.0
force-update-after-start-random-factor = ${?FORCE_UPDATE_AFTER_START_RANDOM_FACTOR}
background-sync {
# whether background sync is turned on
enabled = true
enabled = ${?BACKGROUND_SYNC_ENABLED}
# duration between service start-up and the beginning of background sync
quiet-period = 8m
quiet-period = ${?BACKGROUND_SYNC_QUIET_PERIOD}
# how soon to close the remote stream if no element passed through it
idle-timeout = 5m
idle-timeout = ${?BACKGROUND_SYNC_IDLE_TIMEOUT}
# how long to wait before reacting to out-of-date search index entries
tolerance-window = 20m
tolerance-window = ${?BACKGROUND_SYNC_TOLERANCE_WINDOW}
# how long to wait for the policy shard region for the most up-to-date policy revision
policy-ask-timeout = 10s
policy-ask-timeout = ${?BACKGROUND_SYNC_POLICY_ASK_TIMEOUT}
keep {
# how many events to keep in the actor state
events = 50
events = ${?BACKGROUND_SYNC_KEEP_EVENTS}
}
throttle {
throughput = 100
throughput = ${?BACKGROUND_SYNC_THROTTLE_THROUGHPUT}
period = 10s
period = ${?BACKGROUND_SYCN_THROTTLE_PERIOD}
}
# handle failures/stalling/expired cursors
min-backoff = 1s
min-backoff = ${?BACKGROUND_SYNC_MIN_BACKOFF}
max-backoff = 2m
max-backoff = ${?BACKGROUND_SYNC_MAX_BACKOFF}
# give up stream resumption after about 6 hours = 180 * 120s
max-restarts = 180
max-restarts = ${?BACKGROUND_SYNC_MAX_RESTARTS}
# assume upstream healthy if no error happened for this long
recovery = 5m
recovery = ${?BACKGROUND_SYNC_RECOCVERY}
}
stream {
# arrays bigger than this are not indexed.
# array indexing is more efficient for MongoDB 5.0 or above.
max-array-size = -1
max-array-size = ${?THINGS_SEARCH_UPDATER_STREAM_MAX_ARRAY_SIZE}
# minimum delay between event dumps must be at least 1s
write-interval = 1s
write-interval = ${?THINGS_SEARCH_UPDATER_STREAM_WRITE_INTERVAL}
# delay before updater actor is stopped after receiving thing deleted event
thing-deletion-timeout = 5m
thing-deletion-timeout = ${?THINGS_SEARCH_UPDATER_STREAM_THING_DELETION_TIMEOUT}
# configuration for retrieval of policies/things via sharding
ask-with-retry {
ask-timeout = 5s
ask-timeout = ${?THINGS_SEARCH_UPDATER_STREAM_ASK_TIMEOUT}
# one of: OFF, NO_DELAY, FIXED_DELAY, BACKOFF_DELAY
retry-strategy = BACKOFF_DELAY
retry-strategy = ${?THINGS_SEARCH_UPDATER_STREAM_RETRY_STRATEGY}
retry-attempts = 3
retry-attempts = ${?THINGS_SEARCH_UPDATER_STREAM_RETRY_ATTEMPTS}
fixed-delay = 5s
fixed-delay = ${?THINGS_SEARCH_UPDATER_STREAM_RETRY_FIXED_DELAY}
backoff-delay {
min = 100ms
max = 10s
# must be between 0.0 and 1.0:
random-factor = 0.5
}
}
# retrieval of things and policy-enforcers
retrieval {
# upper bound of parallel SudoRetrieveThing commands (by extension, parallel loads of policy enforcer cache)
parallelism = 16
parallelism = ${?THINGS_SEARCH_UPDATER_STREAM_RETRIEVAL_PARALLELISM}
# back-offs in case of failure
exponential-backoff {
min = 1s
max = 2m
random-factor = 2.0
}
}
# writing into the persistence
persistence {
# how many bulk writes to request in parallel; must be a power of 2
parallelism = 2
parallelism = ${?THINGS_SEARCH_UPDATER_STREAM_PERSISTENCE_PARALLELISM}
# how long to wait after DB acknowledgement before sending "search-persisted" acknowledgement
ack-delay = 0s
ack-delay = ${?THINGS_SEARCH_UPDATER_STREAM_PERSISTENCE_ACK_DELAY}
# mongoDB write concern to use for search updates requiring acknowledgement
with-acks-writeConcern = journaled
with-acks-writeConcern = ${?THINGS_SEARCH_UPDATER_STREAM_PERSISTENCE_WITH_ACKS_WRITE_CONCERN}
# backoffs in case of failure
exponential-backoff {
min = 1s
max = 2m
random-factor = 2.0
}
}
policy-cache {
# name of the dispatcher to run async cache loaders, which do not block threads
dispatcher = "policy-enforcer-cache-dispatcher"
# delay before retrying a cache query if the cached value is out of date
retry-delay = 1s
retry-delay = ${?THINGS_SEARCH_UPDATER_STREAM_POLICY_CACHE_RETRY_DELAY}
# how many enforcers to cache
maximum-size = 20000
maximum-size = ${?THINGS_SEARCH_UPDATER_STREAM_POLICY_CACHE_SIZE}
# lifetime of a cached enforcer. set very high because entries are invalidated lazily
expire-after-write = 2h
expire-after-write = ${?THINGS_SEARCH_UPDATER_STREAM_POLICY_CACHE_EXPIRY}
expire-after-access = 30m
expire-after-access = ${?THINGS_SEARCH_UPDATER_STREAM_POLICY_CACHE_EXPIRY_AFTER_ACCESS}
}
thing-cache {
# name of the dispatcher to run async cache loaders, which do not block threads
dispatcher = "thing-cache-dispatcher"
# how many things to cache
maximum-size = 20000
maximum-size = ${?THINGS_SEARCH_UPDATER_STREAM_THING_CACHE_SIZE}
# lifetime of a cached thing
expire-after-write = 2h
expire-after-write = ${?THINGS_SEARCH_UPDATER_STREAM_THING_CACHE_EXPIRY}
expire-after-access = 30m
expire-after-access = ${?THINGS_SEARCH_UPDATER_STREAM_THING_CACHE_EXPIRY_AFTER_ACCESS}
}
}
persistence {
# read preference is one of: primary, primaryPreferred, secondary, secondaryPreferred, nearest
readPreference = ${ditto.mongodb.options.readPreference}
readPreference = ${?UPDATER_PERSISTENCE_MONGO_DB_READ_PREFERENCE}
# read concern is one of: default, local, majority, linearizable, snapshot, available
readConcern = ${ditto.mongodb.options.readConcern}
readConcern = ${?UPDATER_PERSISTENCE_MONGO_DB_READ_CONCERN}
}
}
operator-metrics {
enabled = true
enabled = ${?THINGS_SEARCH_OPERATOR_METRICS_ENABLED}
# by default, execute "count" metrics once every 15 minutes:
scrape-interval = 15m
scrape-interval = ${?THINGS_SEARCH_OPERATOR_METRICS_SCRAPE_INTERVAL}
# map <metric-name, metric-config> of all custom metric providers
custom-metrics {
# built-in query, delivering the total things as metric
total_things {
enabled = true
scrape-interval = 15m # overwrite scrape interval, run each minute
# for all namespaces
namespaces = []
# with an empty filter query, counting all existing things
filter = ""
# optionally, provide tags to categorize metrics
tags {
# key = "value"
}
}
# add new metrics by providing more configuration entries:
# my_awesome_things {
# scrape-interval = 1m # overwrite scrape interval, run each minute
# namespaces [
# "org.eclipse.ditto.foo"
# "org.eclipse.ditto.bar"
# ]
# # with an empty filter query, counting all existing things
# filter = "eq(attributes/awesome,true)"
# }
}
}
}
}
pekko {
cluster {
sharding {
role = ${ditto.service-name}
passivation {
# default is "default-idle-strategy" with "idle-entity.timeout = 120s":
strategy = "off"
}
}
roles = [
${ditto.service-name},
"blocked-namespaces-aware",
]
}
}
search-dispatcher {
# one thread per query and a dedicated thread for the search actor
type = PinnedDispatcher
executor = "org.eclipse.ditto.internal.utils.metrics.executor.InstrumentedThreadPoolExecutorServiceConfigurator"
}
blocked-namespaces-dispatcher {
type = Dispatcher
executor = "org.eclipse.ditto.internal.utils.metrics.executor.InstrumentedForkJoinExecutorServiceConfigurator"
fork-join-executor {
# Min number of threads to cap factor-based parallelism number to
parallelism-min = 4
# Parallelism (threads) ... ceil(available processors * factor)
parallelism-factor = 3.0
# Max number of threads to cap factor-based parallelism number to
parallelism-max = 32
parallelism-max = ${?DEFAULT_DISPATCHER_PARALLELISM_MAX}
}
throughput = 5
}
policy-enforcer-cache-dispatcher {
type = Dispatcher
executor = "org.eclipse.ditto.internal.utils.metrics.executor.InstrumentedThreadPoolExecutorServiceConfigurator"
}
thing-cache-dispatcher {
type = Dispatcher
executor = "org.eclipse.ditto.internal.utils.metrics.executor.InstrumentedThreadPoolExecutorServiceConfigurator"
}
include "search-extension.conf"
include file("/opt/ditto/search-extension.conf")