- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一直在我的 spring boot 应用程序上使用 HikariCP,我开始使用 JMeter 进行一些负载测试。
我注意到我第一次运行测试时一切顺利,每个请求大约需要 30 毫秒。
但是每次我针对同一个应用程序实例再次运行我的测试时,响应时间都会变得更糟,直到它卡住并且我得到一大堆
Caused by: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30019ms.
at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:583)
at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:186)
at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:145)
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
at sun.reflect.GeneratedMethodAccessor501.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.bull.javamelody.JdbcWrapper$3.invoke(JdbcWrapper.java:805)
at net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(JdbcWrapper.java:286)
at com.sun.proxy.$Proxy102.getConnection(Unknown Source)
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:246)
... 108 common frames omitted
我什至让应用程序闲置一天并再次尝试,但测试显示性能下降和相同的错误。
只有当我关闭应用程序时,它才能再次运行我的测试,但只有一次负载(1200 多个请求)。
当我开发测试时,我使用 H2 数据库运行我的本地应用程序,直到我将我的应用程序部署到运行 postgresql 的服务器上时才注意到任何性能下降。
因此,为了消除该变量,我让 JMeter 在我的本地 H2 应用程序上运行,结果显示性能下降。
这是我在本地应用程序(H2 数据库)上运行的测试场景,默认 HikariCP 轮询大小 (10),使用 10 个线程。在应用程序停止响应之前,我设法运行了 25000 多个请求。
我绘制了请求:
此外,测试包括对 Spring Boot @RestController
的请求。
我的 Controller 调用了一个以@Transactional
开头的服务(我调用了一些需要事务存在的遗留API,所以我马上打开它)。
假设我有 10 次并行请求此端点的测试。还假设我的代码可能有其他点用 @Transactional
注释。投票规模为 10 是否足够?
此外,尽管性能不佳,任何轮询大小都应该足够吗,或者出现这种轮询太忙和“锁定”的情况是否“正常”?
我也尝试将轮询大小增加到 50,但问题仍然存在。它接近之前测试的 25000 个请求(轮询大小为 10),但如前所述失败了。
最佳答案
HikariCP 建议使用一个恒定大小的小型池,其中充满了等待连接的线程。 As per the docs the suggested pool size :
connections = ((core_count * 2) + effective_spindle_count)
A formula which has held up pretty well across a lot of benchmarks for years is that for optimal throughput the number of active connections should be somewhere near ((core_count * 2) + effective_spindle_count). Core count should not include HT threads, even if hyperthreading is enabled. Effective spindle count is zero if the active data set is fully cached, and approaches the actual number of spindles as the cache hit rate falls. ... There hasn't been any analysis so far regarding how well the formula works with SSDs.
具有小型数据集的内存中 H2 将比在不同服务器上运行的独立数据库更快。即使您在同一个数据中心运行,服务器之间的往返时间通常约为 0.5-1 毫秒。
首先尝试找到当前的瓶颈。如果应用程序服务器没有用完 CPU,那么问题出在其他地方,例如数据库服务器。如果您无法弄清楚当前的瓶颈在哪里,您最终可能会在错误的地方进行优化。
关于java - HikariCP - 负载测试使性能下降到停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50722046/
在 Web 应用程序架构设计期间,我必须从概念上计算我的服务器之一可以服务多少个当前客户端。然后我可以预算它。 那么,有什么公式可以遵循吗?或者,你如何计算这个?或者,通常,一个 httpd/tomc
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找书籍、工具、软件库、教程或其他场外资源的问题对于 Stack Overflow 来说是
我正在使用 Angular 5,我正在尝试在加载 div 的背景图像时获取加载图标。 如果它是一个普通的 img,我对此没有问题,但如果我尝试将它作为背景,它就不起作用。 这里是一些示例代码 app.
我们怎么知道我们的程序在 CPU 上有多少负载? 我尝试使用 htop 找到它。但是 htop 不会给 cpu 负载。它实际上给出了我程序的 cpu 利用率(使用 pid)。 我正在使用 C 编程,L
我们发现从Spark 1.3到当前的Spark 2.0.1以来,从Oracle数据库使用Spark的API加载数据一直很慢。典型的代码在Java中是这样的: Map options =
我有时会收到 mnesia overloaded主要使用时的错误消息 async_dirty查询和 ram_copies表。所以为了了解发生了什么,我想获得更多关于 mnesia 状态的信息,例如每秒
对于通常使用很少 CPU 的程序来说,内核 CPU 非常高。 Linux 机器在状态之间交替。大多数时候,程序使用低 CPU 正常执行。在 CPU“激增”期间,程序使用 100% 可用 CPU 使用高
我正在使用 Raspberry Pi 2 来路由 wifi-eth 连接。因此,从 eth 方面来看,我有一台可以使用 Pi wifi 连接到互联网的计算机。在 Raspberry 上我启动 htop
基本上我有一个网页,其中有一个 iframe 可以从不同的域加载另一个网页。它移动得很慢,我想证明整个页面很慢只是因为 iframe 内的页面。 有什么方法可以测量总页面负载以及总页面负载中有多少%来
我们有一个基于 Spring 的应用程序,它充当使用其他 Rest API 的编排层。我只想测试这个组件的性能,而不测试正在使用的下游 api。 我正在寻找有关如何完成此操作的任何架构建议? 当前的方
我正在学习 hibernate 。为了进行测试,我使用无效 key 调用了 session.load 。当我在调试器(JB Idea)中跨过该行后,没有任何反应 - 我预计会得到 ObjectNotF
我正在开发一个小型的待办事项 PHP 应用程序。我正在使用 jQuery 构建 HTML。其中一个是一个按钮,用于启动一个模式,允许用户编辑该项目。我很好奇加载数据时更好的方法是什么: 1) 在初始加
我尝试在 twitch 播放器中使用 angular 作为覆盖标记。 我将 ng-repear 与(键,值)结合使用。 //player is here 设置是一个全局对象。但是当我尝试加载页面
我即将了解 C 语言中的特定进程如何在特定时间范围内加载 CPU。该进程可能会在运行时切换处理器核心,因此我也需要处理这个问题。 CPU为ARM处理器。 我研究了从标准顶部获取负载的不同方法,perf
这个问题在这里已经有了答案: XMLHttpRequest Origin null is not allowed Access-Control-Allow-Origin for file:/// t
您好,我正在用 Java 开发负载平衡算法。在我的系统中将有一个主节点和 n 个从节点。主节点将接收查询分发给它的从节点。但是在将查询分发到其从节点之一之前,我想测量从节点中的当前负载,以检查特定从节
我正在渲染由大约 50 万个三角形组成的相当重的对象。我使用 opengl 显示列表,在渲染方法中只调用 glCallList。我认为一旦图形基元被编译成显示列表,cpu 的工作就完成了,它只是告诉
我正在尝试加密 Sipdroid,为此我必须在 RTP 数据包获得编码的音频负载后对其进行加密。我在 RTP 数据包类中使用这个函数: public byte[] getPayload() {
我正在尝试解析以下 JSON 负载: { "results":[ [ 298.648132, 280.68692, 356.54
在动画期间 cpu 负载非常高(高达 75%) 是否有优化代码以降低 CPU 负载的方法? 我的代码: ImageView myImageView = (ImageView)findViewById(
我是一名优秀的程序员,十分优秀!