简体   繁体   English

用数据填充数据库的最有效方法?

[英]Most effective way to populate database with data?

Hi I need to run some performance tests of my spring boot batch jobs.嗨,我需要对我的 Spring Boot 批处理作业运行一些性能测试。 I am looking for the most effective way to set the data into the mongo database.我正在寻找将数据设置到 mongo 数据库的最有效方法。 The data is encrypted in the service, so I cant directly load the data via mongo.数据在服务中是加密的,所以我不能直接通过mongo加载数据。 I want to load up 1million plus records.我想加载 100 万多条记录。 Should I be looking to use a load testing tool such as K6, or would it make more sense to set up a threadpool executor and write some java to get the data in??我应该考虑使用 K6 之类的负载测试工具,还是设置线程池执行程序并编写一些 java 来获取数据更有意义?

If you want to measure the time required to insert 1M of records into the database you can consider the following options:如果要测量将 1M 记录插入数据库所需的时间,可以考虑以下选项:

  1. If it is possible to use Java code consider wrapping it into a microbenchmark test harness like JMH , this way you will get some performance metrics which are not provided by future tasks per se.如果可以使用 Java 代码,请考虑将其包装到像JMH这样的微基准测试工具中,这样您将获得一些性能指标,这些指标本身不会由未来的任务提供。
  2. Assuming you're considering using k6 and it doesn't support anything but HTTP it seems your application exposes a HTTP interface, and assuming the system under test is a Spring Boot application it makes more sense to go for a Java-based load testing tool, this way you will be able to use the same infrastructure for the load tests as for the system under test.假设您正在考虑使用 k6 并且它不支持除 HTTP 之外的任何内容,那么您的应用程序似乎公开了一个 HTTP 接口,并且假设被测系统是 Spring Boot 应用程序,那么使用基于 Java 的负载测试工具更有意义,这样您就可以使用与被测系统相同的基础架构进行负载测试。 Moreover k6 can be executed only on one machine and I believe distributed clustered mode is a must have for a good load testing tool just in case if you will need to scale your load test.此外, k6 只能在一台机器上执行,我相信分布式集群模式对于一个好的负载测试工具来说是必不可少的,以防万一您需要扩展负载测试。 The most advanced free and open source load testing tools which are Java/JVM based are:基于 Java/JVM 的最先进的免费和开源负载测试工具是:

Check out Open Source Load Testing Tools: Which One Should You Use?查看开源负载测试工具:您应该使用哪一个? article to learn more about main features of the above solutions.文章以了解有关上述解决方案主要功能的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM