1c4b340fcSDamien Katz#! /bin/sh -e
2c4b340fcSDamien Katz
3ccadbd16SFilipe David MananaTOTAL_DOCS=100000
4ccadbd16SFilipe David MananaBATCH_SIZE=500
5ccadbd16SFilipe David MananaCONCURRENCY=10
64c0a88e7SFilipe David MananaDELAYED_COMMITS=false
74c0a88e7SFilipe David MananaOPTIMISTIC=false
8ccadbd16SFilipe David MananaDB=load_test
9ccadbd16SFilipe David MananaHOST=localhost
10ccadbd16SFilipe David MananaPORT=5984
11ccadbd16SFilipe David Manana
124c0a88e7SFilipe David MananaURL="http://$HOST:$PORT/_generate_load?total=$TOTAL_DOCS&db=$DB&concurrency=$CONCURRENCY&batch=$BATCH_SIZE&delayed_commits=$DELAYED_COMMITS&optimistic=$OPTIMISTIC"
13ccadbd16SFilipe David Manana
1436292fe5SFilipe David MananaDOC_ATTS='{"_attachments":{"foo.txt": {"content_type":"application/binary","data":"MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx\r\nMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx"}}}'
1536292fe5SFilipe David Manana
1636292fe5SFilipe David MananaDOC_1K='{
1736292fe5SFilipe David Manana    "category": "wizard",
1836292fe5SFilipe David Manana    "type": "dwarf",
1936292fe5SFilipe David Manana    "level": 13,
2036292fe5SFilipe David Manana    "ratio": 1.8,
2136292fe5SFilipe David Manana    "data1": "31d6aOtoEqmPOZH9wWnEP56LHRYq5LMkSbIzTzQk",
2236292fe5SFilipe David Manana    "data2": "jQj9YEKLwLsvQnZdfp1Em1myn2cFtF6mp41UTHMSaz6ucLs0NN",
2336292fe5SFilipe David Manana    "data3": "QxVx4VYQJ4kXamEuaNhZYMfJ9CRCGPVivox",
2436292fe5SFilipe David Manana    "integers": [
2536292fe5SFilipe David Manana        59740, 77318, 85730, 22711, 83219, 9113, 90262,
2636292fe5SFilipe David Manana        10553, 69055, 62303, 67322, 63930, 20929, 77409
2736292fe5SFilipe David Manana    ],
2836292fe5SFilipe David Manana    "nested": {
2936292fe5SFilipe David Manana        "dict": {
3036292fe5SFilipe David Manana            "kZ3S3lrT": 64,
3136292fe5SFilipe David Manana            "0QSA4KIy": 3983,
3236292fe5SFilipe David Manana            "ViMej46m": 15688,
3336292fe5SFilipe David Manana            "PCe8Fk8e": 7392,
3436292fe5SFilipe David Manana            "9MbPSlq8": 129,
3536292fe5SFilipe David Manana            "FpLOJP3C": 11758,
3636292fe5SFilipe David Manana            "lETmhfOL": 66809
3736292fe5SFilipe David Manana        },
3836292fe5SFilipe David Manana        "string1": "UDurtwKrMJMB0r1TjCOGukB",
3936292fe5SFilipe David Manana        "string2": "EBVZ8ETnsL71",
4036292fe5SFilipe David Manana        "string3": "iKyrxEp6teTiazK6kH",
4136292fe5SFilipe David Manana        "values": [
4236292fe5SFilipe David Manana            58277, 88822, 77135, 3475, 40849, 77577,
4336292fe5SFilipe David Manana            51913, 24551, 30071, 52972
4436292fe5SFilipe David Manana        ],
4536292fe5SFilipe David Manana        "coords": [
4636292fe5SFilipe David Manana            {"x": 93424.85000000001, "y": 189872.72},
4736292fe5SFilipe David Manana            {"x": 23527.94, "y": 155983.89},
4836292fe5SFilipe David Manana            {"x": 2496.26, "y": 169499.21},
4936292fe5SFilipe David Manana            {"x": 5681.62, "y": 40945.77},
5036292fe5SFilipe David Manana            {"x": 67300.38, "y": 138137.1}
5136292fe5SFilipe David Manana        ]
5236292fe5SFilipe David Manana    }
5336292fe5SFilipe David Manana}'
5436292fe5SFilipe David Manana
5536292fe5SFilipe David MananaDOC_2K='{
5636292fe5SFilipe David Manana    "data0": "9EVqHm5ARqcEB5jq21v2g0jVcG9CXB0Abk7uAF4NHYyTzeF3TnHhpZBECD14U2bCJPyBY0JWDr1Tjh8gTB0sWUNjqYiWDxFzlx6S",
5736292fe5SFilipe David Manana    "data5": {
5836292fe5SFilipe David Manana        "integers": [
5936292fe5SFilipe David Manana            756509, 116117, 776378, 275045, 703447, 50156, 685803, 147958, 941747,
6036292fe5SFilipe David Manana            905651, 57367, 530248, 312888, 740951, 988947, 450154
6136292fe5SFilipe David Manana        ],
6236292fe5SFilipe David Manana        "floats": [
6336292fe5SFilipe David Manana            43121609.5543, 99454976.3019, 32945584.756, 18122905.9212, 14590614.6939,
6436292fe5SFilipe David Manana            45292214.2242, 3332166.364, 53784167.729, 25193846.1867, 81456965.477,
6536292fe5SFilipe David Manana            68532032.39, 73820009.7952, 57736110.5717, 37304166.7363, 20054244.864,
6636292fe5SFilipe David Manana            29746392.7397, 86467624.6, 45192685.8793, 44008816.5186, 1861872.8736, 14595859.467,
6736292fe5SFilipe David Manana            87795257.6703, 57768720.8303, 18290154.3126, 45893183.44, 63052200.6225, 69032152.6897,
6836292fe5SFilipe David Manana            3748217.6946, 75449850.474, 37111527.415, 84852536.859, 32906366.487, 27027600.417,
6936292fe5SFilipe David Manana            4758851.9417, 75227407.9214, 76946667.8403, 72518275.9469, 94167085.9588, 75883067.8321,
7036292fe5SFilipe David Manana            27389831.6101, 57987075.5053, 1298995.2674
7136292fe5SFilipe David Manana        ],
7236292fe5SFilipe David Manana        "nested1": {
7336292fe5SFilipe David Manana            "integers": [
7436292fe5SFilipe David Manana                756509, 116117, 776378, 275045, 703447, 50156, 685803, 12345678,
7536292fe5SFilipe David Manana                147958, 941747, 905651, 57367, 530248, 312888, 740951, 988947, 450154
7636292fe5SFilipe David Manana            ],
7736292fe5SFilipe David Manana            "floats": [
7836292fe5SFilipe David Manana                41415831.8949, 24796297.4251, 2819085.3449, 84263963.4848, 74503228.6878, 67925677.403,
7936292fe5SFilipe David Manana                4758851.9417, 75227407.9214, 76946667.8403, 72518275.9469, 94167085.9588, 75883067.8321,
8036292fe5SFilipe David Manana                27389831.6101, 57987075.5053, 1298995.2674, 80858801.2712, 98262252.4656, 51612877.944,
8136292fe5SFilipe David Manana                33397812.7835, 36089655.3049, 50164685.8153, 16852105.5192, 61171929.752, 86376339.7175
8236292fe5SFilipe David Manana            ]
8336292fe5SFilipe David Manana        }
8436292fe5SFilipe David Manana    },
8536292fe5SFilipe David Manana    "more_nested": {
8636292fe5SFilipe David Manana        "nested2": {
8736292fe5SFilipe David Manana            "strings": [
8836292fe5SFilipe David Manana                "jURcBZ0vrJcmf2roZUMzZJQoTsKZDIdj7KhO7itskKvM80jBU9",
8936292fe5SFilipe David Manana                "8jKLmo3N2zYdKyTyfTczfr2x6bPaarorlnTNJ7r8lIkiZyBvrP",
9036292fe5SFilipe David Manana                "jbUeAVOdBSPzYmYhH0sabUHUH39O5e",
9136292fe5SFilipe David Manana                "I8yAQKZsyZhMfpzWjArQU9pQ6PfU6b14q2eWvQjtCUdgAUxFjg",
9236292fe5SFilipe David Manana                "97N8ZmGcxRZO4ZabzRRcY4KVHqxJwQ8qY",
9336292fe5SFilipe David Manana                "0DtY1aWXmUfJENt9rYW9",
9436292fe5SFilipe David Manana                "DtpBUEppPwMnWexi8eIIxlXRO3GUpPgeNFG9ONpWJYvk8xBkVj",
9536292fe5SFilipe David Manana                "YsX8V2xOrTw6LhNIMMhO4F4VXFyXUXFr66L3sTkLWgFA9NZuBV",
9636292fe5SFilipe David Manana                "fKYYthv8iFvaYoFoYZyB"
9736292fe5SFilipe David Manana            ],
9836292fe5SFilipe David Manana            "integers": [
9936292fe5SFilipe David Manana                756509, 116117, 776378, 275045, 703447, 50156, 685803, 147958,
10036292fe5SFilipe David Manana                941747, 905651, 57367, 530248, 312888, 740951, 988947, 450154
10136292fe5SFilipe David Manana            ]
10236292fe5SFilipe David Manana        }
10336292fe5SFilipe David Manana    }
10436292fe5SFilipe David Manana}'
10536292fe5SFilipe David Manana
106ccadbd16SFilipe David Mananacurl -X POST \
107ccadbd16SFilipe David Manana        $URL \
108ccadbd16SFilipe David Manana	-H "Content-Type: application/json" \
10936292fe5SFilipe David Manana	-d "$DOC_2K"
110