当前位置: 首页 > news >正文

Spring Boot + MySQL 多线程查询与联表查询性能对比分析

Spring Boot + MySQL: 多线程查询与联表查询性能对比分析

背景

在现代 Web 应用开发中,数据库性能是影响系统响应时间和用户体验的关键因素之一。随着业务需求的不断增长,单表查询和联表查询的效率问题日益凸显。特别是在 Spring Boot 项目中,结合 MySQL 数据库进行复杂查询时,如何优化查询性能已成为开发者必须面对的重要问题。

在本实验中,我们使用了 Spring Boot 框架结合 MySQL 数据库,进行了两种常见查询方式的性能对比:多线程查询联表查询。通过对比这两种查询方式的响应时间,本文旨在探讨在实际业务场景中,选择哪种方式能带来更高的查询效率,尤其是在面对大数据量和复杂查询时的性能表现。


实验目的

本实验的主要目的是通过对比以下两种查询方式的性能,帮助开发者选择在不同业务场景下的查询方式:

  1. 联表查询(使用 SQL 语句中的 LEFT JOIN 等连接操作)
  2. 多线程查询(通过 Spring Boot 异步处理,分批查询不同表的数据)

实验环境

  • 开发框架:Spring Boot

  • 数据库:MySQL

  • 数据库表结构

    • test_a:主表,包含与其他表(test_btest_ctest_dtest_e)的关联字段。
    • test_btest_ctest_dtest_e:附表,分别包含不同的数据字段。

    这些表通过外键(逻辑)关联,test_a 表中的 test_b_idtest_c_idtest_d_idtest_e_id 字段指向各自的附表。

  • 数据量:约 100,000 条数据,分别在主表和附表中填充数据。

一.建表语句

主表A

CREATE TABLE `test_a` (`id` int NOT NULL AUTO_INCREMENT,`name` varchar(255) NOT NULL,`description` varchar(255) DEFAULT NULL,`test_b_id` int DEFAULT NULL,`test_c_id` int DEFAULT NULL,`test_d_id` int DEFAULT NULL,`test_e_id` int DEFAULT NULL,`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

附表b,c,d,e

CREATE TABLE `test_b` (`id` int NOT NULL AUTO_INCREMENT,`field_b1` varchar(255) DEFAULT NULL,`field_b2` int DEFAULT NULL,`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=792843462 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;CREATE TABLE `test_c` (`id` int NOT NULL AUTO_INCREMENT,`field_c1` varchar(255) DEFAULT NULL,`field_c2` datetime DEFAULT NULL,`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=100096 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;CREATE TABLE `test_d` (`id` int NOT NULL AUTO_INCREMENT,`field_d1` text,`field_d2` tinyint(1) DEFAULT NULL,`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=100300 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;CREATE TABLE `test_e` (`id` int NOT NULL AUTO_INCREMENT,`field_e1` int DEFAULT NULL,`field_e2` varchar(255) DEFAULT NULL,`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=100444 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

二.填充数据

@SpringBootTest
class DemoTestQuerySpringbootApplicationTests {@Autowiredprivate TestAMapper testAMapper;@Autowiredprivate TestBMapper testBMapper;@Autowiredprivate TestCMapper testCMapper;@Autowiredprivate TestDMapper testDMapper;@Autowiredprivate TestEMapper testEMapper;@Testvoid contextLoads() {// 随机数生成器Random random = new Random();for (int i = 1; i <= 100000; i++) {// 插入 test_b 数据int testBId = insertTestB(random);// 插入 test_c 数据int testCId = insertTestC(random);// 插入 test_d 数据int testDId = insertTestD(random);// 插入 test_e 数据int testEId = insertTestE(random);// 插入 test_a 数据insertTestA(testBId, testCId, testDId, testEId, random);}}private int insertTestB(Random random) {TestB testB = new TestB();testB.setFieldB1("B Field " + random.nextInt(1000));testB.setFieldB2(random.nextInt(1000));testBMapper.insert(testB);  // 插入数据return testB.getId();  }private int insertTestC(Random random) {TestC testC = new TestC();testC.setFieldC1("C Field " + random.nextInt(1000));testC.setFieldC2(new java.sql.Timestamp(System.currentTimeMillis()));testCMapper.insert(testC);  // 插入数据return testC.getId();  }private int insertTestD(Random random) {TestD testD = new TestD();testD.setFieldD1("D Field " + random.nextInt(1000));testD.setFieldD2(random.nextBoolean());testDMapper.insert(testD);  // 插入数据return testD.getId();  }private int insertTestE(Random random) {TestE testE = new TestE();testE.setFieldE1(random.nextInt(1000));testE.setFieldE2("E Field " + random.nextInt(1000));testEMapper.insert(testE);  // 插入数据return testE.getId();  }private void insertTestA(int testBId, int testCId, int testDId, int testEId, Random random) {TestA testA = new TestA();testA.setName("Test A Name " + random.nextInt(1000));testA.setDescription("Test A Description " + random.nextInt(1000));testA.setTestBId(testBId);testA.setTestCId(testCId);testA.setTestDId(testDId);testA.setTestEId(testEId);testAMapper.insert(testA);  // 插入数据}}

三.配置线程池

3.1配置

/*** 实现AsyncConfigurer接口* 并重写了 getAsyncExecutor方法,* 这个方法返回 myExecutor(),* Spring 默认会将 myExecutor 作为 @Async 方法的线程池。*/
@Configuration
@EnableAsync
public class ThreadPoolConfig implements AsyncConfigurer {/*** 项目共用线程池*/public static final String TEST_QUERY = "testQuery";@Overridepublic Executor getAsyncExecutor() {return myExecutor();}@Bean(TEST_QUERY)@Primarypublic ThreadPoolTaskExecutor myExecutor() {//spring的线程池ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();//线程池优雅停机的关键executor.setWaitForTasksToCompleteOnShutdown(true);executor.setCorePoolSize(10);executor.setMaxPoolSize(10);executor.setQueueCapacity(200);executor.setThreadNamePrefix("my-executor-");//拒绝策略->满了调用线程执行,认为重要任务executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());//自己就是一个线程工程executor.setThreadFactory(new MyThreadFactory(executor));executor.initialize();return executor;}}

3.2异常处理

public class MyUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {private static final Logger log = LoggerFactory.getLogger(MyUncaughtExceptionHandler.class);@Overridepublic void uncaughtException(Thread t, Throwable e) {log.error("Exception in thread",e);}
}

3.3线程工厂

@AllArgsConstructor
public class MyThreadFactory implements ThreadFactory {private static final MyUncaughtExceptionHandler MyUncaughtExceptionHandler = new MyUncaughtExceptionHandler();private ThreadFactory original;@Overridepublic Thread newThread(Runnable r) {//执行Spring线程自己的创建逻辑Thread thread = original.newThread(r);//我们自己额外的逻辑thread.setUncaughtExceptionHandler(MyUncaughtExceptionHandler);return thread;}
}

四.Service查询方法

4.1left join连接查询

    @Overridepublic IPage<TestAll> getTestAllPage_1(int current, int size) {// 创建 Page 对象,current 为当前页,size 为每页大小Page<TestAll> page = new Page<>(current, size);return testAMapper.selectAllWithPage(page);}

对应的xml 的sql语句

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.fth.demotestqueryspringboot.com.test.mapper.TestAMapper"><!-- 基本的 ResultMap 映射 --><resultMap id="BaseResultMap" type="org.fth.demotestqueryspringboot.com.test.entity.vo.TestAll"><id column="test_a_id" jdbcType="INTEGER" property="testAId" /><result column="name" jdbcType="VARCHAR" property="name" /><result column="description" jdbcType="VARCHAR" property="description" /><result column="test_b_id" jdbcType="INTEGER" property="testBId" /><result column="test_c_id" jdbcType="INTEGER" property="testCId" /><result column="test_d_id" jdbcType="INTEGER" property="testDId" /><result column="test_e_id" jdbcType="INTEGER" property="testEId" /><result column="created_at" jdbcType="TIMESTAMP" property="createdAt" /><result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" /><!-- TestB --><result column="field_b1" jdbcType="VARCHAR" property="fieldB1" /><result column="field_b2" jdbcType="INTEGER" property="fieldB2" /><result column="test_b_created_at" jdbcType="TIMESTAMP" property="testBCreatedAt" /><!-- TestC --><result column="field_c1" jdbcType="VARCHAR" property="fieldC1" /><result column="field_c2" jdbcType="TIMESTAMP" property="fieldC2" /><result column="test_c_created_at" jdbcType="TIMESTAMP" property="testCCreatedAt" /><!-- TestD --><result column="field_d1" jdbcType="VARCHAR" property="fieldD1" /><result column="field_d2" jdbcType="BOOLEAN" property="fieldD2" /><result column="test_d_created_at" jdbcType="TIMESTAMP" property="testDCreatedAt" /><!-- TestE --><result column="field_e1" jdbcType="INTEGER" property="fieldE1" /><result column="field_e2" jdbcType="VARCHAR" property="fieldE2" /><result column="test_e_created_at" jdbcType="TIMESTAMP" property="testECreatedAt" /></resultMap><!-- 分页查询 TestA 和其他表的数据 --><select id="selectAllWithPage" resultMap="BaseResultMap">SELECTa.id AS test_a_id,a.name,a.description,a.test_b_id,a.test_c_id,a.test_d_id,a.test_e_id,a.created_at,a.updated_at,-- TestBb.field_b1,b.field_b2,b.created_at AS test_b_created_at,-- TestCc.field_c1,c.field_c2,c.created_at AS test_c_created_at,-- TestDd.field_d1,d.field_d2,d.created_at AS test_d_created_at,-- TestEe.field_e1,e.field_e2,e.created_at AS test_e_created_atFROM test_a aLEFT JOIN test_b b ON a.test_b_id = b.idLEFT JOIN test_c c ON a.test_c_id = c.idLEFT JOIN test_d d ON a.test_d_id = d.idLEFT JOIN test_e e ON a.test_e_id = e.id</select></mapper>

4.2多线程查询

 @Overridepublic IPage<TestAll> getTestAllPage_2(int current, int size) {IPage<TestA> testAPage = testAMapper.selectPage(new Page<>(current, size), null);List<TestA> testAS = testAPage.getRecords();CompletableFuture<List<TestB>> futureBs = selectTestBids(testAS.stream().map(TestA::getTestBId).collect(Collectors.toSet()));CompletableFuture<List<TestC>> futureCs = selectTestCids(testAS.stream().map(TestA::getTestCId).collect(Collectors.toSet()));CompletableFuture<List<TestD>> futureDs = selectTestDids(testAS.stream().map(TestA::getTestDId).collect(Collectors.toSet()));CompletableFuture<List<TestE>> futureEs = selectTestEids(testAS.stream().map(TestA::getTestEId).collect(Collectors.toSet()));// 等待所有异步任务完成并收集结果CompletableFuture<Void> allFutures = CompletableFuture.allOf(futureBs, futureCs, futureDs, futureEs);try {// 等待所有异步任务完成allFutures.get();} catch (InterruptedException | ExecutionException e) {e.printStackTrace();throw new RuntimeException("Failed to fetch data", e);}// 获取异步查询的结果List<TestB> bs = futureBs.join();List<TestC> cs = futureCs.join();List<TestD> ds = futureDs.join();List<TestE> es = futureEs.join();// 将结果映射到Map以便快速查找Map<Integer, TestB> bMap = bs.stream().collect(Collectors.toMap(TestB::getId, b -> b));Map<Integer, TestC> cMap = cs.stream().collect(Collectors.toMap(TestC::getId, c -> c));Map<Integer, TestD> dMap = ds.stream().collect(Collectors.toMap(TestD::getId, d -> d));Map<Integer, TestE> eMap = es.stream().collect(Collectors.toMap(TestE::getId, e -> e));List<TestAll> testAllList = testAS.stream().map(testA -> {TestAll testAll = new TestAll();testAll.setTestAId(testA.getId());testAll.setName(testA.getName());testAll.setDescription(testA.getDescription());testAll.setCreatedAt(testA.getCreatedAt());// 根据 testBId 填充 TestB 的字段if (testA.getTestBId() != null) {TestB testB = bMap.get(testA.getTestBId());if (testB != null) {testAll.setFieldB1(testB.getFieldB1());testAll.setFieldB2(testB.getFieldB2());testAll.setTestBCreatedAt(testB.getCreatedAt());}}// 根据 testCId 填充 TestC 的字段if (testA.getTestCId() != null) {TestC testC = cMap.get(testA.getTestCId());if (testC != null) {testAll.setFieldC1(testC.getFieldC1());testAll.setFieldC2(testC.getFieldC2());testAll.setTestCCreatedAt(testC.getCreatedAt());}}// 根据 testDId 填充 TestD 的字段if (testA.getTestDId() != null) {TestD testD = dMap.get(testA.getTestDId());if (testD != null) {testAll.setFieldD1(testD.getFieldD1());testAll.setFieldD2(testD.getFieldD2());testAll.setTestDCreatedAt(testD.getCreatedAt());}}// 根据 testEId 填充 TestE 的字段if (testA.getTestEId() != null) {TestE testE = eMap.get(testA.getTestEId());if (testE != null) {testAll.setFieldE1(testE.getFieldE1());testAll.setFieldE2(testE.getFieldE2());testAll.setTestECreatedAt(testE.getCreatedAt());}}return testAll;}).collect(Collectors.toList());// 创建并返回新的分页对象IPage<TestAll> page = new Page<>(testAPage.getCurrent(), testAPage.getSize(), testAPage.getTotal());page.setRecords(testAllList);return page;}@Asyncpublic CompletableFuture<List<TestB>> selectTestBids(Set<Integer> bids) {return CompletableFuture.supplyAsync(() -> testBMapper.selectBatchIds(bids));}@Asyncpublic CompletableFuture<List<TestC>> selectTestCids(Set<Integer> cids) {return CompletableFuture.supplyAsync(() -> testCMapper.selectBatchIds(cids));}@Asyncpublic CompletableFuture<List<TestD>> selectTestDids(Set<Integer> dids) {return CompletableFuture.supplyAsync(() -> testDMapper.selectBatchIds(dids));}@Asyncpublic CompletableFuture<List<TestE>> selectTestEids(Set<Integer> eids) {return CompletableFuture.supplyAsync(() -> testEMapper.selectBatchIds(eids));}

五.结果测试

5.1连接查询

在这里插入图片描述

在这里插入图片描述

查询结果表格

currentsize响应时间
12016ms
502023ms
1002022ms
5002052ms
200200213ms
500200517ms

5.2多线程查询

在这里插入图片描述

在这里插入图片描述

查询结果表格

currentsize响应时间
12018ms
502017ms
1002017ms
5002021ms
20020056ms
50020080ms

总结与建议

  • 选择联表查询:当数据量较小,或者查询逻辑较为简单时,使用联表查询可以更简单直接,查询性能也较为优秀。
  • 选择多线程查询:当面对大数据量或者复杂查询时,采用多线程查询将带来更显著的性能提升。通过异步并行查询,可以有效缩短响应时间,提升系统的整体性能。

在实际开发中,可以根据具体的业务需求和数据库的规模,合理选择查询方式,从而提高数据库查询效率,优化系统性能

相关文章:

Spring Boot + MySQL 多线程查询与联表查询性能对比分析

Spring Boot MySQL: 多线程查询与联表查询性能对比分析 背景 在现代 Web 应用开发中&#xff0c;数据库性能是影响系统响应时间和用户体验的关键因素之一。随着业务需求的不断增长&#xff0c;单表查询和联表查询的效率问题日益凸显。特别是在 Spring Boot 项目中&#xff0…...

Java 设计模式~工厂模式

在java开发&#xff0c;工厂模式应用场景有哪些&#xff1f;在Spring boot原码中 有哪些工厂类&#xff0c;并做相应的代码介绍。 工厂模式 工厂模式&#xff08;Factory Pattern&#xff09;是Java中一种常用的创建型设计模式&#xff0c;它提供了一种创建对象的最佳方式。此…...

OmicsTools生信环境全自动化安装配置教程,代做生信分析和辅导

OmicsTools软件介绍和下载安装配置 软件介绍 我开发了一款本地电脑无限使用的零代码生信数据分析作软图神器电脑软件OmicsTools&#xff0c;旨在成为可以做各种医学生物生信领域科研数据分析作图的的全能科研软件&#xff0c;欢迎大家使用OmicsTools进行生物医学科研数据分析…...

鸿蒙HarmonyOS应用开发 探索 HarmonyOS Next-从开发到实战掌握 HarmonyOS Next 的分布式能力

鸿蒙心路旅程&#xff1a;探索 HarmonyOS Next-从开发到实战掌握 HarmonyOS Next 的分布式能力 HarmonyOS Next 是华为推出的全新一代操作系统&#xff0c;旨在进一步推动分布式技术的深度应用和生态融合。本文将从技术特点、应用场景入手&#xff0c;通过实战案例与代码示例&…...

二分模板题

题目传送门 主要思路&#xff1a; 暴力会tle n的3次方了然后 二分可以找中间然后去二分枚举两边 最后结果 ansa小于它的数*c大于它的数 注意要判断是否符合条件 即如果a的小于它的数还大于它就不成立 或者c的数小于它也不成立结果 要注意转long long ans(long long)tp1*tp2; …...

一篇文章掌握Git的基本原理与使用

目录 一、创建仓库 1.1 git init 1.2 git clone 二、工作区域与文件状态 三、添加和提交文件 3.1 git status 3.2 git add git rm --cached 3.3 git commit git log 四、版本回退 soft hard mixed 总结 五、查看差异 工作区与暂存区 工作区与本地仓库 暂存区…...

「Mac畅玩鸿蒙与硬件43」UI互动应用篇20 - 闪烁按钮效果

本篇将带你实现一个带有闪烁动画的按钮交互效果。通过动态改变按钮颜色&#xff0c;用户可以在视觉上感受到按钮的闪烁效果&#xff0c;提升界面互动体验。 关键词 UI互动应用闪烁动画动态按钮状态管理用户交互 一、功能说明 闪烁按钮效果应用实现了一个动态交互功能&#xf…...

朗新科技集团如何用云消息队列 RocketMQ 版“快、准、狠”破解业务难题?

作者&#xff1a;邹星宇、刘尧 朗新科技集团&#xff1a;让数字化的世界更美好 朗新科技集团股份有限公司是领先的能源科技企业&#xff0c;长期深耕电力能源领域&#xff0c;通过新一代数字化、人工智能、物联网、电力电子技术等新质生产力&#xff0c;服务城市、产业、生活中…...

【Ubuntu】Ubuntu的Desktop(学习/用户使用)和Bit版本(工作)

这篇文章似乎没什么必要写&#xff0c;但想了想还是决定记录一下&#xff0c;也许对新手入坑Ubuntu会有帮助&#xff0c; 事实上也很简单&#xff0c;一个是桌面版本&#xff0c;另一个是字符界面版本。 桌面版&#xff1a;拥有图形桌面 字符界面&#xff0c;易上手&#xff…...

cmake CMAKE_CURRENT_SOURCE_DIR和CMAKE_CURRENT_LIST_DIR的区别

在 CMake 中&#xff0c;CMAKE_CURRENT_LIST_DIR 和 CMAKE_CURRENT_SOURCE_DIR 都是指代当前 CMake 文件所在的路径&#xff0c;但它们的含义和用途有所不同&#xff1a; CMAKE_CURRENT_LIST_DIR&#xff1a; 表示 当前处理的 CMake 文件&#xff08;例如 CMakeLists.txt&#…...

学会用VSCode debug

本文主要介绍了 VS Code 的调试功能&#xff0c;包括其强大的内置调试器&#xff0c;支持多种语言&#xff0c;如 JavaScript、TypeScript 等。通过简单项目示例展示调试过程&#xff0c;还介绍了运行面板和菜单、启动配置、调试操作、断点、记录点等功能&#xff0c;以及三种调…...

C语言专题之结构体的使用

结构体&#xff08;struct&#xff09;是一种用户自定义的数据类型&#xff0c;它允许将不同类型的数据组合在一起&#xff0c;形成一个新的数据类型。结构体在编程中非常常见&#xff0c;尤其是在需要处理复杂数据结构的情况下。以下是结构体的基本使用方法&#xff1a; 一、结…...

python中的高阶函数

1、什么是高阶函数&#xff1f; 高阶函数是指将函数作为参数传入。就是高阶函数 2、高阶函数有哪些&#xff1f; map 映射函数 >>> print(list(map(lambda x:x*x,range(1,11)))) [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] >>> print(list(map(lambda x:st…...

学习笔记063——通过使用 aspose-words 将 Word 转 PDF 时,遇到的字体改变以及乱码问题

文章目录 1、问题描述&#xff1a;2、解决方法&#xff1a; 1、问题描述&#xff1a; Java项目中&#xff0c;有个需要将word转pdf的需求。本人通过使用aspose-words来转换的。在Windows中&#xff0c;转换是完全正常的。但是当部署到服务器时&#xff0c;会出现转换生成的pdf…...

SpringBoot整合Mockito进行单元测试超全详细教程 JUnit断言 Mockito 单元测试

Mock概念 Mock叫做模拟对象&#xff0c;即用来模拟未被实现的对象可以预先定义这个对象在特定调用时的行为&#xff08;例如返回值或抛出异常&#xff09;&#xff0c;从而模拟不同的系统状态。 导入Mock依赖 pom文件中引入springboot测试依赖&#xff0c;spring-boot-start…...

【AI知识】过拟合、欠拟合和正则

一句话总结&#xff1a; 过拟合和欠拟合是机器学习中的两个相对的概念&#xff0c;正则化是用于解决过拟合的方法。 1. 欠拟合&#xff1a; 指模型在训练数据上表现不佳&#xff0c;不能充分捕捉数据的潜在规律&#xff0c;导致在训练集和测试集上的误差都很高。欠拟合意味着模…...

MacOS编译webRTC源码小tip

简单记录一下&#xff0c;本人在编译webRTC时&#xff0c;碰到了一下比较烦人的问题&#xff0c;在MacOS终端下&#xff0c;搭建科学上网之后&#xff0c;chromium的depot_tools仓库成功拉下来了&#xff0c;紧接着&#xff0c;使用fetch以及gclient sync始终都返回curl相关的网…...

Linux基础命令(三):文件压缩及解压缩命令

文件压缩及解压缩命令 tar — 打包和压缩 tar 是一个用于打包文件的工具&#xff0c;常常用来将多个文件或目录打包成一个单独的文件。它本身不进行压缩&#xff0c;但可以与压缩工具&#xff08;如 gzip 或 bzip2&#xff09;一起使用。 用法&#xff1a; 打包文件&#xff0…...

目标跟踪算法:ByteTrack、卡尔曼滤波、匈牙利算法、高置信度检测目标、低置信度检测目标

目录 1 ByteTrack特点 2 ByteTrack和SORT区别----个人通俗理解 3 ByteTrack算法原理 4 ByteTrack整体流程图 上一篇博客我复习了下SORT跟踪算法&#xff0c;这一篇博客我再复习下ByteTrack跟踪算法&#xff0c;ByteTrack里面也是用了卡尔曼滤波和匈牙利算法&#x…...

[定昌linux系统]如何安装jdk8

1:下载jdk8 的 arm64 的版本&#xff0c;由于官方下载需要gmail&#xff0c;我的gmail 密码忘了&#xff0c;所以从csdn上下载了一份&#xff0c;地址&#xff1a; https://download.csdn.net/download/qq_27742163/88533548?utm_mediumdistribute.pc_relevant_download.none…...

C++初阶-list的底层

目录 1.std::list实现的所有代码 2.list的简单介绍 2.1实现list的类 2.2_list_iterator的实现 2.2.1_list_iterator实现的原因和好处 2.2.2_list_iterator实现 2.3_list_node的实现 2.3.1. 避免递归的模板依赖 2.3.2. 内存布局一致性 2.3.3. 类型安全的替代方案 2.3.…...

k8s从入门到放弃之Ingress七层负载

k8s从入门到放弃之Ingress七层负载 在Kubernetes&#xff08;简称K8s&#xff09;中&#xff0c;Ingress是一个API对象&#xff0c;它允许你定义如何从集群外部访问集群内部的服务。Ingress可以提供负载均衡、SSL终结和基于名称的虚拟主机等功能。通过Ingress&#xff0c;你可…...

在HarmonyOS ArkTS ArkUI-X 5.0及以上版本中,手势开发全攻略:

在 HarmonyOS 应用开发中&#xff0c;手势交互是连接用户与设备的核心纽带。ArkTS 框架提供了丰富的手势处理能力&#xff0c;既支持点击、长按、拖拽等基础单一手势的精细控制&#xff0c;也能通过多种绑定策略解决父子组件的手势竞争问题。本文将结合官方开发文档&#xff0c…...

家政维修平台实战20:权限设计

目录 1 获取工人信息2 搭建工人入口3 权限判断总结 目前我们已经搭建好了基础的用户体系&#xff0c;主要是分成几个表&#xff0c;用户表我们是记录用户的基础信息&#xff0c;包括手机、昵称、头像。而工人和员工各有各的表。那么就有一个问题&#xff0c;不同的角色&#xf…...

【Go】3、Go语言进阶与依赖管理

前言 本系列文章参考自稀土掘金上的 【字节内部课】公开课&#xff0c;做自我学习总结整理。 Go语言并发编程 Go语言原生支持并发编程&#xff0c;它的核心机制是 Goroutine 协程、Channel 通道&#xff0c;并基于CSP&#xff08;Communicating Sequential Processes&#xff0…...

关于 WASM:1. WASM 基础原理

一、WASM 简介 1.1 WebAssembly 是什么&#xff1f; WebAssembly&#xff08;WASM&#xff09; 是一种能在现代浏览器中高效运行的二进制指令格式&#xff0c;它不是传统的编程语言&#xff0c;而是一种 低级字节码格式&#xff0c;可由高级语言&#xff08;如 C、C、Rust&am…...

Java求职者面试指南:Spring、Spring Boot、MyBatis框架与计算机基础问题解析

Java求职者面试指南&#xff1a;Spring、Spring Boot、MyBatis框架与计算机基础问题解析 一、第一轮提问&#xff08;基础概念问题&#xff09; 1. 请解释Spring框架的核心容器是什么&#xff1f;它在Spring中起到什么作用&#xff1f; Spring框架的核心容器是IoC容器&#…...

A2A JS SDK 完整教程:快速入门指南

目录 什么是 A2A JS SDK?A2A JS 安装与设置A2A JS 核心概念创建你的第一个 A2A JS 代理A2A JS 服务端开发A2A JS 客户端使用A2A JS 高级特性A2A JS 最佳实践A2A JS 故障排除 什么是 A2A JS SDK? A2A JS SDK 是一个专为 JavaScript/TypeScript 开发者设计的强大库&#xff…...

LLMs 系列实操科普(1)

写在前面&#xff1a; 本期内容我们继续 Andrej Karpathy 的《How I use LLMs》讲座内容&#xff0c;原视频时长 ~130 分钟&#xff0c;以实操演示主流的一些 LLMs 的使用&#xff0c;由于涉及到实操&#xff0c;实际上并不适合以文字整理&#xff0c;但还是决定尽量整理一份笔…...

STM32---外部32.768K晶振(LSE)无法起振问题

晶振是否起振主要就检查两个1、晶振与MCU是否兼容&#xff1b;2、晶振的负载电容是否匹配 目录 一、判断晶振与MCU是否兼容 二、判断负载电容是否匹配 1. 晶振负载电容&#xff08;CL&#xff09;与匹配电容&#xff08;CL1、CL2&#xff09;的关系 2. 如何选择 CL1 和 CL…...