
https://db-benchmarks.com มีจุดมุ่งหมายที่จะสร้างฐานข้อมูลและเครื่องมือค้นหามาตรฐาน:
⚖ ยุติธรรมและโปร่งใส - ควรมีความชัดเจนภายใต้เงื่อนไขนี้หรือว่าฐานข้อมูล / เครื่องมือค้นหานั้นให้สิ่งนี้หรือประสิทธิภาพนั้น
คุณภาพสูง - การควบคุมค่าสัมประสิทธิ์การเปลี่ยนแปลงช่วยให้การผลิตผลลัพธ์ที่ยังคงเหมือนเดิมหากคุณเรียกใช้แบบสอบถามวันนี้พรุ่งนี้หรือสัปดาห์หน้า
- ทำซ้ำได้ง่าย - ทุกคนสามารถทำซ้ำการทดสอบใด ๆ ด้วยฮาร์ดแวร์ของตัวเอง
เข้าใจง่าย - แผนภูมินั้นง่ายมาก
➕ ขยายได้ - สถาปัตยกรรมที่สามารถทำได้ช่วยเพิ่มฐานข้อมูลเพิ่มเติมเพื่อทดสอบ
และเก็บ โอเพนซอร์สทั้งหมด 100% ไว้!
ที่เก็บนี้ให้กรอบการทดสอบซึ่งทำงานได้
เกณฑ์มาตรฐานฐานข้อมูลจำนวนมากไม่มีวัตถุประสงค์ คนอื่นไม่เพียงพอเพื่อให้แน่ใจว่าผลลัพธ์ถูกต้องและเสถียรภาพซึ่งในบางกรณีทำลายความคิดทั้งหมดของมาตรฐาน ตัวอย่างบางส่วน:
https://imply.io/blog/druid-nails-cost-efficiation-challenge-against-clickhouse-and-rockset/:
เราต้องการทำเบนช์มาร์กบนฮาร์ดแวร์เดียวกัน M5.8xlarge แต่การกำหนดค่าล่วงหน้าเพียงอย่างเดียวที่เรามีสำหรับ M5.8xlarge คือ M5D.8xlarge ...
ข่าวร้าย Guys: เมื่อคุณเรียกใช้เกณฑ์มาตรฐานบนฮาร์ดแวร์ที่แตกต่างกันอย่างน้อยที่สุดคุณก็ไม่สามารถพูดได้ว่ามีบางอย่างคือ "106.76%" และ "103.13%" ของอย่างอื่น แม้ว่าคุณจะทดสอบบนเซิร์ฟเวอร์โลหะเปลือยเดียวกัน แต่ก็ค่อนข้างยากที่จะได้ค่าสัมประสิทธิ์การเปลี่ยนแปลงที่ต่ำกว่า 5% ความแตกต่าง 3% สำหรับเซิร์ฟเวอร์ที่แตกต่างกันสามารถละเว้นได้มากที่สุด เมื่อพิจารณาจากทั้งหมดนั้นจะทำให้แน่ใจได้ว่าข้อสรุปสุดท้ายเป็นจริงได้อย่างไร?
https://tech.marksblogg.com/benchmarks.html
มาร์คทำได้ดีมากในการทดสอบแท็กซี่บนฐานข้อมูลและเครื่องมือค้นหาที่แตกต่างกันมากมาย แต่เนื่องจากการทดสอบนั้นเกิดขึ้นกับฮาร์ดแวร์ที่แตกต่างกันตัวเลขในตารางผลลัพธ์จึงไม่สามารถเทียบเคียงได้ คุณต้องจำไว้เสมอเมื่อประเมินผลลัพธ์ในตาราง
https://clickhouse.com/benchmark/dbms/
เมื่อคุณเรียกใช้การสืบค้นแต่ละครั้งเพียง 3 ครั้งคุณจะได้รับค่าสัมประสิทธิ์การเปลี่ยนแปลงที่สูงมากสำหรับแต่ละรายการ ซึ่งหมายความว่าถ้าคุณทำการทดสอบในนาทีต่อมาคุณอาจได้รับการเปลี่ยนแปลง 20% และเราทำซ้ำการทดสอบด้วยฮาร์ดแวร์ของตัวเองได้อย่างไร น่าเสียดายที่ฉันไม่พบว่าจะทำอย่างไร
ความเชื่อของเราคือมาตรฐานฐานข้อมูลที่เป็นธรรมควรปฏิบัติตามหลักการสำคัญบางประการ:
✅ทดสอบฐานข้อมูลที่แตกต่างกันในฮาร์ดแวร์เดียวกัน
มิฉะนั้นคุณควรรับทราบข้อผิดพลาดเมื่อมีความแตกต่างเล็กน้อย
✅ทดสอบด้วยแคชระบบปฏิบัติการเต็มรูปแบบก่อนการทดสอบแต่ละครั้ง
มิฉะนั้นคุณไม่สามารถทดสอบข้อความค้นหาเย็นได้
✅ฐานข้อมูลที่กำลังทดสอบควรมีแคชภายในทั้งหมดปิดใช้งาน
มิฉะนั้นคุณจะวัดประสิทธิภาพของแคช
✅ดีที่สุดถ้าคุณวัดการวิ่งเย็นด้วย เป็นสิ่งสำคัญอย่างยิ่งสำหรับการสอบถามการวิเคราะห์ที่อาจมีการสอบถามความเย็นบ่อยครั้ง
มิฉะนั้นคุณจะซ่อนวิธีการที่ฐานข้อมูลสามารถจัดการ I/O ได้อย่างสมบูรณ์
✅ไม่มีสิ่งอื่นใดที่ควรทำงานในระหว่างการทดสอบ
มิฉะนั้นผลการทดสอบของคุณอาจไม่เสถียรมาก
✅คุณต้องรีสตาร์ทฐานข้อมูลก่อนแต่ละแบบสอบถาม
มิฉะนั้นการสืบค้นก่อนหน้านี้ยังคงส่งผลกระทบต่อเวลาตอบสนองของแบบสอบถามปัจจุบันแม้จะล้างแคชภายใน
✅คุณต้องรอจนกว่าฐานข้อมูลจะอุ่นขึ้นอย่างสมบูรณ์หลังจากเริ่มต้น
มิฉะนั้นคุณอาจจบลงด้วยการแข่งขันกับกระบวนการอุ่นเครื่องของฐานข้อมูลสำหรับ I/O ซึ่งอาจทำให้ผลการทดสอบของคุณเสียอย่างรุนแรง
✅ดีที่สุดถ้าคุณให้ค่าสัมประสิทธิ์การเปลี่ยนแปลงดังนั้นทุกคนจึงเข้าใจว่าผลลัพธ์ของคุณมีเสถียรภาพเพียงใดและตรวจสอบให้แน่ใจว่าตัวเองต่ำพอ
ค่าสัมประสิทธิ์การเปลี่ยนแปลงเป็นตัวชี้วัดที่ดีมากซึ่งแสดงให้เห็นว่าผลการทดสอบของคุณมีความเสถียรเพียงใด หากสูงกว่า N% คุณไม่สามารถพูดได้ว่าฐานข้อมูลหนึ่งนั้นเร็วกว่าอีกฐานข้อมูล
✅ดีที่สุดถ้าคุณทดสอบความถี่ CPU คงที่
มิฉะนั้นหากคุณใช้ผู้ว่าการซีพียู "ตามความต้องการ" (ซึ่งปกติเป็นค่าเริ่มต้น) มันสามารถเปลี่ยนเวลาตอบสนอง 500ms ของคุณเป็น 1,000+ ms ได้อย่างง่ายดาย
✅ดีที่สุดถ้าคุณทดสอบ SSD/NVME มากกว่า HDD
มิฉะนั้นขึ้นอยู่กับว่าไฟล์ของคุณอยู่ที่ HDD คุณสามารถรับประสิทธิภาพ I/O ที่ต่ำกว่า 2 เท่า (เราทดสอบ) ซึ่งสามารถทำให้การสืบค้นเย็นของคุณผิดพลาดอย่างน้อย
เฟรมเวิร์กทดสอบที่ใช้บนแบ็กเอนด์ของ https://db-benchmarks.com เป็นโอเพนซอร์สเต็มรูปแบบ (ใบอนุญาต AGPLV3) และสามารถพบได้ที่ https://github.com/db-benchmarks/db-benchmarks นี่คือสิ่งที่ทำ:
--limited )--test บันทึกผลการทดสอบไปยังไฟล์--save บันทึกผลการทดสอบจากไฟล์ไปยังฐานข้อมูลระยะไกล (ทั้งสองที่ได้รับการทดสอบ)select count(*) และ select * limit 1 เพื่อให้แน่ใจว่าคอลเลกชันข้อมูลมีความคล้ายคลึงกันในฐานข้อมูลที่แตกต่างกันcpuset และ mem )ก่อนที่คุณจะปรับใช้กรอบการทดสอบตรวจสอบให้แน่ใจว่าคุณมีสิ่งต่อไปนี้:
PHP 8 และ:curlmysqlidockerdocker-composesensors ในการควบคุมอุณหภูมิ CPU เพื่อป้องกันการควบคุมปริมาณdstatcgroups v2ในการติดตั้ง:
git clone [email protected]:db-benchmarks/db-benchmarks.git
cd db-benchmarks.env.example to .envmem และ cpuset ใน .env ที่มีค่าเริ่มต้นของหน่วยความจำ (ใน megabytes) และ CPU เฟรมเวิร์กการทดสอบสามารถใช้สำหรับงานทุติยภูมิ (การโหลดข้อมูลรับข้อมูลเกี่ยวกับฐานข้อมูล)ES_JAVA_OPTS สำหรับการทดสอบของคุณ โดยปกติจะมีขนาดของหน่วยความจำที่จัดสรรสำหรับเครื่อง Docker ก่อนอื่นคุณต้องเตรียมการทดสอบ:
ไปที่ไดเรกทอรีการทดสอบเฉพาะ (การทดสอบทั้งหมดจะต้องอยู่ในไดเรกทอรี ./tests tests) ตัวอย่างเช่น "hn_small":
cd tests/hn_smallเรียกใช้สคริปต์ init:
./initสิ่งนี้จะ:
จากนั้นเรียกใช้ ../../test (อยู่ในโฟลเดอร์ของ Project Root) เพื่อดูตัวเลือก:
To run a particular test with specified engines, memory constraints and number of attempts and save the results locally:
/perf/test_engines/test
--test=test_name
--engines={engine1:type,...,engineN}
--memory=1024,2048,...,1048576 - memory constraints to test with, MB
[--times = N] - max number of times to test each query, 100 by default
[--dir = path] - if path is omitted - save to directory ' results ' in the same dir where this file is located
[--probe_timeout = N] - how long to wait for an initial connection, 30 seconds by default
[--start_timeout = N] - how long to wait for a db/engine to start, 120 seconds by default
[--warmup_timeout = N] - how long to wait for a db/engine to warmup after start, 300 seconds by default
[--query_timeout = N] - max time a query can run, 900 seconds by default
[--info_timeout = N] - how long to wait for getting info from a db/engine
[--limited] - emulate one physical CPU core
[--queries = /path/to/queries] - queries to test, ./tests/ < test name > /test_queries by default
To save to db all results it finds by path
/perf/test_engines/test
--save=path/to/file/or/dir, all files in the dir recursively will be saved
--host=HOSTNAME
--port=PORT
--username=USERNAME
--password=PASSWORD
--rm - remove after successful saving to database
--skip_calm - avoid waiting until discs become calm
----------------------
Environment variables:
All the options can be specified as environment variables, but you can ' t use the same option as an environment variables and as a command line argument at the same time.และเรียกใช้การทดสอบ:
../../test --test=hn_small --engines=elasticsearch,clickhouse --memory=16384 หากคุณเรียกใช้การทดสอบในโหมดท้องถิ่น (การพัฒนา) และไม่สนใจเกี่ยวกับการทดสอบความไม่ถูกต้องคุณสามารถหลีกเลี่ยงการตรวจสอบแผ่นดิสก์และซีพียูโดยการตั้งค่าพารามิเตอร์ --skip_inaccuracy
../../test --test=hn_small --engines=elasticsearch,clickhouse --memory=16384 --skip_inaccuracy ตอนนี้คุณมีผลการทดสอบใน ./results/ results/ (ในรูทของที่เก็บ) ตัวอย่างเช่น:
# ls results/
220401_054753ตอนนี้คุณสามารถอัปโหลดผลลัพธ์ไปยังฐานข้อมูลสำหรับการสร้างภาพเพิ่มเติม เครื่องมือสร้างภาพซึ่งใช้ใน https://db-benchmarks.com/ ยังเป็นโอเพนซอร์สและสามารถพบได้ที่ https://github.com/db-benchmarks/ui
นี่คือวิธีที่คุณสามารถบันทึกผลลัพธ์:
username=login password=pass host=db.db-benchmarks.com port=443 save=./results ./testหรือ
./test --username=login --password=pass --host=db.db-benchmarks.com --port=443 --save=./results
เรากระตือรือร้นที่จะเห็นผลการทดสอบของคุณ หากคุณเชื่อว่าควรเพิ่มลงใน https://db-benchmarks.com โปรดส่งคำขอดึงผลลัพธ์ของคุณไปยังที่เก็บนี้
โปรดจำไว้ในใจ:
./results resultsเราจะ:
.
|-core <- Core directory, contains base files required for tests.
| |-engine.php <- Abstract class Engine. Manages test execution, result saving, and parsing of test attributes.
| |-helpers.php <- Helper file with logging functions, attribute parsing, exit functions, etc.
|-misc <- Miscellaneous directory, intended for storing files useful during the initialization step.
| |-func.sh <- Meilisearch initialization helper script.
|-plugins <- Plugins directory: if you want to extend the framework by adding another database or search engine for testing, place it here.
| |-elasticsearch.php <- Elasticsearch plugin.
| |-manticoresearch.php <- Manticore Search plugin.
| |-clickhouse.php <- ClickHouse plugin.
| |-mysql.php <- MySQL plugin.
| |-meilisearch.php <- Meilisearch plugin.
| |-mysql_percona.php <- MySQL (Percona) plugin.
| |-postgres.php <- Postgres plugin.
| |-typesense.php <- Typesense plugin.
|-results <- Test results directory. The results shown on https://db-benchmarks.com/ are found here. You can also use `./test --save` to visualize them locally.
|-tests <- Directory containing test suites.
| |-hn <- Hackernews test suite.
| | |-clickhouse <- Directory for "Hackernews test -> ClickHouse".
| | | |-inflate_hook <- Engine initialization script. Handles data ingestion into the database.
| | | |-post_hook <- Engine verification script. Ensures the correct number of documents have been ingested and verifies data consistency.
| | | |-pre_hook <- Engine pre-check script. Determines if tables need to be rebuilt, starts the engine, and ensures availability.
| | |-data <- Prepared data collection for the tests.
| | |-elasticsearch <- Directory for "Hackernews test -> Elasticsearch".
| | | |-logstash_tuned <- Logstash configuration directory for the "tuned" type.
| | | | |-logstash.conf
| | | | |-template.json
| | | |-elasticsearch_tuned.yml
| | | |-inflate_hook <- Engine initialization script for data ingestion.
| | | |-post_hook <- Verifies document count and data consistency.
| | | |-pre_hook <- Pre-check script for table rebuilding and engine initialization.
| | |-manticoresearch <- Directory for testing Manticore Search in the Hackernews test suite.
| | | |-generate_manticore_config.php <- Script for dynamically generating Manticore Search configuration.
| | | |-inflate_hook <- Data ingestion script.
| | | |-post_hook <- Verifies document count and consistency.
| | | |-pre_hook <- Pre-check for table rebuilds and engine availability.
| | |-meilisearch <- Directory for "Hackernews test -> Meilisearch".
| | | |-inflate_hook <- Data ingestion script.
| | | |-post_hook <- Ensures correct document count and data consistency.
| | | |-pre_hook <- Pre-check for table rebuilds and engine start.
| | |-mysql <- Directory for "Hackernews test -> MySQL".
| | | |-inflate_hook <- Data ingestion script.
| | | |-post_hook <- Ensures document count and consistency.
| | | |-pre_hook <- Pre-check for table rebuilds and engine start.
| | |-postgres <- Directory for "Hackernews test -> Postgres".
| | | |-inflate_hook <- Data ingestion script.
| | | |-post_hook <- Verifies document count and data consistency.
| | | |-pre_hook <- Pre-check for table rebuilds and engine availability.
| | |-prepare_csv <- Prepares the data collection, handled in `./tests/hn/init`.
| | |-description <- Test description, included in test results and used during result visualization.
| | |-init <- Main initialization script for the test.
| | |-test_info_queries <- Contains queries to retrieve information about the data collection.
| | |-test_queries <- Contains all test queries for the current test.
| |-taxi <- Taxi rides test suite, with a similar structure.
| |-hn_small <- Test for a smaller, non-multiplied Hackernews dataset, similar structure.
| |-logs10m <- Test for Nginx logs, similar structure.
|-.env.example <- Example environment file. Update the "mem" and "cpuset" values as needed.
|-LICENSE <- License file.
|-NOTICE <- Notice file.
|-README.md <- You're reading this file.
|-docker-compose.yml <- Docker Compose configuration for starting and stopping databases and search engines.
|-important_tests.sh
|-init <- Initialization script. Handles data ingestion and tracks the time taken.
|-logo.svg <- Logo file.
|-test <- The executable file to run and save test results.
test=logs10m cpuset= " 0,1 " mem=32768 suffix=_tuned docker-compose up elasticsearchจะ:
suffix=_tuned : แผนที่ ./tests/logs10m/es/data/idx_tuned เป็นไดเรกทอรีข้อมูลmem=32768 จำกัด RAM เป็น 32GB หากไม่ได้ระบุค่าเริ่มต้นจะใช้จากไฟล์ .envcpuset="0,1" : คอนเทนเนอร์ของ Elasticsearch จะทำงานเฉพาะใน CPU Cores 0 และ 1 (ซึ่งอาจเป็น CPU ทางกายภาพทั้งหมดแรก) เพื่อหยุด - เพียงแค่ CTRL-C
ต้องการมีส่วนร่วมในโครงการหรือไม่? นี่คือวิธีที่คุณสามารถมีส่วนร่วม:
ทั้งหมดนี้กำลังรอการบริจาคของคุณ!