forked from liyinhgqw/typesafe-config
/
example.go
206 lines (177 loc) · 5.97 KB
/
example.go
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
package main
import "fmt"
import "github.com/byrnedo/typesafe-config/parse"
var input string = `
akka {
loglevel = DEBUG
loggers = ["akka.event.slf4j.Slf4jLogger"]
event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
# Log the complete configuration at INFO level when the actor system is started.
# This is useful when you are uncertain of what configuration is used.
log-config-on-start = on
actor {
provider = "akka.cluster.ClusterActorRefProvider"
debug.receive = on
}
remote {
netty.tcp {
hostname = "127.0.0.1"
port = 2554
send-buffer-size = 30720000b
receive-buffer-size = 30720000b
maximum-frame-size = 10240000b
}
transport-failure-detector {
# since TCP is used, increase heartbeat-interval generously
# how often the node publishes heartbeats
heartbeat-interval = 100 s # default 4s
# if after this duration no heartbeat has been received, you have a problem
acceptable-heartbeat-pause = 250 s # default 10s
}
retry-gate-closed-for = 2 s # default 5s
}
cluster {
seed-nodes = ["akka.tcp://ripak@127.0.0.1:2554"]
roles = ["entity", "e2"]
auto-down-unreachable-after = 600 s
metrics.enabled = off
failure-detector {
heartbeat-interval = 100 s # default 1s
acceptable-heartbeat-pause = 250 s # default 3 s
threshold = 8.0 # default 8.0
}
scheduler {
# make it less than system's tick-duration to force start a new one
tick-duration = 9 ms # default 33ms
ticks-per-wheel = 512 # default 512
}
use-dispatcher = cluster-dispatcher
jmx.enabled = on
}
contrib.cluster {
sharding {
role = "entity"
buffer-size = 500000000
}
pub-sub {
gossip-interval = 3s # default 1s
}
}
test.single-expect-default = 10 s
}
cluster-dispatcher {
type = "Dispatcher"
executor = "fork-join-executor"
fork-join-executor {
parallelism-min = 2
parallelism-max = 4
}
}
akka.extensions = ["akka.contrib.pattern.DistributedPubSubExtension"]
ripak {
env = "staging"
persistence {
enable = on
purge = on
snapshot.batch = 100
}
timeline.max = 8000
follow.sync = off
sdk-dispatcher = {
# Dispatcher is the name of the event-based dispatcher
type = Dispatcher
# What kind of ExecutionService to use
executor = "fork-join-executor"
# Configuration for the fork join pool
fork-join-executor {
# Min number of threads to cap factor-based parallelism number to
parallelism-min = 20
# Parallelism (threads) ... ceil(available processors * factor)
parallelism-factor = 2.0
# Max number of threads to cap factor-based parallelism number to
parallelism-max = 100
}
}
web = {
host = "0.0.0.0"
port = 8080
}
}
//akka.persistence.journal.leveldb.dir = "target/journal"
//akka.persistence.snapshot-store.local.dir = "target/snapshots"
akka.persistence.journal.plugin = "hbase-journal"
akka.persistence.snapshot-store.plugin = "hadoop-snapshot-store"
hbase-journal {
# Partitions will be used to avoid the "hot write region" problem.
# Set this to a number greater than the expected number of regions of your table.
# WARNING: It is not supported to change the partition count when already written to a table (could miss some records)
partition.count = 5
# Name of the table to be used by the journal
table = "rp:ripak_pubsub_messages_benchmark"
# Name of the family to be used by the journal
family = "message"
# When performing scans, how many items to we want to obtain per one next(N) call.
# This most notably affects the speed at which message replay progresses, fine tune this to match your cluster.
scan-batch-size = 200
# Dispatcher for fetching and replaying messages
replay-dispatcher = "akka-hbase-persistence-replay-dispatcher"
# Default dispatcher used by plugin
plugin-dispatcher = "akka-hbase-persistence-dispatcher"
}
hadoop-snapshot-store {
# select your preferred implementation based on your needs
#
# * HBase - snapshots stored together with snapshots; Snapshot size limited by Int.MaxValue bytes (currently)
#
# * HDFS *deprecated, will be separate project* - can handle HUGE snapshots;
# Can be easily dumped to local filesystem using Hadoop CL tools
# impl class is "akka.persistence.hbase.snapshot.HdfsSnapshotter"
mode = "hbase"
hbase {
# Name of the table to be used by the journal
table = "rp:ripak_pubsub_snapshots_benchmark"
# Name of the family to be used by the journal
family = "snapshot"
}
# Default dispatcher used by plugin
plugin-dispatcher = "akka-hbase-persistence-dispatcher"
}
akka-hbase-persistence-dispatcher {
type = Dispatcher
executor = "thread-pool-executor"
thread-pool-executor {
core-pool-size-min = 15
core-pool-size-factor = 2.0
core-pool-size-max = 30
}
throughput = 200
}
akka-hbase-persistence-replay-dispatcher {
type = Dispatcher
executor = "thread-pool-executor"
thread-pool-executor {
core-pool-size-min = 15
core-pool-size-factor = 2.5
core-pool-size-max = 30
}
throughput = 200
}
`
func main() {
result, err := parse.Parse("test", input)
if err != nil {
panic(err)
} else {
fmt.Println(result.Root)
conf := result.GetConfig()
fmt.Println(conf.GetValue("akka-hbase-persistence-replay-dispatcher.thread-pool-executor.core-pool-size-min"))
fmt.Println(conf.GetFloat("akka-hbase-persistence-replay-dispatcher.thread-pool-executor.core-pool-size-min"))
fmt.Println(conf.GetBool("akka.actor.debug.receive"))
fmt.Println(conf.GetString("akka-hbase-persistence-replay-dispatcher.type"))
fmt.Println(conf.GetString("akka.cluster.auto-down-unreachable-after"))
fmt.Println(conf.GetValue("akka.cluster.roles"))
fmt.Println(conf.GetArray("akka.cluster.roles"))
fmt.Println(conf.GetString("akka-hbase-persistence-replay-dispatcher.executor"))
fmt.Println(conf.GetFloat("akka-hbase-persistence-replay-dispatcher.thread-pool-executor.core-pool-size-factor"))
}
}