Skip to content

Commit fd3f9d4

Browse files
author
Robey Pointer
committed
add more docs and clean them up a bit
1 parent 61cb176 commit fd3f9d4

File tree

3 files changed

+105
-195
lines changed

3 files changed

+105
-195
lines changed

README.md

+68-186
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Shhh!
1919
For more information about what it is and how to use it, check out
2020
the included [guide](https://github.com/robey/kestrel/blob/master/docs/guide.md).
2121

22-
Kestrel has a mailing list here: <[email protected]>
23-
http://groups.google.com/group/kestrel-talk
22+
Kestrel has a mailing list here:
23+
[[email protected]](http://groups.google.com/group/kestrel-talk)
2424

25-
Author's address: Robey Pointer <<[email protected]>>
25+
Author's address: Robey Pointer \<[email protected]>
2626

2727

2828
Features
@@ -32,27 +32,26 @@ Kestrel is:
3232

3333
- fast
3434

35-
It runs on the JVM so it can take advantage of the hard work people have
36-
put into java performance.
35+
It runs on the JVM so it can take advantage of the hard work people have
36+
put into java performance.
3737

3838
- small
3939

40-
Currently about 2K lines of scala (including comments), because it relies
41-
on Apache Mina (a rough equivalent of Danger's ziggurat or Ruby's
42-
EventMachine) and actors -- and frankly because Scala is extremely
43-
expressive.
40+
Currently about 2500 lines of scala, because it relies on Netty (a rough
41+
equivalent of Danger's ziggurat or Ruby's EventMachine) -- and because
42+
Scala is extremely expressive.
4443

4544
- durable
4645

47-
Queues are stored in memory for speed, but logged into a journal on disk
48-
so that servers can be shutdown or moved without losing any data.
46+
Queues are stored in memory for speed, but logged into a journal on disk
47+
so that servers can be shutdown or moved without losing any data.
4948

5049
- reliable
5150

52-
A client can ask to "tentatively" fetch an item from a queue, and if that
53-
client disconnects from kestrel before confirming ownership of the item,
54-
the item is handed to another client. In this way, crashing clients don't
55-
cause lost messages.
51+
A client can ask to "tentatively" fetch an item from a queue, and if that
52+
client disconnects from kestrel before confirming ownership of the item,
53+
the item is handed to another client. In this way, crashing clients don't
54+
cause lost messages.
5655

5756

5857
Anti-Features
@@ -62,15 +61,27 @@ Kestrel is not:
6261

6362
- strongly ordered
6463

65-
While each queue is strongly ordered on each machine, a cluster will
66-
appear "loosely ordered" because clients pick a machine at random for
67-
each operation. The end result should be "mostly fair".
64+
While each queue is strongly ordered on each machine, a cluster will
65+
appear "loosely ordered" because clients pick a machine at random for
66+
each operation. The end result should be "mostly fair".
6867

6968
- transactional
7069

71-
This is not a database. Item ownership is transferred with acknowledgement,
72-
but kestrel does not support grouping multiple operations into an atomic
73-
unit.
70+
This is not a database. Item ownership is transferred with acknowledgement,
71+
but kestrel does not support grouping multiple operations into an atomic
72+
unit.
73+
74+
75+
Downloading it
76+
--------------
77+
78+
The latest release is always on the homepage here:
79+
80+
- [http://robey.github.com/kestrel](http://robey.github.com/kestrel)
81+
82+
Or the latest development versions & branches are on github:
83+
84+
- [http://gitub.com/robey/kestrel](https://github.com/robey/kestrel)
7485

7586

7687
Building it
@@ -92,14 +103,12 @@ the first time you do a build. The finished distribution will be in `dist`.
92103
Running it
93104
----------
94105

95-
You can run kestrel by hand via:
106+
You can run kestrel by hand, in development mode, via:
96107

97-
$ java -jar ./dist/kestrel-VERSION/kestrel-VERSION.jar
108+
$ ./dist/kestrel-VERSION/scripts/devel.sh
98109

99-
To run in development mode (using `development.conf` instead of
100-
`production.conf`), add a `stage` variable:
101-
102-
$ java -Dstage=development -jar ./dist/kestrel-VERSION/kestrel-VERSION.jar
110+
Like all ostrich-based servers, it uses the "stage" property to determine
111+
which config file to load, so `devel.sh` sets `-Dstage=development`.
103112

104113
When running it as a server, a startup script is provided in
105114
`dist/kestrel-VERSION/scripts/kestrel.sh`. The script assumes you have
@@ -123,8 +132,8 @@ Configuration
123132
-------------
124133

125134
Queue configuration is described in detail in `docs/guide.md` (an operational
126-
guide). Scala docs for the config variables are here:
127-
http://robey.github.com/kestrel/doc/main/api/net/lag/kestrel/config/KestrelConfig.html
135+
guide). Scala docs for the config variables are
136+
[here](http://robey.github.com/kestrel/doc/main/api/net/lag/kestrel/config/KestrelConfig.html).
128137

129138

130139
Performance
@@ -134,37 +143,24 @@ Several performance tests are included. To run them, first start up a kestrel in
134143
locally.
135144

136145
$ sbt clean update package-dist
137-
$ VERSION="2.1.0-SNAPSHOT"
138-
$ java -server -Xmx1024m -Dstage=development -jar ./dist/kestrel-$VERSION/kestrel-$VERSION.jar
146+
$ ./dist/kestrel-VERSION/scripts/devel.sh
139147

140148
## Put-many
141149

142150
This test just spams a kestrel server with "put" operations, to see how
143151
quickly it can absorb and journal them.
144152

145-
$ sbt "put-many --help"
146-
usage: put-many [options]
147-
spam items into kestrel
148-
149-
options:
150-
-c CLIENTS
151-
use CLIENTS concurrent clients (default: 100)
152-
-n ITEMS
153-
put ITEMS items into the queue (default: 10000)
154-
-b BYTES
155-
put BYTES per queue item (default: 1024)
156-
157153
A sample run on a 2010 MacBook Pro:
158154

159-
[info] == put-many ==
160-
[info] Running net.lag.kestrel.load.PutMany -n 1000000
161-
Finished in 64921 msec (64.9 usec/put throughput).
162-
Transactions: min=95.00; max=528107.00 524847.00 521780.00;
163-
median=3433.00; average=5551.77 usec
164-
Transactions distribution: 5.00%=810.00 10.00%=1526.00 25.00%=2414.00
165-
50.00%=3433.00 75.00%=4851.00 90.00%=6933.00 95.00%=9145.00
166-
99.00%=59133.00 99.90%=208001.00 99.99%=505030.00
167-
[info] == put-many ==
155+
$ ./dist/kestrel/scripts/load/put-many -n 100000
156+
Put 100000 items of 1024 bytes to localhost:22133 in 1 queues named spam
157+
using 100 clients.
158+
Finished in 6137 msec (61.4 usec/put throughput).
159+
Transactions: min=71.00; max=472279.00 472160.00 469075.00;
160+
median=3355.00; average=5494.69 usec
161+
Transactions distribution: 5.00%=485.00 10.00%=1123.00 25.00%=2358.00
162+
50.00%=3355.00 75.00%=4921.00 90.00%=7291.00 95.00%=9729.00
163+
99.00%=50929.00 99.90%=384638.00 99.99%=467899.00
168164

169165
## Many-clients
170166

@@ -173,48 +169,27 @@ consumers fighting for each item. It usually takes exactly as long as the
173169
number of items times the delay, but is useful as a validation test to make
174170
sure kestrel works as advertised without blowing up.
175171

176-
$ sbt "many-clients --help"
177-
usage: many-clients [options]
178-
spin up N clients and have them do timeout reads on a queue while a
179-
single producer trickles out.
180-
181-
options:
182-
-s MILLESCONDS
183-
sleep MILLISECONDS between puts (default: 100)
184-
-n ITEMS
185-
put ITEMS total items into the queue (default: 100)
186-
-c CLIENTS
187-
use CLIENTS consumers (default: 100)
188-
189172
A sample run on a 2010 MacBook Pro:
190173

191-
[info] == many-clients ==
192-
[info] Running net.lag.kestrel.load.ManyClients
193-
Finished in 11104 msec.
194-
[info] == many-clients ==
174+
$ ./dist/kestrel/scripts/load/many-clients
175+
many-clients: 100 items to localhost using 100 clients, kill rate 0%,
176+
at 100 msec/item
177+
Received 100 items in 11046 msec.
178+
179+
This test always takes about 11 seconds -- it's a load test instead of a
180+
speed test.
195181

196182
## Flood
197183

198184
This test starts up one producer and one consumer, and just floods items
199185
through kestrel as fast as it can.
200186

201-
$ sbt "flood --help"
202-
usage: flood [options]
203-
spin up a producer and consumer and flood N items through kestrel
204-
205-
options:
206-
-n ITEMS
207-
put ITEMS items into the queue (default: 10000)
208-
-k KILOBYTES
209-
put KILOBYTES per queue item (default: 1)
210-
211187
A sample run on a 2010 MacBook Pro:
212188

213-
[info] == flood ==
214-
[info] Running net.lag.kestrel.load.Flood -n 100000
215-
flood: 100000 items of 1kB
216-
Finished in 16834 msec (168.3 usec/put throughput).
217-
Consumer spun 1 times in misses.
189+
$ ./dist/kestrel/scripts/load/flood
190+
flood: 1 threads each sending 10000 items of 1kB through spam
191+
Finished in 1563 msec (156.3 usec/put throughput).
192+
Consumer(s) spun 0 times in misses.
218193

219194
## Packing
220195

@@ -225,116 +200,23 @@ with a queue that's fallen behind and *stays* behind indefinitely, to make
225200
sure the journal files are packed periodically without affecting performance
226201
too badly.
227202

228-
$ sbt "packing --help"
229-
usage: packing [options]
230-
spin up a producer and consumer, write N items, then do read/write cycles
231-
with pauses
232-
233-
options:
234-
-q NAME
235-
use named queue (default: spam)
236-
-n ITEMS
237-
put ITEMS items into the queue (default: 25000)
238-
-k KILOBYTES
239-
put KILOBYTES per queue item (default: 1)
240-
-t SECONDS
241-
pause SECONDS between cycles (default: 1)
242-
-c CYCLES
243-
do read/writes CYCLES times (default: 100)
244-
-x
245-
use transactions when fetching
246-
247203
A sample run on a 2010 MacBook Pro:
248204

249-
[info] == packing ==
250-
[info] Running net.lag.kestrel.load.JournalPacking -c 10 -q small
205+
$ ./dist/kestrel/scripts/load/packing -c 10 -q small
251206
packing: 25000 items of 1kB with 1 second pauses
252207
Wrote 25000 items starting at 0.
253208
cycle: 1
254209
Wrote 25000 items starting at 25000.
255-
Read 25000 items in 5402 msec. Consumer spun 0 times in misses.
210+
Read 25000 items in 5279 msec. Consumer spun 0 times in misses.
256211
cycle: 2
257212
Wrote 25000 items starting at 50000.
258-
Read 25000 items in 5395 msec. Consumer spun 0 times in misses.
259-
cycle: 3
260-
Wrote 25000 items starting at 75000.
261-
Read 25000 items in 4584 msec. Consumer spun 0 times in misses.
262-
cycle: 4
263-
Wrote 25000 items starting at 100000.
264-
Read 25000 items in 4455 msec. Consumer spun 0 times in misses.
265-
cycle: 5
266-
Wrote 25000 items starting at 125000.
267-
Read 25000 items in 4742 msec. Consumer spun 0 times in misses.
268-
cycle: 6
269-
Wrote 25000 items starting at 150000.
270-
Read 25000 items in 4468 msec. Consumer spun 0 times in misses.
271-
cycle: 7
272-
Wrote 25000 items starting at 175000.
273-
Read 25000 items in 5127 msec. Consumer spun 0 times in misses.
274-
cycle: 8
275-
Wrote 25000 items starting at 200000.
276-
Read 25000 items in 4357 msec. Consumer spun 0 times in misses.
277-
cycle: 9
278-
Wrote 25000 items starting at 225000.
279-
Read 25000 items in 4500 msec. Consumer spun 0 times in misses.
213+
Read 25000 items in 4931 msec. Consumer spun 0 times in misses.
214+
...
280215
cycle: 10
281216
Wrote 25000 items starting at 250000.
282-
Read 25000 items in 4558 msec. Consumer spun 0 times in misses.
283-
Read 25000 items in 3141 msec. Consumer spun 0 times in misses.
284-
[info] == packing ==
285-
286-
You can see the journals being packed in the kestrel log:
287-
288-
INF [20110405-20:36:57.420] kestrel: Setting up queue small: maxItems=2147483647 maxSize=134217728.bytes maxItemSize=922
289-
3372036854775807.bytes maxAge=None defaultJournalSize=16777216.bytes maxMemorySize=16777216.bytes maxJournalSize=1342177
290-
28.bytes discardOldWhenFull=true keepJournal=true syncJournal=never expireToQueue=None maxExpireSweep=2147483647 fanoutO
291-
nly=false
292-
INF [20110405-20:36:57.421] kestrel: Replaying transaction journal for 'small'
293-
INF [20110405-20:36:57.422] kestrel: No transaction journal for 'small'; starting with empty queue.
294-
INF [20110405-20:36:57.422] kestrel: Finished transaction journal for 'small' (0 items, 0 bytes) xid=0
295-
INF [20110405-20:36:59.779] kestrel: Rotating journal file for 'small' (qsize=16440320)
296-
INF [20110405-20:36:59.852] kestrel: Dropping to read-behind for queue 'small' (16.0 MiB)
297-
INF [20110405-20:37:02.032] kestrel: Rotating journal file for 'small' (qsize=29139968)
298-
INF [20110405-20:37:04.583] kestrel: Rotating journal file for 'small' (qsize=35066880)
299-
INF [20110405-20:37:05.005] kestrel: Read-behind on 'small' moving from file small.1302061022051 to small.1302061024673
300-
INF [20110405-20:37:08.547] kestrel: Read-behind on 'small' moving from file small.1302061024673 to small
301-
INF [20110405-20:37:09.553] kestrel: Rotating journal file for 'small' (qsize=27975680)
302-
INF [20110405-20:37:12.412] kestrel: Read-behind on 'small' moving from file small.1302061029571 to small
303-
INF [20110405-20:37:14.511] kestrel: Rotating journal file for 'small' (qsize=26700800)
304-
INF [20110405-20:37:16.384] kestrel: Read-behind on 'small' moving from file small.1302061034588 to small
305-
INF [20110405-20:37:17.122] kestrel: Rotating journal file for 'small' (qsize=29371392)
306-
INF [20110405-20:37:20.164] kestrel: Read-behind on 'small' moving from file small.1302061037149 to small
307-
INF [20110405-20:37:21.410] kestrel: Rotating journal file for 'small' (qsize=26664960)
308-
INF [20110405-20:37:23.113] kestrel: Read-behind on 'small' moving from file small.1302061041427 to small
309-
INF [20110405-20:37:25.302] kestrel: Rotating journal file for 'small' (qsize=26168320)
310-
INF [20110405-20:37:27.118] kestrel: Read-behind on 'small' moving from file small.1302061045321 to small
311-
INF [20110405-20:37:27.119] kestrel: Rewriting journal file from checkpoint for 'small' (qsize=27889664)
312-
INF [20110405-20:37:27.129] kestrel: Packing journals for 'small': small.1302061019805, small.1302061022051, small.13020
313-
61024673, small.1302061029571, small.1302061034588, small.1302061037149, small.1302061041427, small.1302061045321
314-
INF [20110405-20:37:27.635] kestrel: Packing 'small' -- erasing old files.
315-
INF [20110405-20:37:27.646] kestrel: Packing 'small' done: small.1302061045321, small
316-
INF [20110405-20:37:28.115] kestrel: Rotating journal file for 'small' (qsize=28761088)
317-
INF [20110405-20:37:31.108] kestrel: Read-behind on 'small' moving from file small.1302061048143 to small
318-
INF [20110405-20:37:32.202] kestrel: Rotating journal file for 'small' (qsize=27242496)
319-
INF [20110405-20:37:34.048] kestrel: Read-behind on 'small' moving from file small.1302061052221 to small
320-
INF [20110405-20:37:36.255] kestrel: Rotating journal file for 'small' (qsize=25759744)
321-
INF [20110405-20:37:38.433] kestrel: Read-behind on 'small' moving from file small.1302061056360 to small
322-
INF [20110405-20:37:39.550] kestrel: Rotating journal file for 'small' (qsize=27325440)
323-
INF [20110405-20:37:42.266] kestrel: Read-behind on 'small' moving from file small.1302061059646 to small
324-
INF [20110405-20:37:43.464] kestrel: Rotating journal file for 'small' (qsize=26256384)
325-
INF [20110405-20:37:45.110] kestrel: Read-behind on 'small' moving from file small.1302061063469 to small
326-
INF [20110405-20:37:46.110] kestrel: Rotating journal file for 'small' (qsize=27487232)
327-
INF [20110405-20:37:48.928] kestrel: Read-behind on 'small' moving from file small.1302061066128 to small
328-
INF [20110405-20:37:49.875] kestrel: Rotating journal file for 'small' (qsize=28101632)
329-
INF [20110405-20:37:51.801] kestrel: Read-behind on 'small' moving from file small.1302061069893 to small
330-
INF [20110405-20:37:51.801] kestrel: Rewriting journal file from checkpoint for 'small' (qsize=26379264)
331-
INF [20110405-20:37:51.804] kestrel: Packing journals for 'small': small.1302061045321, small.1302061048143, small.13020
332-
61052221, small.1302061056360, small.1302061059646, small.1302061063469, small.1302061066128, small.1302061069893
333-
INF [20110405-20:37:52.237] kestrel: Packing 'small' -- erasing old files.
334-
INF [20110405-20:37:52.246] kestrel: Packing 'small' done: small.1302061069893, small
335-
INF [20110405-20:37:54.012] kestrel: Rotating journal file for 'small' (qsize=26510336)
336-
INF [20110405-20:37:55.808] kestrel: Read-behind on 'small' moving from file small.1302061074039 to small
337-
INF [20110405-20:37:56.594] kestrel: Rotating journal file for 'small' (qsize=29006848)
338-
INF [20110405-20:37:59.363] kestrel: Read-behind on 'small' moving from file small.1302061076614 to small
339-
INF [20110405-20:37:59.731] kestrel: Coming out of read-behind for queue 'small'
217+
Read 25000 items in 5304 msec. Consumer spun 0 times in misses.
218+
Read 25000 items in 3370 msec. Consumer spun 0 times in misses.
219+
220+
You can see the journals being packed in the kestrel log. Like
221+
"many-clients", this test is a load test instead of a speed test.
340222

0 commit comments

Comments
 (0)