regression_build_test.sh 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. #!/usr/bin/env bash
  2. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  3. set -e
  4. NUM=10000000
  5. if [ $# -eq 1 ];then
  6. DATA_DIR=$1
  7. elif [ $# -eq 2 ];then
  8. DATA_DIR=$1
  9. STAT_FILE=$2
  10. fi
  11. # On the production build servers, set data and stat
  12. # files/directories not in /tmp or else the tempdir cleaning
  13. # scripts will make you very unhappy.
  14. DATA_DIR=${DATA_DIR:-$(mktemp -t -d rocksdb_XXXX)}
  15. STAT_FILE=${STAT_FILE:-$(mktemp -t -u rocksdb_test_stats_XXXX)}
  16. function cleanup {
  17. rm -rf $DATA_DIR
  18. rm -f $STAT_FILE.*
  19. }
  20. trap cleanup EXIT
  21. make release
  22. # measure fillseq + fill up the DB for overwrite benchmark
  23. ./db_bench \
  24. --benchmarks=fillseq \
  25. --db=$DATA_DIR \
  26. --use_existing_db=0 \
  27. --bloom_bits=10 \
  28. --num=$NUM \
  29. --writes=$NUM \
  30. --cache_size=6442450944 \
  31. --cache_numshardbits=6 \
  32. --table_cache_numshardbits=4 \
  33. --open_files=55000 \
  34. --statistics=1 \
  35. --histogram=1 \
  36. --disable_wal=1 \
  37. --sync=0 > ${STAT_FILE}.fillseq
  38. # measure overwrite performance
  39. ./db_bench \
  40. --benchmarks=overwrite \
  41. --db=$DATA_DIR \
  42. --use_existing_db=1 \
  43. --bloom_bits=10 \
  44. --num=$NUM \
  45. --writes=$((NUM / 10)) \
  46. --cache_size=6442450944 \
  47. --cache_numshardbits=6 \
  48. --table_cache_numshardbits=4 \
  49. --open_files=55000 \
  50. --statistics=1 \
  51. --histogram=1 \
  52. --disable_wal=1 \
  53. --sync=0 \
  54. --threads=8 > ${STAT_FILE}.overwrite
  55. # fill up the db for readrandom benchmark (1GB total size)
  56. ./db_bench \
  57. --benchmarks=fillseq \
  58. --db=$DATA_DIR \
  59. --use_existing_db=0 \
  60. --bloom_bits=10 \
  61. --num=$NUM \
  62. --writes=$NUM \
  63. --cache_size=6442450944 \
  64. --cache_numshardbits=6 \
  65. --table_cache_numshardbits=4 \
  66. --open_files=55000 \
  67. --statistics=1 \
  68. --histogram=1 \
  69. --disable_wal=1 \
  70. --sync=0 \
  71. --threads=1 > /dev/null
  72. # measure readrandom with 6GB block cache
  73. ./db_bench \
  74. --benchmarks=readrandom \
  75. --db=$DATA_DIR \
  76. --use_existing_db=1 \
  77. --bloom_bits=10 \
  78. --num=$NUM \
  79. --reads=$((NUM / 5)) \
  80. --cache_size=6442450944 \
  81. --cache_numshardbits=6 \
  82. --table_cache_numshardbits=4 \
  83. --open_files=55000 \
  84. --statistics=1 \
  85. --histogram=1 \
  86. --disable_wal=1 \
  87. --sync=0 \
  88. --threads=16 > ${STAT_FILE}.readrandom
  89. # measure readrandom with 6GB block cache and tailing iterator
  90. ./db_bench \
  91. --benchmarks=readrandom \
  92. --db=$DATA_DIR \
  93. --use_existing_db=1 \
  94. --bloom_bits=10 \
  95. --num=$NUM \
  96. --reads=$((NUM / 5)) \
  97. --cache_size=6442450944 \
  98. --cache_numshardbits=6 \
  99. --table_cache_numshardbits=4 \
  100. --open_files=55000 \
  101. --use_tailing_iterator=1 \
  102. --statistics=1 \
  103. --histogram=1 \
  104. --disable_wal=1 \
  105. --sync=0 \
  106. --threads=16 > ${STAT_FILE}.readrandomtailing
  107. # measure readrandom with 100MB block cache
  108. ./db_bench \
  109. --benchmarks=readrandom \
  110. --db=$DATA_DIR \
  111. --use_existing_db=1 \
  112. --bloom_bits=10 \
  113. --num=$NUM \
  114. --reads=$((NUM / 5)) \
  115. --cache_size=104857600 \
  116. --cache_numshardbits=6 \
  117. --table_cache_numshardbits=4 \
  118. --open_files=55000 \
  119. --statistics=1 \
  120. --histogram=1 \
  121. --disable_wal=1 \
  122. --sync=0 \
  123. --threads=16 > ${STAT_FILE}.readrandomsmallblockcache
  124. # measure readrandom with 8k data in memtable
  125. ./db_bench \
  126. --benchmarks=overwrite,readrandom \
  127. --db=$DATA_DIR \
  128. --use_existing_db=1 \
  129. --bloom_bits=10 \
  130. --num=$NUM \
  131. --reads=$((NUM / 5)) \
  132. --writes=512 \
  133. --cache_size=6442450944 \
  134. --cache_numshardbits=6 \
  135. --table_cache_numshardbits=4 \
  136. --write_buffer_size=1000000000 \
  137. --open_files=55000 \
  138. --statistics=1 \
  139. --histogram=1 \
  140. --disable_wal=1 \
  141. --sync=0 \
  142. --threads=16 > ${STAT_FILE}.readrandom_mem_sst
  143. # fill up the db for readrandom benchmark with filluniquerandom (1GB total size)
  144. ./db_bench \
  145. --benchmarks=filluniquerandom \
  146. --db=$DATA_DIR \
  147. --use_existing_db=0 \
  148. --bloom_bits=10 \
  149. --num=$((NUM / 4)) \
  150. --writes=$((NUM / 4)) \
  151. --cache_size=6442450944 \
  152. --cache_numshardbits=6 \
  153. --table_cache_numshardbits=4 \
  154. --open_files=55000 \
  155. --statistics=1 \
  156. --histogram=1 \
  157. --disable_wal=1 \
  158. --sync=0 \
  159. --threads=1 > /dev/null
  160. # dummy test just to compact the data
  161. ./db_bench \
  162. --benchmarks=readrandom \
  163. --db=$DATA_DIR \
  164. --use_existing_db=1 \
  165. --bloom_bits=10 \
  166. --num=$((NUM / 1000)) \
  167. --reads=$((NUM / 1000)) \
  168. --cache_size=6442450944 \
  169. --cache_numshardbits=6 \
  170. --table_cache_numshardbits=4 \
  171. --open_files=55000 \
  172. --statistics=1 \
  173. --histogram=1 \
  174. --disable_wal=1 \
  175. --sync=0 \
  176. --threads=16 > /dev/null
  177. # measure readrandom after load with filluniquerandom with 6GB block cache
  178. ./db_bench \
  179. --benchmarks=readrandom \
  180. --db=$DATA_DIR \
  181. --use_existing_db=1 \
  182. --bloom_bits=10 \
  183. --num=$((NUM / 4)) \
  184. --reads=$((NUM / 4)) \
  185. --cache_size=6442450944 \
  186. --cache_numshardbits=6 \
  187. --table_cache_numshardbits=4 \
  188. --open_files=55000 \
  189. --disable_auto_compactions=1 \
  190. --statistics=1 \
  191. --histogram=1 \
  192. --disable_wal=1 \
  193. --sync=0 \
  194. --threads=16 > ${STAT_FILE}.readrandom_filluniquerandom
  195. # measure readwhilewriting after load with filluniquerandom with 6GB block cache
  196. ./db_bench \
  197. --benchmarks=readwhilewriting \
  198. --db=$DATA_DIR \
  199. --use_existing_db=1 \
  200. --bloom_bits=10 \
  201. --num=$((NUM / 4)) \
  202. --reads=$((NUM / 4)) \
  203. --benchmark_write_rate_limit=$(( 110 * 1024 )) \
  204. --write_buffer_size=100000000 \
  205. --cache_size=6442450944 \
  206. --cache_numshardbits=6 \
  207. --table_cache_numshardbits=4 \
  208. --open_files=55000 \
  209. --statistics=1 \
  210. --histogram=1 \
  211. --disable_wal=1 \
  212. --sync=0 \
  213. --threads=16 > ${STAT_FILE}.readwhilewriting
  214. # measure memtable performance -- none of the data gets flushed to disk
  215. ./db_bench \
  216. --benchmarks=fillrandom,readrandom, \
  217. --db=$DATA_DIR \
  218. --use_existing_db=0 \
  219. --num=$((NUM / 10)) \
  220. --reads=$NUM \
  221. --cache_size=6442450944 \
  222. --cache_numshardbits=6 \
  223. --table_cache_numshardbits=4 \
  224. --write_buffer_size=1000000000 \
  225. --open_files=55000 \
  226. --statistics=1 \
  227. --histogram=1 \
  228. --disable_wal=1 \
  229. --sync=0 \
  230. --value_size=10 \
  231. --threads=16 > ${STAT_FILE}.memtablefillreadrandom
  232. common_in_mem_args="--db=/dev/shm/rocksdb \
  233. --num_levels=6 \
  234. --key_size=20 \
  235. --prefix_size=12 \
  236. --keys_per_prefix=10 \
  237. --value_size=100 \
  238. --compression_type=none \
  239. --compression_ratio=1 \
  240. --write_buffer_size=134217728 \
  241. --max_write_buffer_number=4 \
  242. --level0_file_num_compaction_trigger=8 \
  243. --level0_slowdown_writes_trigger=16 \
  244. --level0_stop_writes_trigger=24 \
  245. --target_file_size_base=134217728 \
  246. --max_bytes_for_level_base=1073741824 \
  247. --disable_wal=0 \
  248. --wal_dir=/dev/shm/rocksdb \
  249. --sync=0 \
  250. --verify_checksum=1 \
  251. --delete_obsolete_files_period_micros=314572800 \
  252. --use_plain_table=1 \
  253. --open_files=-1 \
  254. --mmap_read=1 \
  255. --mmap_write=0 \
  256. --bloom_bits=10 \
  257. --bloom_locality=1 \
  258. --perf_level=0"
  259. # prepare a in-memory DB with 50M keys, total DB size is ~6G
  260. ./db_bench \
  261. $common_in_mem_args \
  262. --statistics=0 \
  263. --max_background_compactions=16 \
  264. --max_background_flushes=16 \
  265. --benchmarks=filluniquerandom \
  266. --use_existing_db=0 \
  267. --num=52428800 \
  268. --threads=1 > /dev/null
  269. # Readwhilewriting
  270. ./db_bench \
  271. $common_in_mem_args \
  272. --statistics=1 \
  273. --max_background_compactions=4 \
  274. --max_background_flushes=0 \
  275. --benchmarks=readwhilewriting\
  276. --use_existing_db=1 \
  277. --duration=600 \
  278. --threads=32 \
  279. --benchmark_write_rate_limit=9502720 > ${STAT_FILE}.readwhilewriting_in_ram
  280. # Seekrandomwhilewriting
  281. ./db_bench \
  282. $common_in_mem_args \
  283. --statistics=1 \
  284. --max_background_compactions=4 \
  285. --max_background_flushes=0 \
  286. --benchmarks=seekrandomwhilewriting \
  287. --use_existing_db=1 \
  288. --use_tailing_iterator=1 \
  289. --duration=600 \
  290. --threads=32 \
  291. --benchmark_write_rate_limit=9502720 > ${STAT_FILE}.seekwhilewriting_in_ram
  292. # measure fillseq with bunch of column families
  293. ./db_bench \
  294. --benchmarks=fillseq \
  295. --num_column_families=500 \
  296. --write_buffer_size=1048576 \
  297. --db=$DATA_DIR \
  298. --use_existing_db=0 \
  299. --num=$NUM \
  300. --writes=$NUM \
  301. --open_files=55000 \
  302. --statistics=1 \
  303. --histogram=1 \
  304. --disable_wal=1 \
  305. --sync=0 > ${STAT_FILE}.fillseq_lots_column_families
  306. # measure overwrite performance with bunch of column families
  307. ./db_bench \
  308. --benchmarks=overwrite \
  309. --num_column_families=500 \
  310. --write_buffer_size=1048576 \
  311. --db=$DATA_DIR \
  312. --use_existing_db=1 \
  313. --num=$NUM \
  314. --writes=$((NUM / 10)) \
  315. --open_files=55000 \
  316. --statistics=1 \
  317. --histogram=1 \
  318. --disable_wal=1 \
  319. --sync=0 \
  320. --threads=8 > ${STAT_FILE}.overwrite_lots_column_families
  321. # send data to ods
  322. function send_to_ods {
  323. key="$1"
  324. value="$2"
  325. if [ -z $JENKINS_HOME ]; then
  326. # running on devbox, just print out the values
  327. echo $1 $2
  328. return
  329. fi
  330. if [ -z "$value" ];then
  331. echo >&2 "ERROR: Key $key doesn't have a value."
  332. return
  333. fi
  334. curl --silent "https://www.facebook.com/intern/agent/ods_set.php?entity=rocksdb_build&key=$key&value=$value" \
  335. --connect-timeout 60
  336. }
  337. function send_benchmark_to_ods {
  338. bench="$1"
  339. bench_key="$2"
  340. file="$3"
  341. QPS=$(grep $bench $file | awk '{print $5}')
  342. P50_MICROS=$(grep $bench $file -A 6 | grep "Percentiles" | awk '{print $3}' )
  343. P75_MICROS=$(grep $bench $file -A 6 | grep "Percentiles" | awk '{print $5}' )
  344. P99_MICROS=$(grep $bench $file -A 6 | grep "Percentiles" | awk '{print $7}' )
  345. send_to_ods rocksdb.build.$bench_key.qps $QPS
  346. send_to_ods rocksdb.build.$bench_key.p50_micros $P50_MICROS
  347. send_to_ods rocksdb.build.$bench_key.p75_micros $P75_MICROS
  348. send_to_ods rocksdb.build.$bench_key.p99_micros $P99_MICROS
  349. }
  350. send_benchmark_to_ods overwrite overwrite $STAT_FILE.overwrite
  351. send_benchmark_to_ods fillseq fillseq $STAT_FILE.fillseq
  352. send_benchmark_to_ods readrandom readrandom $STAT_FILE.readrandom
  353. send_benchmark_to_ods readrandom readrandom_tailing $STAT_FILE.readrandomtailing
  354. send_benchmark_to_ods readrandom readrandom_smallblockcache $STAT_FILE.readrandomsmallblockcache
  355. send_benchmark_to_ods readrandom readrandom_memtable_sst $STAT_FILE.readrandom_mem_sst
  356. send_benchmark_to_ods readrandom readrandom_fillunique_random $STAT_FILE.readrandom_filluniquerandom
  357. send_benchmark_to_ods fillrandom memtablefillrandom $STAT_FILE.memtablefillreadrandom
  358. send_benchmark_to_ods readrandom memtablereadrandom $STAT_FILE.memtablefillreadrandom
  359. send_benchmark_to_ods readwhilewriting readwhilewriting $STAT_FILE.readwhilewriting
  360. send_benchmark_to_ods readwhilewriting readwhilewriting_in_ram ${STAT_FILE}.readwhilewriting_in_ram
  361. send_benchmark_to_ods seekrandomwhilewriting seekwhilewriting_in_ram ${STAT_FILE}.seekwhilewriting_in_ram
  362. send_benchmark_to_ods fillseq fillseq_lots_column_families ${STAT_FILE}.fillseq_lots_column_families
  363. send_benchmark_to_ods overwrite overwrite_lots_column_families ${STAT_FILE}.overwrite_lots_column_families