diff --git a/README.md b/README.md
index 0614db0..530f039 100644
--- a/README.md
+++ b/README.md
@@ -21,21 +21,19 @@ Siberite also supports Kestrel's two-phase reliable fetch: if a client disconnec
a message, the message will be handed to the next client.
Compared to Kestrel and Darner, Siberite is easier to build, maintain and distribute.
-It uses an order of magnitude less memory compared to Kestrel, but has less configuration far fewer features.
-
-Siberite is used at [Spyonweb.com](http://spyonweb.com).
-We used to use Darner before, but got 2 large production queues corrupted at some point and decided to rewrite it in Go.
+It uses an order of magnitude less memory compared to Kestrel, and has an ability
+to consume queue multiple times (using durable cursors feature).
## Features
-1. Multiple consumer groups per queue using `get :` syntax.
+1. Multiple durable cursors per queue using `get :` syntax.
- When you read an item in a usual way: `get `, item gets expired and deleted.
- - When you read an item using cursor syntax `get :`, a durable
+ - When you read an item using cursor syntax `get :`, a durable
cursor gets initialized. It shifts forward with every read without deleting
any messages in the source queue. Number of cursors per queue is not limited.
- If you continue reads from the source queue directly, siberite will continue
- deleting messages from the head of that queue. Any existing cursor that is
+ to delete messages from the head of the queue. Any existing cursor that
internally points to an already deleted message will catch up during next read
and will start serving messages from the current source queue head.
- Durable cursors are also support two-phase reliable reads. All failed reliable
@@ -124,6 +122,10 @@ END
# get work/open
# get work/close/open
# get work/abort
+# get work:cursor_name
+# get work:cursor_name/open
+# get work:my_cursor/close/open
+# set work+fanout_queue
# flush work
# delete work
# flush_all
diff --git a/cgroup/cgqueue_benchmark_test.go b/cgroup/cgqueue_benchmark_test.go
new file mode 100644
index 0000000..ced4c3e
--- /dev/null
+++ b/cgroup/cgqueue_benchmark_test.go
@@ -0,0 +1,192 @@
+package cgroup
+
+import (
+ "crypto/rand"
+ "testing"
+)
+
+func Benchmark_CGQueue_Enqueue_1_Byte(b *testing.B) {
+ q, _ := CGQueueOpen(cgQueueName, dir)
+ defer q.Drop()
+ value := make([]byte, 1)
+ rand.Read(value)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.Enqueue(value)
+ }
+}
+
+func Benchmark_CGQueue_Enqueue_128_Bytes(b *testing.B) {
+ q, _ := CGQueueOpen(cgQueueName, dir)
+ defer q.Drop()
+ value := make([]byte, 128)
+ rand.Read(value)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.Enqueue(value)
+ }
+
+}
+
+func Benchmark_CGQueue_Enqueue_1024_Bytes(b *testing.B) {
+ q, _ := CGQueueOpen(cgQueueName, dir)
+ defer q.Drop()
+ value := make([]byte, 1024)
+ rand.Read(value)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.Enqueue(value)
+ }
+
+}
+
+func Benchmark_CGQueue_Enqueue_10240_Bytes(b *testing.B) {
+ q, _ := CGQueueOpen(cgQueueName, dir)
+ defer q.Drop()
+ value := make([]byte, 10240)
+ rand.Read(value)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.Enqueue(value)
+ }
+}
+
+func Benchmark_CGQueue_GetNext_1_Byte(b *testing.B) {
+ q, _ := CGQueueOpen(cgQueueName, dir)
+ defer q.Drop()
+ value := make([]byte, 1)
+ rand.Read(value)
+ for i := 0; i < 500000; i++ {
+ q.Enqueue(value)
+ }
+
+ q.Close()
+ q, _ = CGQueueOpen(cgQueueName, dir)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.GetNext()
+ }
+}
+
+func Benchmark_CGQueue_GetNext_128_Bytes(b *testing.B) {
+ q, _ := CGQueueOpen(cgQueueName, dir)
+ defer q.Drop()
+ value := make([]byte, 128)
+ rand.Read(value)
+ for i := 0; i < 500000; i++ {
+ q.Enqueue(value)
+ }
+
+ q.Close()
+ q, _ = CGQueueOpen(cgQueueName, dir)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.GetNext()
+ }
+}
+
+func Benchmark_CGQueue_GetNext_1024_Bytes(b *testing.B) {
+ q, _ := CGQueueOpen(cgQueueName, dir)
+ defer q.Drop()
+ value := make([]byte, 1024)
+ rand.Read(value)
+ for i := 0; i < 200000; i++ {
+ q.Enqueue(value)
+ }
+
+ q.Close()
+ q, _ = CGQueueOpen(cgQueueName, dir)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.GetNext()
+ }
+}
+
+func Benchmark_CGQueue_GetNext_10240_Bytes(b *testing.B) {
+ q, _ := CGQueueOpen(cgQueueName, dir)
+ defer q.Drop()
+ value := make([]byte, 10240)
+ rand.Read(value)
+ for i := 0; i < 50000; i++ {
+ q.Enqueue(value)
+ }
+
+ q.Close()
+ q, _ = CGQueueOpen(cgQueueName, dir)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.GetNext()
+ }
+}
+
+func Benchmark_CGQueue_ConsumerGroup_1_Byte(b *testing.B) {
+ q, _ := CGQueueOpen(cgQueueName, dir)
+ defer q.Drop()
+ value := make([]byte, 1)
+ rand.Read(value)
+ for i := 0; i < 500000; i++ {
+ q.Enqueue(value)
+ }
+
+ q.Close()
+ q, _ = CGQueueOpen(cgQueueName, dir)
+ cg, _ := q.ConsumerGroup("test")
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ cg.GetNext()
+ }
+}
+
+func Benchmark_CGQueue_ConsumerGroup_128_Bytes(b *testing.B) {
+ q, _ := CGQueueOpen(cgQueueName, dir)
+ defer q.Drop()
+ value := make([]byte, 128)
+ rand.Read(value)
+ for i := 0; i < 500000; i++ {
+ q.Enqueue(value)
+ }
+
+ q.Close()
+ q, _ = CGQueueOpen(cgQueueName, dir)
+ cg, _ := q.ConsumerGroup("test")
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ cg.GetNext()
+ }
+}
+
+func Benchmark_CGQueue_ConsumerGroup_1024_Bytes(b *testing.B) {
+ q, _ := CGQueueOpen(cgQueueName, dir)
+ defer q.Drop()
+ value := make([]byte, 1024)
+ rand.Read(value)
+ for i := 0; i < 200000; i++ {
+ q.Enqueue(value)
+ }
+
+ q.Close()
+ q, _ = CGQueueOpen(cgQueueName, dir)
+ cg, _ := q.ConsumerGroup("test")
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ cg.GetNext()
+ }
+}
+
+func Benchmark_CGQueue_ConsumerGroup_10240_Bytes(b *testing.B) {
+ q, _ := CGQueueOpen(cgQueueName, dir)
+ defer q.Drop()
+ value := make([]byte, 10240)
+ rand.Read(value)
+ for i := 0; i < 200000; i++ {
+ q.Enqueue(value)
+ }
+
+ q.Close()
+ q, _ = CGQueueOpen(cgQueueName, dir)
+ cg, _ := q.ConsumerGroup("test")
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ cg.GetNext()
+ }
+}
diff --git a/docs/benchmarks.md b/docs/benchmarks.md
index 67ac7af..be9ef3d 100644
--- a/docs/benchmarks.md
+++ b/docs/benchmarks.md
@@ -3,7 +3,7 @@ Benchmark Details:
* OS X Yosemite 10.10.5
* Kestrel 2.4.8, Java 1.6.0_65, -Xmx1024m
* Darner 0.2.5 [Innometrics/darner](https://github.com/Innometrics/darner) built with RocksDB
-* Siberite 0.4.2
+* Siberite 0.5.1
# Resident Memory
@@ -15,41 +15,41 @@ Kestrel memory settings: `-Xmx1024m`.
```
$ ./mem_rss.sh
-kestrel 0 requests: 168348 kB
-kestrel 1024 requests: 198680 kB
-kestrel 2048 requests: 217764 kB
-kestrel 4096 requests: 246204 kB
-kestrel 8192 requests: 240440 kB
-kestrel 16384 requests: 255976 kB
-kestrel 32768 requests: 295148 kB
-kestrel 65536 requests: 321204 kB
-kestrel 131072 requests: 459004 kB
-kestrel 262024 requests: 775740 kB
-kestrel 524048 requests: 833664 kB
-
-darner 0 requests: 2832 kB
-darner 1024 requests: 4632 kB
-darner 2048 requests: 6868 kB
-darner 4096 requests: 9140 kB
+kestrel 0 requests: 186640 kB
+kestrel 1024 requests: 225440 kB
+kestrel 2048 requests: 226864 kB
+kestrel 4096 requests: 240208 kB
+kestrel 8192 requests: 249720 kB
+kestrel 16384 requests: 272672 kB
+kestrel 32768 requests: 370124 kB
+kestrel 65536 requests: 465836 kB
+kestrel 131072 requests: 636508 kB
+kestrel 262024 requests: 763916 kB
+kestrel 524048 requests: 840048 kB
+
+darner 0 requests: 2844 kB
+darner 1024 requests: 4644 kB
+darner 2048 requests: 6880 kB
+darner 4096 requests: 9152 kB
darner 8192 requests: 17296 kB
-darner 16384 requests: 25040 kB
-darner 32768 requests: 46352 kB
-darner 65536 requests: 47584 kB
-darner 131072 requests: 49060 kB
-darner 262024 requests: 50764 kB
-darner 524048 requests: 54112 kB
-
-siberite 0 requests: 2420 kB
-siberite 1024 requests: 10084 kB
-siberite 2048 requests: 12324 kB
-siberite 4096 requests: 20064 kB
-siberite 8192 requests: 36932 kB
-siberite 16384 requests: 45400 kB
-siberite 32768 requests: 50612 kB
-siberite 65536 requests: 58412 kB
-siberite 131072 requests: 65208 kB
-siberite 262024 requests: 81800 kB
-siberite 524048 requests: 87360 kB
+darner 16384 requests: 25052 kB
+darner 32768 requests: 44384 kB
+darner 65536 requests: 45708 kB
+darner 131072 requests: 48988 kB
+darner 262024 requests: 50668 kB
+darner 524048 requests: 54024 kB
+
+siberite 0 requests: 3216 kB
+siberite 1024 requests: 10568 kB
+siberite 2048 requests: 16984 kB
+siberite 4096 requests: 22400 kB
+siberite 8192 requests: 38416 kB
+siberite 16384 requests: 50384 kB
+siberite 32768 requests: 53912 kB
+siberite 65536 requests: 62280 kB
+siberite 131072 requests: 68304 kB
+siberite 262024 requests: 87908 kB
+siberite 524048 requests: 93868 kB
```
# Queue Flooding
@@ -61,56 +61,56 @@ How quickly can we flood items through 10 queues? This tests the raw throughput
```
$ ./flood.sh
warming up kestrel...done.
-kestrel 1 conns: 16375 (requests/s mean)
-kestrel 2 conns: 30039
-kestrel 5 conns: 45235
-kestrel 10 conns: 55656
-kestrel 50 conns: 58945
-kestrel 100 conns: 59103
-kestrel 200 conns: 58564
-kestrel 300 conns: 57807
-kestrel 400 conns: 57621
-kestrel 600 conns: 57065
-kestrel 800 conns: 57273
-kestrel 1000 conns: 56685
-kestrel 2000 conns: 44625
-kestrel 4000 conns: 37366
-kestrel 6000 conns: 13404
-kestrel 8000 conns: 18523
-
-darner 1 conns: 20375
-darner 2 conns: 38828
-darner 5 conns: 51813
-darner 10 conns: 54161
-darner 50 conns: 54177
-darner 100 conns: 53461
-darner 200 conns: 52483
-darner 300 conns: 51443
-darner 400 conns: 51400
-darner 600 conns: 51803
-darner 800 conns: 48456
-darner 1000 conns: 48253
-darner 2000 conns: 42728
-darner 4000 conns: 26062
-darner 6000 conns: 23156
-darner 8000 conns: 15040
-
-siberite 1 conns: 16982
-siberite 2 conns: 29770
-siberite 5 conns: 48896
-siberite 10 conns: 65952
-siberite 50 conns: 72798
-siberite 100 conns: 74385
-siberite 200 conns: 69777
-siberite 300 conns: 68507
-siberite 400 conns: 67018
-siberite 600 conns: 64851
-siberite 800 conns: 63509
-siberite 1000 conns: 61003
-siberite 2000 conns: 48766
-siberite 4000 conns: 25512
-siberite 6000 conns: 21621
-siberite 8000 conns: 15876
+kestrel 1 conns: 16999
+kestrel 2 conns: 31427
+kestrel 5 conns: 45621
+kestrel 10 conns: 58320
+kestrel 50 conns: 60848
+kestrel 100 conns: 61386
+kestrel 200 conns: 61653
+kestrel 300 conns: 62213
+kestrel 400 conns: 61544
+kestrel 600 conns: 60760
+kestrel 800 conns: 60060
+kestrel 1000 conns: 60238
+kestrel 2000 conns: 57317
+kestrel 4000 conns: 53794
+kestrel 6000 conns: 33423
+kestrel 8000 conns: 14921
+
+darner 1 conns: 20759
+darner 2 conns: 40485
+darner 5 conns: 53974
+darner 10 conns: 55463
+darner 50 conns: 56427
+darner 100 conns: 54964
+darner 200 conns: 50006
+darner 300 conns: 53547
+darner 400 conns: 50913
+darner 600 conns: 50211
+darner 800 conns: 48789
+darner 1000 conns: 46738
+darner 2000 conns: 41843
+darner 4000 conns: 24389
+darner 6000 conns: 23948
+darner 8000 conns: 15980
+
+siberite 1 conns: 16947
+siberite 2 conns: 30316
+siberite 5 conns: 48104
+siberite 10 conns: 65828
+siberite 50 conns: 72513
+siberite 100 conns: 74224
+siberite 200 conns: 70746
+siberite 300 conns: 69121
+siberite 400 conns: 68170
+siberite 600 conns: 65776
+siberite 800 conns: 64164
+siberite 1000 conns: 61821
+siberite 2000 conns: 49407
+siberite 4000 conns: 23952
+siberite 6000 conns: 24418
+siberite 8000 conns: 15984
```
# Queue Packing (1024 byte message size)
@@ -125,32 +125,32 @@ free memory. Instead it's important for the throughput to flatten out as the ba
```
$ ./packing.sh
warming up kestrel...done.
-kestrel 0 sets: 15052
-kestrel 1024 sets: 15525
-kestrel 16384 sets: 15377
-kestrel 65536 sets: 14683
-kestrel 262144 sets: 14147
-kestrel 1048576 sets: 14099
-kestrel 4194304 sets: 14893
-kestrel 8388608 sets: 14831
-
-darner 0 sets: 19459
-darner 1024 sets: 18821
-darner 16384 sets: 16667
-darner 65536 sets: 16206
-darner 262144 sets: 16551
-darner 1048576 sets: 15245
-darner 4194304 sets: 14875
-darner 8388608 sets: 14750
-
-siberite 0 sets: 15466
-siberite 1024 sets: 15583
-siberite 16384 sets: 14077
-siberite 65536 sets: 12898
-siberite 262144 sets: 12180
-siberite 1048576 sets: 11310
-siberite 4194304 sets: 11287
-siberite 8388608 sets: 11373
+kestrel 0 sets: 16278
+kestrel 1024 sets: 16523
+kestrel 16384 sets: 16540
+kestrel 65536 sets: 16376
+kestrel 262144 sets: 15182
+kestrel 1048576 sets: 15386
+kestrel 4194304 sets: 15060
+kestrel 8388608 sets: 15116
+
+darner 0 sets: 17388
+darner 1024 sets: 16521
+darner 16384 sets: 14525
+darner 65536 sets: 13189
+darner 262144 sets: 12856
+darner 1048576 sets: 15290
+darner 4194304 sets: 14990
+darner 8388608 sets: 14756
+
+siberite 0 sets: 16084
+siberite 1024 sets: 15886
+siberite 16384 sets: 14600
+siberite 65536 sets: 13507
+siberite 262144 sets: 12944
+siberite 1048576 sets: 12486
+siberite 4194304 sets: 12508
+siberite 8388608 sets: 12316
```
# Queue Packing and Unpacking (64 byte message size)
@@ -215,28 +215,28 @@ darner | items: 44272468 | speed: 18028 ops/s
darner | items: 22136234 | speed: 17244 ops/s
darner | items: 0 | speed: 20864 ops/s
-siberite | items: 0 | speed: 14768 ops/s
-siberite | items: 1024 | speed: 15391 ops/s
-siberite | items: 17408 | speed: 15076 ops/s
-siberite | items: 82944 | speed: 15687 ops/s
-siberite | items: 345088 | speed: 15776 ops/s
-siberite | items: 1393664 | speed: 14984 ops/s
-siberite | items: 5587968 | speed: 15207 ops/s
-siberite | items: 13976576 | speed: 15121 ops/s
-siberite | items: 30753792 | speed: 14596 ops/s
-siberite | items: 64308224 | speed: 15309 ops/s
-siberite | items: 131417088 | speed: 13376 ops/s
-siberite | items: 265634816 | speed: 14628 ops/s
-siberite | items: 243498574 | speed: 14704 ops/s
-siberite | items: 221362340 | speed: 15243 ops/s
-siberite | items: 199226106 | speed: 15157 ops/s
-siberite | items: 177089872 | speed: 15086 ops/s
-siberite | items: 154953638 | speed: 15086 ops/s
-siberite | items: 132817404 | speed: 14033 ops/s
-siberite | items: 110681170 | speed: 15070 ops/s
-siberite | items: 88544936 | speed: 14226 ops/s
-siberite | items: 66408702 | speed: 14343 ops/s
-siberite | items: 44272468 | speed: 14517 ops/s
-siberite | items: 22136234 | speed: 13788 ops/s
-siberite | items: 0 | speed: 14602 ops/s
+siberite | items: 0 | speed: 17292 ops/s
+siberite | items: 1024 | speed: 16288 ops/s
+siberite | items: 17408 | speed: 15470 ops/s
+siberite | items: 82944 | speed: 15144 ops/s
+siberite | items: 345088 | speed: 15209 ops/s
+siberite | items: 1393664 | speed: 14344 ops/s
+siberite | items: 5587968 | speed: 15191 ops/s
+siberite | items: 13976576 | speed: 14833 ops/s
+siberite | items: 30753792 | speed: 15883 ops/s
+siberite | items: 64308224 | speed: 15127 ops/s
+siberite | items: 131417088 | speed: 14557 ops/s
+siberite | items: 265634816 | speed: 15677 ops/s
+siberite | items: 243498574 | speed: 15827 ops/s
+siberite | items: 221362340 | speed: 15964 ops/s
+siberite | items: 199226106 | speed: 16067 ops/s
+siberite | items: 177089872 | speed: 16022 ops/s
+siberite | items: 154953638 | speed: 16025 ops/s
+siberite | items: 132817404 | speed: 16348 ops/s
+siberite | items: 110681170 | speed: 16166 ops/s
+siberite | items: 88544936 | speed: 16288 ops/s
+siberite | items: 66408702 | speed: 16365 ops/s
+siberite | items: 44272468 | speed: 16272 ops/s
+siberite | items: 22136234 | speed: 16250 ops/s
+siberite | items: 0 | speed: 17630 ops/s
```
diff --git a/docs/images/benchmark_queue_flood.png b/docs/images/benchmark_queue_flood.png
index 503d94c..8bce6b2 100644
Binary files a/docs/images/benchmark_queue_flood.png and b/docs/images/benchmark_queue_flood.png differ
diff --git a/docs/images/benchmark_queue_packing_1024.png b/docs/images/benchmark_queue_packing_1024.png
index 3238dc5..da3d865 100644
Binary files a/docs/images/benchmark_queue_packing_1024.png and b/docs/images/benchmark_queue_packing_1024.png differ
diff --git a/docs/images/benchmark_queue_packing_64.png b/docs/images/benchmark_queue_packing_64.png
index 37b8a0a..ab07b3e 100644
Binary files a/docs/images/benchmark_queue_packing_64.png and b/docs/images/benchmark_queue_packing_64.png differ
diff --git a/docs/images/benchmark_queue_unpacking_64.png b/docs/images/benchmark_queue_unpacking_64.png
index 6e7dd0f..c8c4c7e 100644
Binary files a/docs/images/benchmark_queue_unpacking_64.png and b/docs/images/benchmark_queue_unpacking_64.png differ
diff --git a/docs/images/benchmark_resident_memory.png b/docs/images/benchmark_resident_memory.png
index 51339b4..227026d 100644
Binary files a/docs/images/benchmark_resident_memory.png and b/docs/images/benchmark_resident_memory.png differ
diff --git a/queue/queue_benchmark_test.go b/queue/queue_benchmark_test.go
new file mode 100644
index 0000000..ec77c42
--- /dev/null
+++ b/queue/queue_benchmark_test.go
@@ -0,0 +1,120 @@
+package queue
+
+import (
+ "crypto/rand"
+ "testing"
+)
+
+func Benchmark_Queue_Enqueue_1_Byte(b *testing.B) {
+ q, _ := Open(name, dir, &options)
+ defer q.Drop()
+ value := make([]byte, 1)
+ rand.Read(value)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.Enqueue(value)
+ }
+}
+
+func Benchmark_Queue_Enqueue_128_Bytes(b *testing.B) {
+ q, _ := Open(name, dir, &options)
+ defer q.Drop()
+ value := make([]byte, 128)
+ rand.Read(value)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.Enqueue(value)
+ }
+
+}
+
+func Benchmark_Queue_Enqueue_1024_Bytes(b *testing.B) {
+ q, _ := Open(name, dir, &options)
+ defer q.Drop()
+ value := make([]byte, 1024)
+ rand.Read(value)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.Enqueue(value)
+ }
+
+}
+
+func Benchmark_Queue_Enqueue_10240_Bytes(b *testing.B) {
+ q, _ := Open(name, dir, &options)
+ defer q.Drop()
+ value := make([]byte, 10240)
+ rand.Read(value)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.Enqueue(value)
+ }
+}
+
+func Benchmark_Queue_GetNext_1_Byte(b *testing.B) {
+ q, _ := Open(name, dir, &options)
+ defer q.Drop()
+ value := make([]byte, 1)
+ rand.Read(value)
+ for i := 0; i < 500000; i++ {
+ q.Enqueue(value)
+ }
+
+ q.Close()
+ q, _ = Open(name, dir, &options)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.GetNext()
+ }
+}
+
+func Benchmark_Queue_GetNext_128_Bytes(b *testing.B) {
+ q, _ := Open(name, dir, &options)
+ defer q.Drop()
+ value := make([]byte, 128)
+ rand.Read(value)
+ for i := 0; i < 500000; i++ {
+ q.Enqueue(value)
+ }
+
+ q.Close()
+ q, _ = Open(name, dir, &options)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.GetNext()
+ }
+}
+
+func Benchmark_Queue_GetNext_1024_Bytes(b *testing.B) {
+ q, _ := Open(name, dir, &options)
+ defer q.Drop()
+ value := make([]byte, 1024)
+ rand.Read(value)
+ for i := 0; i < 200000; i++ {
+ q.Enqueue(value)
+ }
+
+ q.Close()
+ q, _ = Open(name, dir, &options)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.GetNext()
+ }
+}
+
+func Benchmark_Queue_GetNext_10240_Bytes(b *testing.B) {
+ q, _ := Open(name, dir, &options)
+ defer q.Drop()
+ value := make([]byte, 10240)
+ rand.Read(value)
+ for i := 0; i < 200000; i++ {
+ q.Enqueue(value)
+ }
+
+ q.Close()
+ q, _ = Open(name, dir, &options)
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ q.GetNext()
+ }
+}