forked from mongodb/mongo-perf
/
benchmark.cpp
834 lines (741 loc) · 25.1 KB
/
benchmark.cpp
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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
#ifndef MONGO_EXPOSE_MACROS
# define MONGO_EXPOSE_MACROS
#endif
#include <mongo/client/dbclient.h>
#include <iostream>
#include <cstdlib>
#include <vector>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/thread.hpp>
#ifndef _WIN32
#include <cxxabi.h>
#endif
using namespace std;
using namespace mongo;
namespace {
const int thread_nums[] = {1,2,4,5,8,10};
const int max_threads = 10;
// Global connections
DBClientConnection _conn[max_threads];
bool multi_db = false;
const char* _db = "benchmarks";
const char* _coll = "collection";
string ns[max_threads];
// wrapper funcs to route to different dbs. thread == -1 means all dbs
void ensureIndex(int thread, const BSONObj& obj) {
if (!multi_db){
_conn[max(0,thread)].resetIndexCache();
_conn[max(0,thread)].ensureIndex(ns[0], obj);
}
else if (thread != -1){
_conn[thread].resetIndexCache();
_conn[thread].ensureIndex(ns[thread], obj);
return;
}
else {
for (int t=0; t<max_threads; t++) {
ensureIndex(t, obj);
}
}
}
template <typename VectorOrBSONObj>
void insert(int thread, const VectorOrBSONObj& obj) {
if (!multi_db){
_conn[max(0,thread)].insert(ns[0], obj);
}
else if (thread != -1){
_conn[thread].insert(ns[thread], obj);
return;
}
else {
for (int t=0; t<max_threads; t++) {
insert(t, obj);
}
}
}
void update(int thread, const BSONObj& qObj, const BSONObj uObj, bool upsert=false, bool multi=false) {
assert(thread != -1); // cant run on all conns
_conn[thread].update(ns[multi_db?thread:0], qObj, uObj, upsert, multi);
return;
}
void findOne(int thread, const BSONObj& obj) {
assert(thread != -1); // cant run on all conns
_conn[thread].findOne(ns[multi_db?thread:0], obj);
return;
}
auto_ptr<DBClientCursor> query(int thread, const Query& q, int limit=0, int skip=0) {
assert(thread != -1); // cant run on all conns
return _conn[thread].query(ns[multi_db?thread:0], q, limit, skip);
}
void getLastError(int thread=-1) {
if (thread != -1){
_conn[thread].getLastError();
return;
}
for (int t=0; t<max_threads; t++)
getLastError(t);
}
// passed in as argument
int iterations;
struct TestBase{
virtual void run(int thread, int nthreads) = 0;
virtual void reset() = 0;
virtual string name() = 0;
virtual ~TestBase() {}
};
template <typename T>
struct Test: TestBase{
virtual void run(int thread, int nthreads){
test.run(thread, nthreads);
getLastError(thread); //wait for operation to complete
}
virtual void reset(){
test.reset();
}
virtual string name(){
//from mongo::regression::demangleName()
#ifdef _WIN32
return typeid(T).name();
#else
int status;
char * niceName = abi::__cxa_demangle(typeid(T).name(), 0, 0, &status);
if ( ! niceName )
return typeid(T).name();
string s = niceName;
free(niceName);
return s;
#endif
}
T test;
};
struct TestSuite{
template <typename T>
void add(){
tests.push_back(new Test<T>());
}
void run(){
for (vector<TestBase*>::iterator it=tests.begin(), end=tests.end(); it != end; ++it){
TestBase* test = *it;
boost::posix_time::ptime startTime, endTime; //reused
cerr << "########## " << test->name() << " ##########" << endl;
BSONObjBuilder results;
double one_micros;
BOOST_FOREACH(int nthreads, thread_nums){
test->reset();
startTime = boost::posix_time::microsec_clock::universal_time();
launch_subthreads(nthreads, test);
endTime = boost::posix_time::microsec_clock::universal_time();
double micros = (endTime-startTime).total_microseconds() / 1000000.0;
if (nthreads == 1)
one_micros = micros;
results.append(BSONObjBuilder::numStr(nthreads),
BSON( "time" << micros
<< "ops_per_sec" << iterations / micros
<< "speedup" << one_micros / micros
));
}
BSONObj out =
BSON( "name" << test->name()
<< "results" << results.obj()
);
cout << out.jsonString(Strict) << endl;
}
}
private:
vector<TestBase*> tests;
void launch_subthreads(int remaining, TestBase* test, int total=-1){ //total = remaining
if (!remaining) return;
if (total == -1)
total = remaining;
boost::thread athread(boost::bind(&TestBase::run, test, total-remaining, total));
launch_subthreads(remaining - 1, test, total);
athread.join();
}
};
void clearDB(){
for (int i=0; i<max_threads; i++) {
_conn[0].dropDatabase(_db + BSONObjBuilder::numStr(i));
_conn[0].getLastError();
if (!multi_db)
return;
}
}
}
namespace Overhead{
// this tests the overhead of the system
struct DoNothing{
void run(int t, int n) {}
void reset(){ clearDB(); }
};
}
namespace Insert{
struct Base{
void reset(){ clearDB(); }
};
/*
* inserts empty documents.
*/
struct Empty : Base{
void run(int t, int n) {
for (int i=0; i < iterations / n; i++){
insert(t, BSONObj());
}
}
};
/*
* inserts batches of empty documents.
*/
template <int BatchSize>
struct EmptyBatched : Base{
void run(int t, int n) {
for (int i=0; i < iterations / BatchSize / n; i++){
vector<BSONObj> objs(BatchSize);
insert(t, objs);
}
}
};
/*
* inserts empty documents into capped collections.
*/
struct EmptyCapped : Base{
void run(int t, int n) {
for (int i=0; i < iterations / n; i++){
insert(t, BSONObj());
}
}
void reset(){
clearDB();
for (int t=0; t<max_threads; t++){
_conn[t].createCollection(ns[t], 32 * 1024, true);
if (!multi_db)
return;
}
}
};
/*
* inserts documents just containing the field '_id' as an ObjectId.
*/
struct JustID : Base{
void run(int t, int n) {
for (int i=0; i < iterations / n; i++){
BSONObjBuilder b;
b << GENOID;
insert(t, b.obj());
}
}
};
/*
* inserts documents just containing the field '_id' as an incrementing integer.
*/
struct IntID : Base{
void run(int t, int n) {
int base = t * (iterations/n);
for (int i=0; i < iterations / n; i++){
insert(t, BSON("_id" << base + i));
}
}
};
/*
* upserts documents just containing the field '_id' as an incrementing integer.
*/
struct IntIDUpsert : Base{
void run(int t, int n) {
int base = t * (iterations/n);
for (int i=0; i < iterations / n; i++){
update(t, BSON("_id" << base + i), BSONObj(), true);
}
}
};
/*
* inserts documents just containing the field 'x' as an incrementing integer.
*/
struct JustNum : Base{
void run(int t, int n) {
int base = t * (iterations/n);
for (int i=0; i < iterations / n; i++){
insert(t, BSON("x" << base + i));
}
}
};
/*
* inserts documents just containing the field 'x' as an incrementing integer.
* An index on 'x' is created before the run.
*/
struct JustNumIndexedBefore : Base{
void run(int t, int n) {
ensureIndex(t, BSON("x" << 1));
int base = t * (iterations/n);
for (int i=0; i < iterations / n; i++){
insert(t, BSON("x" << base + i));
}
}
};
/*
* inserts documents just containing the field 'x' as an incrementing integer.
* An index on 'x' is created after the run.
*/
struct JustNumIndexedAfter : Base{
void run(int t, int n) {
int base = t * (iterations/n);
for (int i=0; i < iterations / n; i++){
insert(t, BSON("x" << base + i));
}
ensureIndex(t, BSON("x" << 1));
}
};
/*
* inserts documents containing the field '_id' as an ObjectId and the field 'x' as an incrementing integer.
*/
struct NumAndID : Base{
void run(int t, int n) {
int base = t * (iterations/n);
for (int i=0; i < iterations / n; i++){
BSONObjBuilder b;
b << GENOID;
b << "x" << base+i;
insert(t, b.obj());
}
}
};
}
namespace Update{
struct Base{
void reset(){ clearDB(); }
};
/*
* Upserts 100 distinct documents based on an incrementing integer id.
* For each document the '$inc' operator is called multiple times to increment the field 'count'.
*/
struct IncNoIndexUpsert : Base{
void run(int t, int n) {
const int incs = iterations/n/100;
for (int i=0; i<100; i++){
for (int j=0; j<incs; j++){
update(t, BSON("_id" << i), BSON("$inc" << BSON("count" << 1)), 1);
}
}
}
};
/*
* Upserts 100 distincts documents based on an incrementing integer id.
* For each document the '$inc' operator is called multiple times to increment the field 'count'.
* An index on 'count' is created before the run.
*/
struct IncWithIndexUpsert : Base{
void reset(){ clearDB(); ensureIndex(-1, BSON("count" << 1));}
void run(int t, int n) {
const int incs = iterations/n/100;
for (int i=0; i<100; i++){
for (int j=0; j<incs; j++){
update(t, BSON("_id" << i), BSON("$inc" << BSON("count" << 1)), 1);
}
}
}
};
/*
* Inserts 100 documents with an incrementing integer id and a 'count' field.
* For each document an update with the '$inc' operator is called multiple times to increment the field 'count'.
*/
struct IncNoIndex : Base{
void reset(){
clearDB();
for (int i=0; i<100; i++)
insert(-1, BSON("_id" << i << "count" << 0));
}
void run(int t, int n) {
const int incs = iterations/n/100;
for (int i=0; i<100; i++){
for (int j=0; j<incs; j++){
update(t, BSON("_id" << i), BSON("$inc" << BSON("count" << 1)));
}
}
}
};
/*
* Inserts 100 documents with an incrementing integer id and a 'count' field.
* For each document an update with the '$inc' operator is called multiple times to increment the field 'count'.
* An index on 'count' is created before the run.
*/
struct IncWithIndex : Base{
void reset(){
clearDB();
ensureIndex(-1, BSON("count" << 1));
for (int i=0; i<100; i++)
insert(-1, BSON("_id" << i << "count" << 0));
}
void run(int t, int n) {
const int incs = iterations/n/100;
for (int i=0; i<100; i++){
for (int j=0; j<incs; j++){
update(t, BSON("_id" << i), BSON("$inc" << BSON("count" << 1)));
}
}
}
};
/*
* Inserts 100 documents with an incrementing integer id, a field 'i' equals to the id, and a 'count' field.
* For each document an update with the '$inc' operator is called multiple times to increment the field 'count', using a query on 'i'.
* An index on 'i' is created before the run.
*/
struct IncNoIndex_QueryOnSecondary : Base{
void reset(){
clearDB();
ensureIndex(-1, BSON("i" << 1));
for (int i=0; i<100; i++)
insert(-1, BSON("_id" << i << "i" << i << "count" << 0));
}
void run(int t, int n) {
const int incs = iterations/n/100;
for (int i=0; i<100; i++){
for (int j=0; j<incs; j++){
update(t, BSON("i" << i), BSON("$inc" << BSON("count" << 1)));
}
}
}
};
/*
* Inserts 100 documents with an incrementing integer id, a field 'i' equals to the id, and a 'count' field.
* For each document an update with the '$inc' operator is called multiple times to increment the field 'count', using a query on 'i'.
* Indexes on 'i' and 'count' are created before the run.
*/
struct IncWithIndex_QueryOnSecondary : Base{
void reset(){
clearDB();
ensureIndex(-1, BSON("count" << 1));
ensureIndex(-1, BSON("i" << 1));
for (int i=0; i<100; i++)
insert(-1, BSON("_id" << i << "i" << i << "count" << 0));
}
void run(int t, int n) {
const int incs = iterations/n/100;
for (int i=0; i<100; i++){
for (int j=0; j<incs; j++){
update(t, BSON("i" << i), BSON("$inc" << BSON("count" << 1)));
}
}
}
};
}
namespace Queries{
/*
* Does one query using an empty pattern, then iterates over results.
* The documents are inserted as empty objects.
*/
struct Empty{
void reset() {
clearDB();
for (int i=0; i < iterations; i++){
insert(-1, BSONObj());
}
getLastError();
}
void run(int t, int n){
int chunk = iterations / n;
auto_ptr<DBClientCursor> cursor = query(t, BSONObj(), chunk, chunk*t);
cursor->itcount();
}
};
/*
* Does a total of 100 queries (across threads) using a match on a nonexistent field, triggering table scans.
* The documents are inserted as empty objects.
*/
struct HundredTableScans{
void reset() {
clearDB();
for (int i=0; i < iterations; i++){
insert(-1, BSONObj());
}
getLastError();
}
void run(int t, int n){
for (int i=0; i < 100/n; i++){
findOne(t, BSON("does_not_exist" << i));
}
}
};
/*
* Does one query using an empty pattern, then iterates over results.
* The documents are inserted with an incrementing integer id.
*/
struct IntID{
void reset() {
clearDB();
for (int i=0; i < iterations; i++){
insert(-1, BSON("_id" << i));
}
getLastError();
}
void run(int t, int n){
int chunk = iterations / n;
auto_ptr<DBClientCursor> cursor = query(t, BSONObj(), chunk, chunk*t);
cursor->itcount();
}
};
/*
* Does one query using a range on the id, then iterates over results.
* The documents are inserted with an incrementing integer id.
*/
struct IntIDRange{
void reset() {
clearDB();
for (int i=0; i < iterations; i++){
insert(-1, BSON("_id" << i));
}
getLastError();
}
void run(int t, int n){
int chunk = iterations / n;
auto_ptr<DBClientCursor> cursor = query(t, BSON("_id" << GTE << chunk*t << LT << chunk*(t+1)));
cursor->itcount();
}
};
/*
* Issues findOne queries with a match on id.
* The documents are inserted with an incrementing integer id.
*/
struct IntIDFindOne{
void reset() {
clearDB();
for (int i=0; i < iterations; i++){
insert(-1, BSON("_id" << i));
}
getLastError();
}
void run(int t, int n){
int base = t * (iterations/n);
for (int i=0; i < iterations / n; i++){
findOne(t, BSON("_id" << base + i));
}
}
};
/*
* Does one query using an empty pattern, then iterates over results.
* The documents are inserted with an incrementing integer field 'x' that is indexed.
*/
struct IntNonID{
void reset() {
clearDB();
ensureIndex(-1, BSON("x" << 1));
for (int i=0; i < iterations; i++){
insert(-1, BSON("x" << i));
}
getLastError();
}
void run(int t, int n){
int chunk = iterations / n;
auto_ptr<DBClientCursor> cursor = query(t, BSONObj(), chunk, chunk*t);
cursor->itcount();
}
};
/*
* Does one query using a range on field 'x', then iterates over results.
* The documents are inserted with an incrementing integer field 'x' that is indexed.
*/
struct IntNonIDRange{
void reset() {
clearDB();
ensureIndex(-1, BSON("x" << 1));
for (int i=0; i < iterations; i++){
insert(-1, BSON("x" << i));
}
getLastError();
}
void run(int t, int n){
int chunk = iterations / n;
auto_ptr<DBClientCursor> cursor = query(t, BSON("x" << GTE << chunk*t << LT << chunk*(t+1)));
cursor->itcount();
}
};
/*
* Issues findOne queries with a match on 'x' field.
* The documents are inserted with an incrementing integer field 'x' that is indexed.
*/
struct IntNonIDFindOne{
void reset() {
clearDB();
ensureIndex(-1, BSON("x" << 1));
for (int i=0; i < iterations; i++){
insert(-1, BSON("x" << i));
}
getLastError();
}
void run(int t, int n){
int base = t * (iterations/n);
for (int i=0; i < iterations / n; i++){
findOne(t, BSON("x" << base + i));
}
}
};
/*
* Issues findOne queries with a left-rooted regular expression on the 'x' field.
* The documents are inserted with an incrementing integer field 'x' that is converted to a string and indexed.
*/
struct RegexPrefixFindOne{
RegexPrefixFindOne(){
for (int i=0; i<100; i++)
nums[i] = "^" + BSONObjBuilder::numStr(i+1);
}
void reset() {
clearDB();
ensureIndex(-1, BSON("x" << 1));
for (int i=0; i < iterations; i++){
insert(-1, BSON("x" << BSONObjBuilder::numStr(i)));
}
getLastError();
}
void run(int t, int n){
for (int i=0; i < iterations / n / 100; i++){
for (int j=0; j<100; j++){
BSONObjBuilder b;
b.appendRegex("x", nums[j]);
findOne(t, b.obj());
}
}
}
string nums[100];
};
/*
* Issues findOne queries with a match on 'x' and 'y' field.
* The documents are inserted with an incrementing integer field 'x' and decrementing field 'y' that are indexed.
*/
struct TwoIntsBothGood{
void reset() {
clearDB();
ensureIndex(-1, BSON("x" << 1));
ensureIndex(-1, BSON("y" << 1));
for (int i=0; i < iterations; i++){
insert(-1, BSON("x" << i << "y" << (iterations-i)));
}
getLastError();
}
void run(int t, int n){
int base = t * (iterations/n);
for (int i=0; i < iterations / n; i++){
findOne(t, BSON("x" << base + i << "y" << (iterations-(base+i))));
}
}
};
/*
* Issues findOne queries with a match on 'x' and 'y' field.
* The documents are inserted with an incrementing integer field 'x' and a field 'y' using modulo (low cardinality), that are indexed.
*/
struct TwoIntsFirstGood{
void reset() {
clearDB();
ensureIndex(-1, BSON("x" << 1));
ensureIndex(-1, BSON("y" << 1));
for (int i=0; i < iterations; i++){
insert(-1, BSON("x" << i << "y" << (i%13)));
}
getLastError();
}
void run(int t, int n){
int base = t * (iterations/n);
for (int i=0; i < iterations / n; i++){
findOne(t, BSON("x" << base + i << "y" << ((base+i)%13)));
}
}
};
/*
* Issues findOne queries with a match on 'x' and 'y' field.
* The documents are inserted with a field 'x' using modulo (low cardinality) and an incrementing integer field 'y', that are indexed.
*/
struct TwoIntsSecondGood{
void reset() {
clearDB();
ensureIndex(-1, BSON("x" << 1));
ensureIndex(-1, BSON("y" << 1));
for (int i=0; i < iterations; i++){
insert(-1, BSON("x" << (i%13) << "y" << i));
}
getLastError();
}
void run(int t, int n){
int base = t * (iterations/n);
for (int i=0; i < iterations / n; i++){
findOne(t, BSON("x" << ((base+i)%13) << "y" << base+i));
}
}
};
/*
* Issues findOne queries with a match on 'x' and 'y' field.
* The documents are inserted with fields 'x' and 'y' both using modulos (low cardinality)
*/
struct TwoIntsBothBad{
void reset() {
clearDB();
ensureIndex(-1, BSON("x" << 1));
ensureIndex(-1, BSON("y" << 1));
for (int i=0; i < iterations; i++){
insert(-1, BSON("x" << (i%503) << "y" << (i%509))); // both are prime
}
getLastError();
}
void run(int t, int n){
int base = t * (iterations/n);
for (int i=0; i < iterations / n; i++){
findOne(t, BSON("x" << ((base+i)%503) << "y" << ((base+i)%509)));
}
}
};
}
namespace{
struct TheTestSuite : TestSuite{
TheTestSuite(){
//add< Overhead::DoNothing >();
add< Insert::Empty >();
add< Insert::EmptyBatched<2> >();
add< Insert::EmptyBatched<10> >();
//add< Insert::EmptyBatched<100> >();
//add< Insert::EmptyBatched<1000> >();
//add< Insert::EmptyCapped >();
//add< Insert::JustID >();
add< Insert::IntID >();
add< Insert::IntIDUpsert >();
//add< Insert::JustNum >();
add< Insert::JustNumIndexedBefore >();
add< Insert::JustNumIndexedAfter >();
//add< Insert::NumAndID >();
add< Update::IncNoIndexUpsert >();
add< Update::IncWithIndexUpsert >();
add< Update::IncNoIndex >();
add< Update::IncWithIndex >();
add< Update::IncNoIndex_QueryOnSecondary >();
add< Update::IncWithIndex_QueryOnSecondary >();
//add< Queries::Empty >();
add< Queries::HundredTableScans >();
//add< Queries::IntID >();
add< Queries::IntIDRange >();
add< Queries::IntIDFindOne >();
//add< Queries::IntNonID >();
add< Queries::IntNonIDRange >();
add< Queries::IntNonIDFindOne >();
//add< Queries::RegexPrefixFindOne >();
//add< Queries::TwoIntsBothBad >();
//add< Queries::TwoIntsBothGood >();
//add< Queries::TwoIntsFirstGood >();
//add< Queries::TwoIntsSecondGood >();
}
} theTestSuite;
}
int main(int argc, const char **argv){
if (argc < 3){
cout << argv[0] << " [port] [iterations] [multidb (1 or 0)]" << endl;
return 1;
}
for (int i=0; i < max_threads; i++){
ns[i] = _db + BSONObjBuilder::numStr(i) + '.' + _coll;
string errmsg;
if ( ! _conn[i].connect( string( "127.0.0.1:" ) + argv[1], errmsg ) ) {
cout << "couldn't connect : " << errmsg << endl;
return 1;
}
}
iterations = atoi(argv[2]);
if (argc > 3)
multi_db = (argv[3][0] == '1');
theTestSuite.run();
return 0;
}