如何使用JMeter 进行全链路压测

使用 JMeter 进行全链路压测:详细步骤指南

全链路压测旨在测试整个系统的性能,包括所有的组件和服务。通过 Apache JMeter 进行全链路压测,可以模拟真实用户行为,测试系统在高负载下的表现。以下是详细的步骤指南,分为准备阶段、测试设计、执行和结果分析四个主要部分。

1. 准备阶段

1.1 定义测试目标

在进行全链路压测之前,首先要明确测试的目标:

  • 响应时间:确定系统在不同负载下的响应时间。
  • 吞吐量:衡量系统在单位时间内处理的请求数。
  • 稳定性:验证系统在持续高负载下的稳定性。
  • 瓶颈识别:找出系统性能的瓶颈点。
1.2 环境准备

全链路压测需要在一个尽量接近生产环境的测试环境中进行。准备工作包括:

  • 硬件准备:配置与生产环境相似的硬件,包括服务器、数据库和网络设备。
  • 软件配置:安装与生产环境相同的操作系统、中间件、数据库和应用程序版本。
  • 网络条件:配置与生产环境相似的网络条件,包括带宽和延迟。
  • 数据准备:准备测试数据,确保数据量和数据分布与生产环境相似。
1.3 工具安装

安装和配置 JMeter 及其所需的插件和依赖:

  • Apache JMeter:主要的性能测试工具。
  • JMeter Plugins:如 JMeter Plugins Manager,用于扩展 JMeter 的功能。
  • InfluxDB:用于存储测试结果数据。
  • Grafana:用于可视化展示测试结果。

2. 测试设计

2.1 识别关键业务流程

识别系统中的关键业务流程,这些流程是用户使用系统时的主要操作路径。例如,在一个电商网站中,关键业务流程可能包括:

  • 用户登录
  • 浏览商品
  • 添加商品到购物车
  • 提交订单
  • 支付订单
2.2 创建 JMeter 测试计划

在 JMeter 中创建测试计划,涵盖上述关键业务流程。以下是一个示例结构:

  • Test Plan
    • Thread Group(用户组)
      • HTTP Request Defaults(默认请求设置)
      • Login(登录)
        • HTTP Request
        • JSON Extractor(提取登录响应中的用户信息)
      • Browse Products(浏览商品)
        • HTTP Request
      • Add to Cart(添加到购物车)
        • HTTP Request
      • Checkout(结账)
        • HTTP Request
      • Payment(支付)
        • HTTP Request
      • View Results Tree(结果树)
      • Summary Report(汇总报告)
2.3 配置测试参数

为每个 HTTP 请求配置参数,如 URL、请求方法、请求头、请求体等。使用 CSV Data Set Config 从 CSV 文件中读取用户数据,模拟多用户登录和操作。

2.4 设置断言

为关键请求添加断言,验证响应数据是否正确。例如,登录请求可以添加响应码断言,验证是否返回200状态码。

2.5 配置负载参数

在 Thread Group 中设置负载参数,包括线程数(虚拟用户数)、Ramp-Up Period(线程启动时间)、Loop Count(循环次数)等。根据测试目标和环境配置合适的负载。

3. 测试执行

3.1 验证测试脚本

在正式执行测试前,先用少量线程数验证测试脚本是否正确,确保所有请求和参数配置正确。

3.2 执行压力测试

逐步增加线程数,执行压力测试,观察系统在不同负载下的表现。记录系统的响应时间、吞吐量、错误率等性能指标。

3.3 收集监控数据

使用监控工具(如 Prometheus 和 Grafana)监控系统的资源使用情况,包括 CPU、内存、磁盘和网络等。确保在测试过程中系统的资源使用情况在预期范围内。

3.4 保存测试结果

将 JMeter 的测试结果保存到文件中,以便后续分析。可以使用 Listener 将结果保存为 CSV 或者 JTL 格式。

4. 结果分析

4.1 分析测试结果

使用 JMeter 内置的 Listener 分析测试结果,包括响应时间分布、吞吐量、错误率等。识别系统的瓶颈和性能问题。

4.2 可视化测试结果

使用 Grafana 将测试结果可视化,生成响应时间、吞吐量和资源使用情况的图表,方便直观地分析系统性能。

4.3 优化系统性能

根据测试结果,识别并优化系统的瓶颈。例如,优化数据库查询、增加缓存、调整线程池配置等。

4.4 重新测试

在优化系统后,重新执行全链路压测,验证优化措施的效果。确保系统性能得到提升,并在高负载下表现稳定。

详细步骤示例

以下是一个详细的示例,展示如何通过 JMeter 进行全链路压测。

1. 创建测试计划

打开 JMeter,新建一个测试计划(Test Plan)。

2. 添加线程组

在测试计划中添加一个线程组(Thread Group),设置线程数、Ramp-Up Period 和循环次数。

Test Plan- Thread Group- Number of Threads (users): 100- Ramp-Up Period (seconds): 10- Loop Count: 10
3. 配置 HTTP 请求

在线程组中添加 HTTP 请求(HTTP Request),配置请求的 URL、方法、参数等。

Thread Group- HTTP Request- Name: Login- URL: http://example.com/login- Method: POST- Parameters:- username: ${username}- password: ${password}
4. 添加 JSON 提取器

在登录请求下添加 JSON 提取器(JSON Extractor),提取响应中的用户信息。

HTTP Request (Login)- JSON Extractor- Reference Name: user_id- JSON Path: $.user.id
5. 添加浏览商品请求

在线程组中添加浏览商品请求,配置请求的 URL 和方法。

Thread Group- HTTP Request (Browse Products)- URL: http://example.com/products- Method: GET
6. 添加添加到购物车请求

在线程组中添加添加到购物车请求,配置请求的 URL、方法和参数。

Thread Group- HTTP Request (Add to Cart)- URL: http://example.com/cart/add- Method: POST- Parameters:- product_id: ${product_id}- user_id: ${user_id}
7. 添加结账请求

在线程组中添加结账请求,配置请求的 URL 和方法。

Thread Group- HTTP Request (Checkout)- URL: http://example.com/checkout- Method: POST- Parameters:- cart_id: ${cart_id}- user_id: ${user_id}
8. 添加支付请求

在线程组中添加支付请求,配置请求的 URL 和方法。

Thread Group- HTTP Request (Payment)- URL: http://example.com/payment- Method: POST- Parameters:- order_id: ${order_id}- user_id: ${user_id}
9. 添加结果监听器

在线程组中添加结果监听器(Listener),如结果树(View Results Tree)和汇总报告(Summary Report)。

Thread Group- View Results Tree- Summary Report
10. 配置 CSV Data Set Config

在测试计划中添加 CSV Data Set Config,从 CSV 文件中读取测试数据。

Test Plan- CSV Data Set Config- Filename: user_data.csv- Variable Names: username, password, product_id, cart_id, order_id

测试执行

1. 验证测试脚本

先用少量线程数验证测试脚本是否正确,确保所有请求和参数配置正确。

2. 执行压力测试

逐步增加线程数,执行压力测试,观察系统在不同负载下的表现。记录系统的响应时间、吞吐量、错误率等性能指标。

3. 收集监控数据

使用监控工具(如 Prometheus 和 Grafana)监控系统的资源使用情况,包括 CPU、内存、磁盘和网络等。

4. 保存测试结果

将 JMeter 的测试结果保存到文件中,以便后续分析。可以使用 Listener 将结果保存为 CSV 或者 JTL 格式。

结果分析

1. 分析测试结果

使用 JMeter 内

置的 Listener 分析测试结果,包括响应时间分布、吞吐量、错误率等。识别系统的瓶颈和性能问题。

2. 可视化测试结果

使用 Grafana 将测试结果可视化,生成响应时间、吞吐量和资源使用情况的图表,方便直观地分析系统性能。

3. 优化系统性能

根据测试结果,识别并优化系统的瓶颈。例如,优化数据库查询、增加缓存、调整线程池配置等。

4. 重新测试

在优化系统后,重新执行全链路压测,验证优化措施的效果。确保系统性能得到提升,并在高负载下表现稳定。

详细代码示例

以下是一个完整的 JMeter 测试计划 XML 配置示例:

<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.1"><hashTree><TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true"><stringProp name="TestPlan.comments"></stringProp><boolProp name="TestPlan.functional_mode">false</boolProp><boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp><boolProp name="TestPlan.serialize_threadgroups">false</boolProp><elementProp name="TestPlan.user_defined_variables" elementType="Arguments"><collectionProp name="Arguments.arguments"/></elementProp><stringProp name="TestPlan.user_define_classpath"></stringProp></TestPlan><hashTree><CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="CSV Data Set Config" enabled="true"><stringProp name="filename">user_data.csv</stringProp><stringProp name="fileEncoding"></stringProp><stringProp name="variableNames">username,password,product_id,cart_id,order_id</stringProp><stringProp name="delimiter">,</stringProp><boolProp name="quotedData">false</boolProp><boolProp name="recycle">true</boolProp><boolProp name="stopThread">false</boolProp><stringProp name="shareMode">shareMode.all</stringProp></CSVDataSet><hashTree/><ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true"><stringProp name="ThreadGroup.on_sample_error">continue</stringProp><elementProp name="ThreadGroup.main_controller" elementType="LoopController"><boolProp name="LoopController.continue_forever">false</boolProp><stringProp name="LoopController.loops">10</stringProp></elementProp><stringProp name="ThreadGroup.num_threads">100</stringProp><stringProp name="ThreadGroup.ramp_time">10</stringProp><boolProp name="ThreadGroup.scheduler">false</boolProp><stringProp name="ThreadGroup.duration"></stringProp><stringProp name="ThreadGroup.delay"></stringProp></ThreadGroup><hashTree><ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true"><elementProp name="HTTPsampler.Arguments" elementType="Arguments"><collectionProp name="Arguments.arguments"/></elementProp><stringProp name="HTTPSampler.domain">example.com</stringProp><stringProp name="HTTPSampler.port"></stringProp><stringProp name="HTTPSampler.protocol">http</stringProp><stringProp name="HTTPSampler.contentEncoding"></stringProp><stringProp name="HTTPSampler.path"></stringProp><stringProp name="HTTPSampler.concurrentPool">6</stringProp><stringProp name="HTTPSampler.connect_timeout"></stringProp><stringProp name="HTTPSampler.response_timeout"></stringProp></ConfigTestElement><hashTree/><HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Login" enabled="true"><elementProp name="HTTPsampler.Arguments" elementType="Arguments"><collectionProp name="Arguments.arguments"><elementProp name="username" elementType="HTTPArgument"><boolProp name="HTTPArgument.always_encode">false</boolProp><stringProp name="Argument.value">${username}</stringProp><stringProp name="Argument.metadata">=</stringProp><boolProp name="HTTPArgument.use_equals">true</boolProp><stringProp name="Argument.name">username</stringProp></elementProp><elementProp name="password" elementType="HTTPArgument"><boolProp name="HTTPArgument.always_encode">false</boolProp><stringProp name="Argument.value">${password}</stringProp><stringProp name="Argument.metadata">=</stringProp><boolProp name="HTTPArgument.use_equals">true</boolProp><stringProp name="Argument.name">password</stringProp></elementProp></collectionProp></elementProp><stringProp name="HTTPSampler.domain">example.com</stringProp><stringProp name="HTTPSampler.port"></stringProp><stringProp name="HTTPSampler.protocol">http</stringProp><stringProp name="HTTPSampler.path">/login</stringProp><stringProp name="HTTPSampler.method">POST</stringProp><boolProp name="HTTPSampler.follow_redirects">true</boolProp><boolProp name="HTTPSampler.auto_redirects">false</boolProp><boolProp name="HTTPSampler.use_keepalive">true</boolProp><boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp><stringProp name="HTTPSampler.monitor">false</stringProp><stringProp name="HTTPSampler.embedded_url_re"></stringProp><stringProp name="HTTPSampler.connect_timeout"></stringProp><stringProp name="HTTPSampler.response_timeout"></stringProp></HTTPSamplerProxy><hashTree><JSONPostProcessor guiclass="JSONPostProcessorGui" testclass="JSONPostProcessor" testname="JSON Extractor" enabled="true"><stringProp name="JSONPostProcessor.referenceNames">user_id</stringProp><stringProp name="JSONPostProcessor.jsonPathExprs">$.user.id</stringProp><stringProp name="JSONPostProcessor.match_numbers">0</stringProp><stringProp name="JSONPostProcessor.defaultValues"></stringProp></JSONPostProcessor></hashTree><HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Browse Products" enabled="true"><elementProp name="HTTPsampler.Arguments" elementType="Arguments"><collectionProp name="Arguments.arguments"/></elementProp><stringProp name="HTTPSampler.domain">example.com</stringProp><stringProp name="HTTPSampler.port"></stringProp><stringProp name="HTTPSampler.protocol">http</stringProp><stringProp name="HTTPSampler.path">/products</stringProp><stringProp name="HTTPSampler.method">GET</stringProp><boolProp name="HTTPSampler.follow_redirects">true</boolProp><boolProp name="HTTPSampler.auto_redirects">false</boolProp><boolProp name="HTTPSampler.use_keepalive">true</boolProp><boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp><stringProp name="HTTPSampler.monitor">false</stringProp><stringProp name="HTTPSampler.embedded_url_re"></stringProp><stringProp name="HTTPSampler.connect_timeout"></stringProp><stringProp name="HTTPSampler.response_timeout"></stringProp></HTTPSamplerProxy><hashTree/><HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Add to Cart" enabled="true"><elementProp name="HTTPsampler.Arguments" elementType="Arguments"><collectionProp name="Arguments.arguments"><elementProp name="product_id" elementType="HTTPArgument"><boolProp name="HTTPArgument.always_encode">false</boolProp><stringProp name="Argument.value">${product_id}</stringProp><stringProp name="Argument.metadata">=</stringProp><boolProp name="HTTPArgument.use_equals">true</boolProp><stringProp name="Argument.name">product_id</stringProp></elementProp><elementProp name="user_id" elementType="HTTPArgument"><boolProp name="HTTPArgument.always_encode">false</boolProp><stringProp name="Argument.value">${user_id}</stringProp><stringProp name="Argument.metadata">=</stringProp><boolProp name="HTTPArgument.use_equals">true</boolProp><stringProp name="Argument.name">user_id</stringProp></elementProp></collectionProp></elementProp><stringProp name="HTTPSampler.domain">example.com</stringProp><stringProp name="HTTPSampler.port"></stringProp><stringProp name="HTTPSampler.protocol">http</stringProp><stringProp name="HTTPSampler.path">/cart/add</stringProp><stringProp name="HTTPSampler.method">POST</stringProp><boolProp name="HTTPSampler.follow_redirects">true</boolProp><boolProp name="HTTPSampler.auto_redirects">false</boolProp><boolProp name="HTTPSampler.use_keepalive">true</boolProp><boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp><stringProp name="HTTPSampler.monitor">false</stringProp><stringProp name="HTTPSampler.embedded_url_re"></stringProp><stringProp name="HTTPSampler.connect_timeout"></stringProp><stringProp name="HTTPSampler.response_timeout"></stringProp></HTTPSamplerProxy><hashTree/><HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout" enabled="true"><elementProp name="HTTPsampler.Arguments" elementType="Arguments"><collectionProp name="Arguments.arguments"><elementProp name="cart_id" elementType="HTTPArgument"><boolProp name="HTTPArgument.always_encode">false</boolProp><stringProp name="Argument.value">${cart_id}</stringProp><stringProp name="Argument.metadata">=</stringProp><boolProp name="HTTPArgument.use_equals">true</boolProp><stringProp name="Argument.name">cart_id</stringProp></elementProp><elementProp name="user_id" elementType="HTTPArgument"><boolProp name="HTTPArgument.always_encode">false</boolProp><stringProp name="Argument.value">${user_id}</stringProp><stringProp name="Argument.metadata">=</stringProp><boolProp name="HTTPArgument.use_equals">true</boolProp><stringProp name="Argument.name">user_id</stringProp></elementProp></collectionProp></elementProp><stringProp name="HTTPSampler.domain">example.com</stringProp><stringProp name="HTTPSampler.port"></stringProp><stringProp name="HTTPSampler.protocol">http</stringProp><stringProp name="HTTPSampler.path">/checkout</stringProp><stringProp name="HTTPSampler.method">POST</stringProp><boolProp name="HTTPSampler.follow_redirects">true</boolProp><boolProp name="HTTPSampler.auto_redirects">false</boolProp><boolProp name="HTTPSampler.use_keepalive">true</boolProp><boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp><stringProp name="HTTPSampler.monitor">false</stringProp><stringProp name="HTTPSampler.embedded_url_re"></stringProp><stringProp name="HTTPSampler.connect_timeout"></stringProp><stringProp name="HTTPSampler.response_timeout"></stringProp></HTTPSamplerProxy><hashTree/><HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Payment" enabled="true"><elementProp name="HTTPsampler.Arguments" elementType="Arguments"><collectionProp name="Arguments.arguments"><elementProp name="order_id" elementType="HTTPArgument"><boolProp name="HTTPArgument.always_encode">false</boolProp><stringProp name="Argument.value">${order_id}</stringProp><stringProp name="Argument.metadata">=</stringProp><boolProp name="HTTPArgument.use_equals">true</boolProp><stringProp name="Argument.name">order_id</stringProp></elementProp><elementProp name="user_id" elementType="HTTPArgument"><boolProp name="HTTPArgument.always_encode">false</boolProp><stringProp name="Argument.value">${user_id}</stringProp><stringProp name="Argument.metadata">=</stringProp><boolProp name="HTTPArgument.use_equals">true</boolProp><stringProp name="Argument.name">user_id</stringProp></elementProp></collectionProp></elementProp><stringProp name="HTTPSampler.domain">example.com</stringProp><stringProp name="HTTPSampler.port"></stringProp><stringProp name="HTTPSampler.protocol">http</stringProp><stringProp name="HTTPSampler.path">/payment</stringProp><stringProp name="HTTPSampler.method">POST</stringProp><boolProp name="HTTPSampler.follow_redirects">true</boolProp><boolProp name="HTTPSampler.auto_redirects">false</boolProp><boolProp name="HTTPSampler.use_keepalive">true</boolProp><boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp><stringProp name="HTTPSampler.monitor">false</stringProp><stringProp name="HTTPSampler.embedded_url_re"></stringProp><stringProp name="HTTPSampler.connect_timeout"></stringProp><stringProp name="HTTPSampler.response_timeout"></stringProp></HTTPSamplerProxy><hashTree/><ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true"><boolProp name="ResultCollector.error_logging">false</boolProp><objProp><name>saveConfig</name><value class="SampleSaveConfiguration"><time>true</time><latency>true</latency><timestamp>true</timestamp><success>true</success><label>true</label><code>true</code><message>true</message><threadName>true</threadName><dataType>true</dataType><encoding>false</encoding><assertions>true</assertions><subresults>true</subresults><responseData>false</responseData><samplerData>false</samplerData><xml>true</xml><fieldNames>true</fieldNames><responseHeaders>false</responseHeaders><requestHeaders>false</requestHeaders><responseDataOnError>false</responseDataOnError><saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage><assertionsResultsToSave>0</assertionsResultsToSave><bytes>true</bytes><sentBytes>true</sentBytes><url>true</url><threadCounts>true</threadCounts><idleTime>true</idleTime><connectTime>true</connectTime></value></objProp><stringProp name="filename"></stringProp></ResultCollector><hashTree/><ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true"><boolProp name="ResultCollector.error_logging">false</boolProp><objProp><name>saveConfig</name><value class="SampleSaveConfiguration"><time>true</time><latency>true</latency><timestamp>true</timestamp><success>true</success><label>true</label><code>true</code><message>true</message><threadName>true</threadName><dataType>true</dataType><encoding>false</encoding><assertions>true</assertions><subresults>true</subresults><responseData>false</responseData><samplerData>false</samplerData><xml>true</xml><fieldNames>true</fieldNames><responseHeaders>false</responseHeaders><requestHeaders>false</requestHeaders><responseDataOnError>false</responseDataOnError><saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage><assertionsResultsToSave>0</assertionsResultsToSave><bytes>true</bytes><sentBytes>true</sentBytes><url>true</url><threadCounts>true</threadCounts><idleTime>true</idleTime><connectTime>true</connectTime></value></objProp><stringProp name="filename"></stringProp></ResultCollector><hashTree/></hashTree></hashTree></hashTree>
</jmeterTestPlan>

总结

通过以上步骤,你可以使用 JMeter 进行全链路压测,覆盖从用户登录到支付的完整业务流程。通过配置合理的负载参数、添加必要的监控和结果分析工具,你可以全面了解系统在高负载下的表现,并找到系统的性能瓶颈,进行针对性的优化。全链路压测不仅能帮助你提升系统的稳定性和可靠性,还能为未来的扩展和优化提供宝贵的数据支持。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/14797.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

AWTK实现汽车仪表Cluster/DashBoard嵌入式GUI开发(七):快启

前言: 汽车仪表是人们了解汽车状况的窗口,而仪表中的大部分信息都是以指示灯形式显示给驾驶者。仪表指示灯图案都较为抽象,对驾驶不熟悉的人在理解仪表指示灯含义方面存在不同程度的困难,尤其对于驾驶新手,如果对指示灯的含义不求甚解,有可能影响驾驶的安全性。即使是对…

Pytest框架实战二

在Pytest框架实战一中详细地介绍了Pytest测试框架在参数化以及Fixture函数在API测试领域的实战案例以及具体的应用。本文章接着上个文章的内容继续阐述Pytest测试框架优秀的特性以及在自动化测试领域的实战。 conftest.py 在上一篇文章中阐述到Fixture函数的特性&#xff0c;第…

shell循环

一、for循环 用法&#xff1a; for 变量 in 取值列表 do 命令序列 done 例1&#xff1a;打印1到10的数字列表 #!/bin/bashfor i in {1..10} do echo $i done 例2&#xff1a;#批量添加用户,用户名存放在users.txt文件中&#xff0c;每行一个,初始密码均设为123456 #!/bin/bas…

KMP算法【C++】

KMP算法测试 KMP 算法详解 根据解释写出对应的C代码进行测试&#xff0c;也可以再整理成一个函数 #include <iostream> #include <vector>class KMP { private:std::string m_pat;//被匹配的字符串std::vector<std::vector<int>> m_dp;//状态二维数组…

怎样解决Redis高并发竞争Key难点?

Redis作为一种高性能的键值存储系统&#xff0c;在现代分布式系统中发挥着重要作用。然而&#xff0c;高并发场景下对同一Key的操作可能引发竞争条件&#xff0c;给系统稳定性和数据一致性带来挑战。本文将探讨如何解决这一问题&#xff0c;为读者提供有效的应对策略。 1. Red…

【002】FlexBison实现原理

0. 前言 Flex和Bison是用于构建处理结构化输入的程序的工具。它们最初是用于构建编译器的工具&#xff0c;但它们已被证明在许多其他领域都很有用。 &#xfeff; 在第一章中&#xff0c;我们将首先看一点(但不是太多)它们背后的理论&#xff0c;然后我们将深入研究一些使用它…

Mysql和Postgresql创建用户和授权命令

Mysql和Postgresql创建用户和授权命令 MySQL/MariaDB/TiDB mysql -uroot -P3306 -p 输入密码&#xff1a;xxx create user user1% identified by xxx; grant all privileges on *.* to user1%; create user user2% identified by xxx; grant all privileges on *.* to user2%;…

Winform /C# 截图当前窗体,指定区域,当前屏幕

1.当前窗体 public static Image CaptureControl(Control ctrl){System.Drawing.Bitmap bmp new System.Drawing.Bitmap(ctrl.Width, ctrl.Height);ctrl.DrawToBitmap(bmp, new Rectangle(0, 0, ctrl.Width, ctrl.Height));return bmp;}private void DownLoad(){string filePa…

java类中运行main方法时报错:找不到或无法加载主类 XXX

运行main类报了这个错 错误: 找不到或无法加载主类 XXX 经过好一番查证才找出了问题所在 原因是 maven项目的provided导致的&#xff0c;现在记录一下。 将pom.xml中标注provided的注释掉&#xff0c;就不报错了。

ERROR [internal] load metadata for docker.io/library/node:20-alpine

docker编译时报错&#xff0c;除标题外&#xff0c;还报如下信息 ERROR: failed to solve: node:20-alpine: failed to resolve source metadata for docker.io/library/node:20-alpine: failed to do request: Head "https://registry-1.docker.io/v2/library/node/mani…

常用个人信息

目录 常用联系方式我的自动思维常用媒体专业相关康米相关黑历史 常用联系方式 QQ&#xff1a;2868679921 微信&#xff1a;Commieee 邮箱&#xff1a;sharvefoxmail.com 我的自动思维 常用媒体 哔哩哔哩 专业相关 博客 康米相关 QQ&#xff1a;1203361015 黑历史 贴吧…

PyQt5学习系列之QMetaObject.connectSlotsByName

文章目录 前言一、pandas是什么&#xff1f;二、使用步骤 1.引入库2.读入数据总结 学习记录 QMetaObject.connectSlotsByName——自动将信号连接到槽&#xff08;函数&#xff09; 例如&#xff1a; from PyQt5.QtWidgets import QMainWindow, QPushButton from PyQt5.QtCore…

哪些类型的产品适合用3D形式展示?

随着3D技术的蓬勃发展&#xff0c;众多品牌和企业纷纷投身3D数字化浪潮&#xff0c;将产品打造成逼真的3D模型进行展示&#xff0c;消费者可以更加直观地了解产品的特点和优势&#xff0c;从而做出更明智的购买决策。 哪些产品适合3D交互展示&#xff1f; 产品3D交互展示具有直…

2024系统架构师--- 希赛模拟答案知识点

案例第一题&#xff1a; MVC架构包含&#xff1a;视图、控制器、模型&#xff1b; 视图&#xff08;View&#xff09;&#xff1a;视图是用户看到并与之交互的界面。视图面向用户显示相关的数据&#xff0c;并能接收用户的输入数据&#xff0c;但是它并不能进行任何实际的业务…

深入探索微软Edge:领略新一代浏览器的无限可能

深入探索微软Edge&#xff1a;领略新一代浏览器的无限可能 在当今数字化时代&#xff0c;网络浏览器已经成为我们日常生活中不可或缺的一部分。而随着技术的不断进步&#xff0c;浏览器的功能和性能也在不断提升。微软Edge作为微软推出的全新一代浏览器&#xff0c;引领着浏览…

自己手写一个字符串【C风格】

//字符串的常见操作 #include <iostream>#define MAX_SIZE 15 #define OK 1 #define ERROR 0 #define TRUE 1 #define FALSE 0 typedef int Status;//状态类型 typedef char ElemType;//元素类型typedef ElemType String[MAX_SIZE 1];//第一个字节记录长度//***tring是数…

c#自动生成缺陷图像-添加新功能(可从xml直接提取目标数据,然后进行数据离线增强)--20240524

在进行深度学习时,数据集十分重要,尤其是负样本数据。 故设计该软件进行深度学习数据预处理,最大可能性获取较多的模拟工业现场负样本数据集。 该软件基于VS2015、.NETFrameWork4.7.2、OpenCvSharp1.0.0.0、netstandard2.0.0.0、SunnyUI3.2.9.0、SunnyUI.Common3.2.9.0及Ope…

C盘磁盘空间不够用,怎样将d盘的空间划分给c盘?

C盘磁盘空间不够用&#xff0c;怎样将d盘的空间划分给c盘&#xff1f; 背景&#xff1a;win10系统下。C盘原有50G&#xff0c;如今只剩下8G&#xff0c;已经捉襟见肘了&#xff0c;想从D盘&#xff0c;割100G给C盘&#xff0c;以后软件能直接装C盘了。操作步骤如下&#xff1a…

2024年人文艺术与创新教育国际学术会议(ICHAIE 2024)

2024年人文艺术与创新教育国际学术会议&#xff08;ICHAIE 2024) 2024 International Conference on Humanities, Arts and Innovation Education 一、【会议简介】 随着全球化的推进和科技的迅猛发展&#xff0c;人文艺术与创新教育在培养未来人才方面扮演着越来越重要的角色…

温故而知新-导航【面试复习】

温故而知新-导航【面试复习】 前言版权温故而知新-导航【面试复习】最后 前言 2024-5-18 00:01:31 以下内容源自《【温故而知新】【面试复习】》 仅供学习交流使用 版权 禁止其他平台发布时删除以下此话 本文首次发布于CSDN平台 作者是CSDN日星月云 博客主页是https://jsss…