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

网站网址和域名/b2b免费发布信息网站

网站网址和域名,b2b免费发布信息网站,专业定制网站建设智能优化,网站域名和网站urlMySQL - Why Do We Need a Thread Pool? - mysql8.0 本文主要由于上次写的感觉又长又臭, 感觉学习方法有问题, 我们这次直接找来了 thread pool 的原文,一起来看看官方的开发者给出的blog – 感觉是个大神 但是好像不是最官方的 &#xff0c…

MySQL - Why Do We Need a Thread Pool? - mysql8.0

本文主要由于上次写的感觉又长又臭, 感觉学习方法有问题, 我们这次直接找来了 thread pool 的原文,一起来看看官方的开发者给出的blog – 感觉是个大神 但是好像不是最官方的 ,所以我们还是带着批判性的思维去看;即使是最官方的也一样哈

and 多逼逼一句,学一个技术最好去官网

参考博客:

https://dev.mysql.com/blog-archive/the-new-mysql-thread-pool/

part 1 对原文的总结和梳理

The New MySQL Thread Pool

Posted on Jun 7, 2023 by [Daniel Blanchard](https://dev.mysql.com/blog-archive/?author=Daniel Blanchard)
Category: [Thread Pool](https://dev.mysql.com/blog-archive/?cat=Thread Pool)
Tags: [thread pool](https://dev.mysql.com/blog-archive/?tag=thread pool)

Preface

This blog begins by introducing an alternative and optional thread handling mechanism called MySQL Thread Pool, available in the MySQL Enterprise Edition. It then delves into the “Max Transaction Limit” feature that was added to MySQL Thread Pool in MySQL 8.0. The blog shows the recommended MySQL Thread pool configuration and proceeds to compare the performance of MySQL Thread Pool using the Max Transaction Limit feature against the default thread handling mechanism in MySQL using the recommended configuration. Some advice on tuning the configuration is then given, followed by some of the caveats associated with the Max Transaction Limit feature.

关键点总结:

  • 叫mysql thread pool - 企业级的
  • 版本 - 8 和特性 - 最大事务限制
  • 配置信息 和性能对比

Introduction

The MySQL Thread Pool is an alternative and optional thread handling mechanism that is available in the MySQL Enterprise Edition. It is implemented as a server plugin but is not enabled by default. By default, the MySQL server utilizes the default connection handling mechanism.

MySQL has a default connection handling model called “one-thread-per-connection.” In this model, when a user connects to the server, a dedicated OS thread is created for the connection. This thread executes all the queries from the user and sends back results until the user disconnects. However, as more users connect to the MySQL server, more OS threads are created and executed in parallel. Eventually, a limit is reached where adding more threads becomes inefficient. And in a highly concurrent environment, as the number of connections increases, the overall performance of MySQL degrades. A thread executes instructions until it needs to wait for something or until it has used up its time-slice provided by the OS scheduler. There are three things a thread might need to wait for: mutexes, database object locks, and IO. As the number of threads increase, even the CPU cache can become overwhelmed.

The MySQL Thread Pool serves as a solution to address the limitations of the default connection handling mechanism. The original design of the thread pool addressed the needs of MySQL 5.6, but as the MySQL server locking structures and algorithms have been improved over time the additional benefits provided by the original thread pool design have been reduced. The Max Transaction Limit feature in the MySQL 8.0 thread pool revitalizes the thread pool as a customer tool.

关键点总结:

  • 传统的是什么 - 一客户端 一线程创造
  • 一个线程一生需要等待三件事情(高考 - 结婚- 生孩子。。。。 Just Kiding)
  • 总之, 线程太累了,要罢工;how to use 牛马 properly ?
  • 算法和锁结构的变化 , 5.6 那个过时了, 不过没说为啥,看后面

MySQL Thread Pool

The MySQL Thread Pool introduces a separation between user connections and threads. Unlike the previous model, each user connection no longer has its own dedicated OS thread to execute statements. Instead, the Thread Pool is composed of Thread Groups, with a default of 16 Thread Groups. User connection is assigned to Thread Group in a round-robin fashion. Each Thread Group manages a subset of user connections. Within each Thread Group, there are one or more threads responsible for executing queries received from the user connection assigned to that Thread Group.

By default, the thread pool aims to ensure that only the configured number of threads (by default only one) are executing within a Thread Group. However, in order to achieve optimal performance, the thread pool may optionally permit more threads to execute within a Thread Group.

The following figure illustrates MySQL client connection to a MySQL server with Thread Pool model
在这里插入图片描述

  • Clients: A MySQL client is a command line tool or application API that communicates with MySQL server over the MySQL client-server protocol.
  • Connection Request: A connect request from a client sent to the MySQL server.
  • Receiver Thread: Incoming connection requests are queued and processed by the receiver thread one by one. The receiver thread assigns a Thread Group to a connection in a round-robin fashion.
  • Query Worker Threads: Threads in a Thread Group that executes user queries.
  • THD: A thread context data structure created for each user connection.

The thread pool is specifically designed to prevent performance degradation as the number of user connections grows. The introduction of the “Max Transaction Limit” feature to the Thread Pool in MySQL 8.0 provides a way of limiting the number of transactions that are allowed to execute concurrently. On a heavily loaded system, limiting the number of concurrent transactions improves the overall throughput of the server by limiting the number of concurrent data locks and reducing the occurrence of deadlocks.

关键点总结:

  • 线程组的概念 - 16个
  • 轮训算法 - receiver
  • 线程组对于客户端连接的管理- subject 的概念
  • 结构:1个线程池 - 16 个线程组 - 默认 1 线程(一般为了性能会分配更多线程)
  • THD 这里有点不好理解, 单独说下 - 是一个用于存储与每个用户连接相关的信息的结构。每当一个用户连接到MySQL数据库时,系统会为该连接创建一个THD结构体,包含该连接的上下文数据,如连接的状态、执行的查询、事务信息等。THD的作用是将每个用户的连接独立开来,使得每个线程可以处理不同用户的请求,而不会相互干扰。每个连接的查询在其独立的上下文中执行,从而支持高并发的操作。
  • 独特之处在于限制了 事务

Max Transaction Limit

In a highly concurrent environment, apart from having to deal with excessive connections and threads, the MySQL server may also face the challenge of handling an excessive number of concurrent transactions. Each transaction typically holds locks on tables and rows until it is committed or rolled back.

在对于时间要求极高的坏境中, 分开处理链接和线程, mysql服务器可能会面对处理高度集中的事务并发的挑战, 每一个事务典型地锁着表和行直到事务被提交或者回滚

When the system tries to handle more concurrent transactions than it can effectively manage, the system can appear to stop responding as transactions wait longer and longer for these locks. Consequently, the overall throughput (TPS) of the server decreases.

当系统尝试处理比有限管理更多的并发线程,系统将会停止响应,因为事务等待过长的时间 for these locks ; 最后, 总体的服务器的tps将会下降

The Max Transaction Limit feature efficiently controls the number of concurrently executing transactions. It is enabled by setting a non-zero value to the system variable, thread_pool_max_transactions_limit. A non-zero value N indicates that the thread pool will not have more than N transactions concurrently executing at any given time. When the Max Transaction Feature is enabled, The Max Transaction Limit can be changed dynamically without needing to restart the MySQL server. (Changing the Max Transaction Limit from a zero value to a non-zero value does, however, require the MySQL server to be restarted.)

最大事务限制特性有效地控制了并发线程执行数量,它由非零的系统参数 - thread_pool_max_transactions_limit 而启动; 一个非零参数N 代表着线程池将不会拥有更多的事务并行在接下的时间; 当最大事务特性启动的时候,最大事务限制 将会动态改变,而不需要服务器重启(改变最大事务限制的值,从0 改到到另一个非零值,需要mysql服务器重启)

When this feature is enabled, each thread group can execute a maximum of "thread_pool_max_transactions_limit divided by number of thread groups (thread_pool_size) " transactions concurrently. After executing a statement, the query worker thread selects the next statement from the same transaction (rather than picking a statement from a different connection’s queue) to expedite transaction execution until the transaction is either committed or rolled back.

当这个功能被启动时, 每一个线程组都可以执行一个最大的 (全局最大事务限制 除以 线程组数量- 线程池的size)并发事务数;执行完后, query worker 线程从同样的事务中选择出下一个statement ,(而不是从不同的连接请求中选择)去加速事务执行直到该事务被提交或者回滚

Note that as the Max Transaction Limit is divided equally amongst the thread groups, the Max Transaction Limit should be a multiple of the thread pool size. If the configured value for Max Transaction Limit is not a multiple of the thread pool size, i.e. the transaction limit per thread group thread_pool_max_transactions_limit divided by number of thread groups (thread_pool_size) is not an integer, this value is rounded up to the nearest integer.

值得注意的是,最大事务限制数倍线程组均分, 因此最大事务限制数应该是 线程组的整数倍, 如果不是的话, 每个线程组得到一个非整数会执行向上取整 - be rounded up

关键点总结:

  • Max-transaction-limit 动态调整(只有0 - 非零需要重启服务器)

Recommended Configuration for Thread Pool in MySQL 8.0

The following is the recommended initial configuration for the thread pool

thread_pool_size#physical_cores, max 512
thread_pool_max_transaction_limit#physical_cores * 32, max 512
thread_pool_algorithm1 (high concurrency algorithm)
thread_pool_query_worker_threads_per_group2

总结表格信息:

  • 物理核心 * 32 = 最大事务控制限制
  • 算法 - 模糊的不清晰的
  • 每个线程组 负责2个 worker-threads

This configuration can be further tuned according to the specific load requirements to achieve even better performance.

Let’s compare the performance results of testing the thread pool using the Max Transaction Limit against the default thread handling mechanism. The MySQL thread pool configuration should be tuned depending on load to achieve the best performance for a given load, but the following results are obtained with the generic recommended configuration.

  • The following graph compares the results of TPCC-100W (10 GB data) on a server using the default thread handling model with results on a server utilizing the Thread Pool and Max Transaction Limit feature.

补充细节:

Spcc-100w :standard for evaluating the performance of database management systems.

100W in TPCC-100W

​ • The 100W means 100 warehouses, where each warehouse represents a specific amount of data.

​ • Each warehouse in the TPC-C benchmark is typically around 100 MB of data.

​ • For TPCC-100W, this translates to 10 GB of total data (100 warehouses × 100 MB per warehouse).

​ • Metrics include throughput (transactions per minute) and latency.

System Configuration:Thread Pool Configuration:
Processor48cores-HT Intel® Xeon® Platinum 8268 CPU @ 2.90GHz.thread_pool_size(thread-group)48
RAM192GBthread_pool_max_transaction_limit512
StorageNVMe Optane 2 x 375 GBthread_pool_algorithm1 (high concurrency algorithm)
OSOL7.9 UEK6thread_pool_query_worker_threads_per_group2
MySQL Version8.0.34
OpenSSL Version1.1.1

在这里插入图片描述

When utilizing MySQL thread pool, the rate of performance decline is much lower (better!) with a higher number of user connections compared to the rate of performance decline observed with the default connection handling. The default connection handling mechanism shows a decline in transactions per second after reaching 512 user connections, processing approximately 2000 transactions per second only above 4096 user connections. However, with the MySQL thread pool, good performance is maintained even with a higher number of user connections, allowing for the processing of around 17000 transactions per second above 4096 user connections. These results highlight the role of the MySQL thread pool in maintaining a higher level of performance when handling a larger number of concurrent connections.

当我们使用mysql线程池的时候, 与常规的连接处理方法相比, 即使有更高的用户连接数,但是表现率降低的更低。 默认的连接处理方法表现出每秒事务处理数量的降低, 当用户连接数到达512个的时候,当超过4096个用户连接的时候,仅仅能处理大约2000个事务/second 。 然而,使用线程池后, 较好的表现能力会被维持即使在更高的用户连接数量,允许处理大约17000个事务每秒,超过4096个事务的连接。这些结果强调了mysql 线程池的重要性,在被压测后, 维持更高的表现能力上面

关键点:

  • 4096 transactions
  • 512 connections of users

Tuning advice

The recommended configuration is a reasonable place to start. The configuration that produces the best performance for a specific workload will depend upon the workload itself. Fortunately, the Max Transaction Limit can be varied dynamically, without having to restart the server. Increase or decrease the value from this starting point whilst running a similar workload to that which you expect to encounter in production and compare that system throughput for different values of Max Transaction Limit. A reasonable upper bound for the Max Transaction Limit whilst testing is the maximum number of concurrent connections that you expect your system to have to handle (you may find it useful to consult the status variable Max_used_connections, as this variable records the maximum number of connections that have been in use simultaneously since the server started). Whilst tuning, you may find it useful to start the Max Transaction limit at this upper bound value and then adjust it downwards from this value whilst observing the effect on the throughput of your test workload.

推荐的配置是一个合理的起点。针对特定工作负载产生最佳性能的配置将取决于工作负载本身。幸运的是,最大事务限制(Max Transaction Limit)可以动态调整,无需重启服务器。在运行类似于生产环境中预期遇到的工作负载时,可以从这个起始值开始增大或减小最大事务限制,并比较系统在不同最大事务限制值下的吞吐量。

在测试期间,一个合理的最大事务限制上限是您期望系统需要处理的最大并发连接数(您可能会发现参考状态变量 Max_used_connections 很有用,因为该变量记录了自服务器启动以来同时使用的最大连接数)。在调优时,您可能会发现从这个上限值开始设置最大事务限制是有用的,然后逐步降低该值,同时观察测试工作负载的吞吐量变化。

The product of thread_pool_size and thread_pool_query_worker_threads_per_group is (roughly) the number of threads that will be available to process queries, and generally you will be compromising between having a low thread_pool_size with higher thread_pool_query_worker_threads_per_group or a higher thread_pool_size with a lower thread_pool_query_worker_threads_per_group.

thread_pool_size 和 thread_pool_query_worker_threads_per_group 的乘积(大致)是可用于处理查询的线程数。通常,需要在 较低的 thread_pool_size 和较高的 thread_pool_query_worker_threads_per_group 与 较高的 thread_pool_size 和较低的 thread_pool_query_worker_threads_per_group 之间进行权衡。

The advantage of a higher thread_pool_query_worker_threads_per_group value is that it is less likely that all the threads in the thread group are simultaneously executing long running queries whilst blocking a shorter query (when your workload involves a mix of long running and short running queries). However, the overhead of the connection polling operation for each thread group increases when using a smaller thread_pool_size with a higher thread_pool_query_worker_threads_per_group value. Note that setting thread_pool_query_worker_threads_per_group less than 2 is very unlikely to improve performance.

较高的 thread_pool_query_worker_threads_per_group 值的优点是:当工作负载包含长时间运行和短时间运行的查询混合时,不太可能所有线程组中的线程同时执行长时间运行的查询,从而阻塞短查询的执行。然而,当使用较小的 thread_pool_size 和较高的 thread_pool_query_worker_threads_per_group 值时,每个线程组的连接轮询操作开销会增加。需要注意的是,将 thread_pool_query_worker_threads_per_group 设置为小于 2 的值很可能无法改善性能。

The sysbench OLTP_RW performance data shown provides an example of tuning the Max Transaction Limit value. In this example, the default thread handling model performance peaks at 64 concurrent users, so a Max Transaction Limit of 64 is chosen for this load.

  • The following graph compares the results of Sysbench OLTP_RW 80 million rows in 1 table with a pareto access pattern (20 GB data) on a server using the default thread handling model with results on a server utilizing the Thread Pool and Max Transaction Limit feature. Note that using the pareto access pattern results in frequent access of a limited set of rows, leading to an increasing contention for data locks as the number of concurrent users increases.

Sysbench OLTP_RW 性能调优示例:

显示的 Sysbench OLTP_RW 性能数据提供了调优 Max Transaction Limit 值的一个例子。在此例中,默认线程处理模型的性能在 64 个并发用户 时达到峰值,因此对于该负载选择了 64 的 Max Transaction Limit

关于对比图:

以下图表比较了使用默认线程处理模型的服务器与使用线程池和 Max Transaction Limit 特性的服务器在运行 Sysbench OLTP_RW 测试时的结果。测试数据为 1 张表包含 8000 万行(20 GB 数据),访问模式为 Pareto 分布

需要注意的是,使用 Pareto 访问模式 会导致频繁访问一小部分行数据,随着并发用户数量的增加,这种访问模式会导致数据锁的争用不断增加。

System Configuration:Thread Pool Configuration:
Processor48cores-HT Intel® Xeon® Platinum 8268 CPU @ 2.90GHz.thread_pool_size32
RAM192GBthread_pool_max_transaction_limit64
StorageNVMe Optane 2 x 375 GBthread_pool_algorithm1 (high concurrency algorithm)
OSOL7.9 UEK6thread_pool_query_worker_threads_per_group2
MySQL Version8.0.34
OpenSSL Version1.1.1

在这里插入图片描述

When utilizing MySQL thread pool, performance is maintained with a higher number of user connections. In contrast, the default connection handling mechanism shows a decline in transactions per second after reaching 64 user connections, processing approximately only 900 transactions per second from 4096 user connections onwards. However, with the MySQL thread pool, performance is maintained even with a higher number of user connections, allowing for the processing of around 7000 transactions per second above 4096 user connections. These results demonstrate performance being maintained by the MySQL thread pool when handling a larger number of concurrent connections.

Max Transaction Limit Caveats

The Max Transaction Limit feature sets a hard limit on the maximum number of concurrent transactions/threads that can be executed. While it provides better performance, it also comes with certain caveats.

  1. When the maximum number of transactions are executing concurrently, new connections and transactions/queries must wait until existing transactions are completed. No new threads are created to handle new requests. If all concurrent transactions consist of long-running queries, it may appear as if the MySQL system is stalled. To mitigate this issue, bypass the “Max Transaction Limit” using user connections with the “TP_ADMIN” privilege. Such privileged connections can be used to dynamically adjust the “Max Transaction Limit” or terminate one or more blocking queries to allow normal traffic to resume.
  2. In the MySQL Thread Pool, each thread group can execute a maximum of thread_pool_max_transactions_limit divided by number of thread groups transactions concurrently. When this limit is reached due to long-running queries within a thread group, new connections and transactions/queries are put on hold until existing transactions are completed. It’s important to note that new connections and transactions in such Thread Groups are not handled, even if the number of running transactions is lower than the Max Transaction Limit.

Note that when the Max Transaction Limit is in use on a system with multiple independent databases, queries against one database can be slowed down by queries against another database when the maximum number of concurrent transactions is reached. For many systems this scenario is not a concern, but it can be useful to be aware of this behaviour. On encountering this situation, a workaround is to (possibly temporarily) increase the Max Transaction Limit value (which can be done without restarting the server). Setting the Maximum Transaction Limit equal to the max_connections value removes the effect of the Maximum Transaction Limit feature but leaves it enabled so that its value can be modified subsequently without needing to restart the server.

最大事务限制功能(Max Transaction Limit) 设置了可执行的最大并发事务/线程的硬性上限。虽然该功能提供了更好的性能,但也存在一些注意事项:

​ 1. 当最大事务数量同时执行时,新的连接和事务/查询必须等待现有事务完成。不会创建新线程来处理新请求。如果所有并发事务都由长时间运行的查询组成,MySQL 系统可能看起来像是停滞状态。为缓解此问题,可以使用具有 “TP_ADMIN” 权限的用户连接绕过 “Max Transaction Limit”。这种特权连接可用于动态调整 “Max Transaction Limit” 或终止一个或多个阻塞查询,从而恢复正常流量。

​ 2. 在 MySQL 线程池中,每个线程组最多可同时执行 thread_pool_max_transactions_limit 除以线程组数量 的事务。当某个线程组由于长时间运行的查询达到该限制时,新的连接和事务/查询将被搁置,直到现有事务完成。需要注意的是,即使运行中的事务总数低于 “Max Transaction Limit”,这些线程组中的新连接和事务仍可能无法得到处理。

​ 3. 当系统包含多个独立数据库时,当达到最大并发事务数时,一个数据库的查询可能会因另一个数据库的查询而变慢。对许多系统来说,这种情况不成问题,但了解这种行为仍然很有帮助。遇到这种情况时,可以通过(可能是临时的)增加 “Max Transaction Limit” 的值来解决(无需重启服务器即可完成调整)。将 “Max Transaction Limit” 设置为 max_connections 的值,可以消除最大事务限制功能的影响,但仍然保留该功能,使其可以在无需重启服务器的情况下进行后续调整。

Conclusion

Overall, the new MySQL Thread Pool provides substantial protection against performance degradation for MySQL servers handling highly concurrent systems with many concurrent transactions. By efficiently managing OS threads and transactions, utilizing the Max Transaction Limit feature, the MySQL Thread Pool preserves performance as the number of connections increases. It reduces resource contention, minimizes context switching, and optimizes CPU cache utilization. These optimizations result in improved overall performance and faster response times when under heavy load.
Customers running systems with many concurrent connections and high loads might encounter tipping points where the number transactions per second begins to drop as the load increases: this situation is where the thread pool and its Max Transaction Limit feature comes in handy to prevent the performance drop.

The following are some examples of scenarios encountered by customers where the new MySQL Thread Pool can be expected to improve upon previous levels of performance:

A customer currently in production typically has over 8000 persistent user connections. The server CPU usage generally remains under 50% since usually only a minority of the user connections are active. Problems arise when all (or just too many) user connections become active at once, creating a huge activity spike which dramatically slows the whole system, nearly bringing it down. Using the MySQL Thread Pool with a suitable Max Transaction Limit will protect the customer system from overload during such activity spikes and still allows the system to achieve the most efficient processing rate possible under these conditions.

Another customer with an online store encounters general periodic overload problems. The customer also encounters slow downs when running sales promotions on particular items as many concurrent updates are applied to the same small data set, resulting in long queues of queries fighting for various locks, wasting CPU cycles on lock spinning and creating additional system overload. This overload can also block or slow down other queries execution. Using the MySQL Thread Pool with a suitable Max Transaction Limit setting will be able to significantly lower system overload generally, and also brings overall system performance to the most efficient level possible.

总体而言,新的 MySQL 线程池为处理高并发事务的 MySQL 服务器提供了显著的性能退化保护。通过高效管理操作系统线程和事务,结合使用 Max Transaction Limit 功能,MySQL 线程池在连接数增加时能够保持性能稳定。它减少了资源争用,最小化了上下文切换,并优化了 CPU 缓存利用率。这些优化在高负载情况下提升了整体性能并加快了响应时间。

对于运行高并发连接和高负载系统的用户,可能会遇到随着负载增加每秒事务数开始下降的拐点:这种情况下,线程池及其 Max Transaction Limit 功能可有效防止性能下降。

以下是一些客户场景示例,展示了新的 MySQL 线程池如何在以前的性能水平上带来改进:

​ • 一位客户的生产环境中通常有超过 8000 个持久用户连接。由于通常只有少部分用户连接处于活跃状态,服务器的 CPU 使用率通常保持在 50% 以下。然而,当所有(或过多的)用户连接同时变为活跃时,会导致活动量激增,显著减慢整个系统的运行速度,几乎导致系统崩溃。使用 MySQL 线程池并设置合适的 Max Transaction Limit,可在此类活动峰值期间保护客户系统免受过载影响,并在这些条件下仍能实现最高效的处理速度。

​ • 另一位客户的在线商店经常遇到周期性的过载问题。在对特定商品进行促销时,许多并发更新作用于同一小数据集,导致查询排起长队争夺各种锁,占用 CPU 周期用于锁自旋,并造成额外的系统过载。这种过载还可能阻塞或减慢其他查询的执行。通过使用 MySQL 线程池并设置合适的 Max Transaction Limit,可以显著降低系统整体过载,同时使系统整体性能达到可能的最高效率水平。

References

  1. MySQL Thread Pool documentation: MySQL documentation provides detailed information on how to configure and use the Thread Pool plugin.

part 2 思考点

  • 学习英语的好机会,先脑子翻译,再机器翻译
  • 学习知识的好方法
  • 学习案例!!! – very nice

相关文章:

MySQL - Why Do We Need a Thread Pool? - mysql8.0

MySQL - Why Do We Need a Thread Pool? - mysql8.0 本文主要由于上次写的感觉又长又臭, 感觉学习方法有问题, 我们这次直接找来了 thread pool 的原文,一起来看看官方的开发者给出的blog – 感觉是个大神 但是好像不是最官方的 &#xff0c…...

Linux互斥量读写锁

一、互斥量 1.临界资源 同一时刻只允许一个进程/线程访问的共享资源(比如文件、外设打印机) 2.临界区 访问临界资源的代码 3.互斥机制 mutex互斥锁,用来避免临界资源的访问冲突,访问临界资源前申请互斥锁,访问完释放…...

网络安全之IP伪造

眼下非常多站点的涉及存在一些安全漏洞,黑客easy使用ip伪造、session劫持、xss攻击、session注入等手段危害站点安全。在纪录片《互联网之子》(建议搞IT的都要看下)中。亚伦斯沃茨(真实人物,神一般的存在)涉…...

ARM CCA机密计算安全模型之硬件强制安全

安全之安全(security)博客目录导读 [要求 R0004] Arm 强烈建议所有 CCA 实现都使用硬件强制的安全(CCA HES)。本文件其余部分假设系统启用了 CCA HES。 CCA HES 是一个可信子系统的租户——一个 CCA HES 主机(Host),见下图所示。它将以下监控安全域服务从应用处理元件(P…...

【论文笔记】A Token-level Contrastive Framework for Sign Language Translation

🍎个人主页:小嗷犬的个人主页 🍊个人网站:小嗷犬的技术小站 🥭个人信条:为天地立心,为生民立命,为往圣继绝学,为万世开太平。 基本信息 标题: A Token-level Contrastiv…...

C#窗体简单登录

创建一个Windows登录程序,创建两个窗体,一个用来登录,一个为欢迎窗体,要求输入用户名和密码(以个人的姓名和学号分别作为用户名和密码),点击【登录】按钮登录,登录成功后显示欢迎窗体…...

基于ZYNQ-7000系列的FPGA学习笔记3——开发环境搭建点亮一个LED

基于ZYNQ-7000系列的FPGA学习笔记3——开发环境搭建&点亮一个LED 1. 搭建开发环境2. FPGA的开发流程3. 点亮一个LED3.1 实验要求3.2 新建工程3.3 原理图3.4 绘制系统框图3.5 绘制波形图3.6 编写RTL代码3.7 软件仿真3.8 Vivado软件创建工程3.9 分析与综合3.10 设计实现 在上…...

队列-链式描述(C++)

定义 使用链表描述队列时,通常包含以下几个基本要素: 队头指针(Front Pointer):指向队列中第一个(即最早进入队列的)元素的节点。队尾指针(Rear Pointer):指…...

Kali Linux使用Netdiscover工具的详细教程

Kali Linux使用Netdiscover工具的详细教程 引言 在网络安全和渗透测试的过程中,网络发现是一个至关重要的步骤。Netdiscover是Kali Linux中一个非常实用的网络发现工具,它可以帮助用户快速识别局域网中的活动设备。本文将详细介绍如何使用Netdiscover工…...

arkTS:使用ArkUI实现用户信息的持久化管理与自动填充(PersistentStorage)

arkUI:使用ArkUI实现用户信息的持久化管理与自动填充(PersistentStorage) 1 主要内容说明2 例子2.1 登录页2.1.1登陆页的相关说明2.1.1.1 持久化存储的初始化2.1.1.2 输入框2.1.1.3 记住密码选项2.1.1.4 登录按钮的逻辑2.1.1.5 注册跳转 2.1.…...

IntelliJ+SpringBoot项目实战(二十)--基于SpringSecurity实现Oauth2服务端和客户端

在前面的帖子中介绍了SpringSecurityJWT实现了认证和授权的功能。因为基于Oauth2的统一认证在项目需求中越来越多,所以有必要将OAuth2的解决方案也整合进来,这样我们的产品既可以作为一个业务系统,也可以作为一个独立的统一认证服务器。下面详…...

如何实现剪裁功能

文章目录 1 概念介绍2 使用方法2.1 ClipOval2.2 ClipRRect3 示例代码我们在上一章回中介绍了AspectRatio Widget相关的内容,本章回中将介绍剪裁类组件(Clip).闲话休提,让我们一起Talk Flutter吧。 1 概念介绍 我们在这里说的剪裁类组件主要是指对子组件进行剪裁操作,常用的…...

LeetCode 动态规划 爬楼梯

爬楼梯 假设你正在爬楼梯。需要 n 阶你才能到达楼顶。 每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢? 示例 1: 输入:n 2 输出:2 解释:有两种方法可以爬到楼顶。 1 阶 1 阶 2 阶 示例 2&#xff…...

Java 工厂模式:深度解析与应用指南

在 Java 编程的广袤天地里,设计模式宛如璀璨星辰,照亮了开发者构建高效、灵活且可维护软件系统的道路。其中,工厂模式作为创建型设计模式的关键成员,在对象创建环节扮演着举足轻重的角色,极大地增强了代码的适应性与扩…...

HTML5系列(5)-- SVG 集成详解

前端技术探索系列:HTML5 SVG 集成详解 🎨 开篇寄语 👋 前端开发者们, 在前五篇文章中,我们探讨了 HTML5 的多个特性。今天,让我们深入了解 SVG 的魅力,看看如何创建可缩放的矢量图形。 一、…...

深度学习常见数据集处理方法

1、数据集格式转换&#xff08;json转txt&#xff09; import json import os 任务&#xff1a;实例分割&#xff0c;labelme的json文件, 转txt文件 Ultralytics YOLO format <class-index> <x1> <y1> <x2> <y2> ... <xn> <yn> # 类…...

1180 - 【入门】数字出现次数

题目描述 有50个数&#xff08;0-19&#xff09;&#xff0c;求这50个数中相同数字出现的最多次数为几次&#xff1f; 输入 50个数字 输出 1个数字&#xff08;即相同数字出现的最多次数&#xff09; 样例 输入 复制 1 10 2 0 15 8 12 7 0 3 15 0 15 18 16 7 17 16 9 …...

C++20: 像Python一样split字符串

概要 Python 的字符串天生支持 split( ) 操作&#xff0c;支持单个字符或字符串作为分隔符。 C 在这方面显得很笨拙&#xff0c;但是在 C20 下经过一番尝试&#xff0c;还是能够提供类似的简洁调用。 Python 代码 s 0,11,336,23,370nums s.split(,) for n in nums:print(n…...

Unity3D UI 嵌套滚动视图

Unity3D 解决 UI 嵌套滚动视图滑动问题。 嵌套滚动视图 滑动问题 在游戏开发中&#xff0c;我们常常会遇到一种情况&#xff0c;在一个滚动视图列表中&#xff0c;每个 item 还包含了一个内嵌的滚动视图。 这样&#xff0c;当我们在滑动外层的滚动视图时&#xff0c;如果点…...

你还没有将 Siri 接入GPT对话功能吗?

由于各种原因&#xff0c;国内ios用户目前无缘自带 AI 功能&#xff0c;但是这并不代表国内 ios 无法接入 AI 功能&#xff0c;接下来手把手带你为iPhone siri 接入 gpt 对话功能。 siri 接入 chatGPT 暂时还无法下载 ChatGPT app&#xff0c;或者没有账号的读者可以直接跳到…...

_C#_串口助手_字符串拼接缺失问题(未知原理)

最近使用WPF开发串口助手时&#xff0c;遇到一个很奇怪的问题&#xff0c;无论是主线程、异步还是多线程&#xff0c;当串口接收速度达到0.016s一次以上&#xff0c;就会发生字符串缺失问题并且很卡。而0.016s就一切如常&#xff0c;仿佛0.015s与0.016s是天堑之隔。 同一份代码…...

浅析大数据时代下的网络安全

一、大数据时代下网络安全的现状 在全球化进程不断深入发展的情况下&#xff0c;互联网行业发展速度也更加迅猛&#xff0c;人们对网络信息的需求量不断增加&#xff0c;所以目前已经进入了大数据时代。 随着计算机技术的不断发展&#xff0c;我国互联网网络规模、网民数量、…...

Mysql数据库基础篇笔记

目录 sql语句 DDL——数据库定义语言&#xff08;定义库&#xff0c;表&#xff0c;字段&#xff09; 数据库操作&#xff1a; 表操作&#xff1a; DML 增删改语句 DQL 语法编写顺序&#xff1a; 条件查询 DCL 用户管理&#xff1a; 权限管理&#xff1a; 函数 常见字符串内置函…...

rabbitmq原理及命令

目录 一、RabbitMQ原理1、交换机&#xff08;Exchange&#xff09;fanoutdirecttopicheaders&#xff08;很少用到&#xff09; 2、队列Queue3、Virtual Hosts4、基础对象 二、RabbitMQ的一些基本操作:1、用户管理2、用户角色3、vhost4、开启web管理接口5、批量删除队列 一、Ra…...

React进阶面试题(四)

React 的 reconciliation&#xff08;协调&#xff09;算法 Reconciliation是React的diff算法&#xff0c;用于比较更新前后的虚拟DOM树差异&#xff0c;从而使用最小的代价将原始DOM按照新的状态、属性进行更新。其目的是找出两棵树的差异&#xff0c;原生方式直接比较复杂度…...

24/12/1 算法笔记<强化学习> 创建Maze交互

我们今天制作一个栅格的游戏。 我们直接上代码教学。 1.载入库和查找相应的函数版本 import numpy as np import time import sysif sys.version_info.major 2:import Tkinter as tk else:import tkinter as tk 2.设置长宽和单元格大小 UNIT 40 MAZE_H 4 MAZE_W 4 3.初始…...

Linux驱动开发(10):I2C子系统–mpu6050驱动实验

本章我们以板载MPU6050为例讲解i2c驱动程序的编写&#xff0c;本章主要分为五部分内容。 第一部分&#xff0c;i2c基本知识&#xff0c;回忆i2c物理总线和基本通信协议。 第二部分&#xff0c;linux下的i2c驱动框架。 第三部分&#xff0c;i2c总线驱动代码拆解。 第四部分&a…...

《装甲车内气体检测“神器”:上海松柏 K-5S 电化学传感器模组详解》

《装甲车内气体检测“神器”:上海松柏 K-5S 电化学传感器模组详解》 一、引言二、K-5S 电化学传感器模组概述&#xff08;一&#xff09;产品简介&#xff08;二&#xff09;产品特点&#xff08;三&#xff09;产品适用场景 三、电化学传感器原理及优点&#xff08;一&#xf…...

如何将多个JS文件打包成一个JS文件?

文章目录 前言SDK 打包安装 webpack创建 webpack.config.js编译命令行遇到的坑点前言 上一篇已经记录了如何开发一个小游戏聚合SDK,既然是SDK,最终都是给外部人员使用的。调研了一下市面上的前端SDK,最终都是编译成一个 js 文件。我猜理由大概是 js 文件之间的调用都是需要…...

100个python经典面试题详解(新版)

应老粉要求,每晚加餐一个最新面试题 包括Python面试中常见的问题,涵盖列表、元组、字符串插值、比较操作符、装饰器、类与对象、函数调用方式、数据结构操作、序列化、数据处理函数等多个方面。 旨在帮助数据科学家和软件工程师准备面试或提升Python技能。 7、Python面试题…...