Jmeter瓶颈(Jmeter bottleneck)
我们有一个使用Jmeter测试的系统。 我们在Jmeter加速测试中遇到以下瓶颈:
症状:
- 我们每秒最多可以达到15个请求(rps)。
- 此限制是每个Java VM,而不是每台计算机。
- CPU不在极限,仅在ca. 30%。 该测试与请求一起进行了一些预处理和后处理,所以这可能是一个问题,但不是。
- 内存(带有3.5 GiB的计算机)在ca。 70% - 80%。 这足以让rps略高,所以这不是限制。
- 内存(JVM)已根据建议进行设置,并且对其进行了各种尝试,但没有任何改进。
- 我也检查了TCP连接,从“使用保持活动”变为“不使用保持活动”并没有改善任何东西(不是预期的)。
- 所有(!)断言都被关闭。
- 日志记录:仅记录响应时间,响应时间百分比,吞吐量和请求率,以及jmeter的标准表输出。
- 所有日志文件都保存到本地硬盘。
Jmeter通过jmeter.bat脚本启动,其中包含JVM的以下设置:
set HEAP=-Xms768m -Xmx768m -Xss128k set NEW=-XX:NewSize=256m -XX:MaxNewSize=256m set SURVIVOR=-XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=50% set TENURING=-XX:MaxTenuringThreshold=2 set RMIGC=-Dsun.rmi.dgc.client.gcInterval=600000 -Dsun.rmi.dgc.server.gcInterval=600000 set PERM=-XX:PermSize=256m -XX:MaxPermSize=256m set DUMP=-XX:+HeapDumpOnOutOfMemoryError set DDRAW= set ARGS=%DUMP% %HEAP% %NEW% %SURVIVOR% %TENURING% %RMIGC% %PERM% %DDRAW% %JM_START% %JM_LAUNCH% %ARGS% %JVM_ARGS% -jar "%JMETER_BIN%ApacheJMeter.jar" %JMETER_CMD_LINE_ARGS%
jmeter.properties具有以下内容:
language=en cookies=cookies xml.parser=org.apache.xerces.parsers.SAXParser jmeter.laf.mac=System jmeter.loggerpanel.maxlength=5000 not_in_menu=HTML Parameter Mask,HTTP User Parameter Modifier remote_hosts=127.0.0.1 log_level.jmeter=ERROR log_level.jmeter.junit=ERROR log_level.jorphan=WARN log_file='c:\\temp\\jmeter_'yyyyMMdd'.log' jmeter.save.saveservice.timestamp_format=yyyy/MM/dd HH:mm:ss jmeter.save.saveservice.base_prefix=~/ sampleresult.timestamp.start=true upgrade_properties=/bin/upgrade.properties HTTPResponse.parsers=htmlParser wmlParser htmlParser.types=text/html application/xhtml+xml application/xml text/xml wmlParser.className=org.apache.jmeter.protocol.http.parser.RegexpHTMLParser wmlParser.types=text/vnd.wap.wml summariser.interval=180 summariser.log=true summariser.out=true beanshell.server.file=../extras/startup.bsh time.YMDHMS=yyyyMMdd_HHmmss onload.expandtree=true view.results.tree.max_size=0 classfinder.functions.contain=.functions. classfinder.functions.notContain=.gui. user.properties=user.properties system.properties=system.properties
在
jmx
,指定了以下设置:<stringProp name="ThreadGroup.num_threads">300</stringProp> <stringProp name="ThreadGroup.ramp_time">0</stringProp> <stringProp name="ThreadGroup.ramp_time">0</stringProp> <longProp name="ThreadGroup.start_time">1404986400000</longProp> <longProp name="ThreadGroup.end_time">1404990000000</longProp> <boolProp name="ThreadGroup.scheduler">false</boolProp> <stringProp name="ThreadGroup.duration">3600</stringProp> <stringProp name="ThreadGroup.delay"></stringProp> <boolProp name="ThreadGroup.delayedStart">true</boolProp>
问题 :瓶颈在哪里,我们如何摆脱它?
We have a system which we are testing using Jmeter. We experience the following bottleneck in our Jmeter ramp-up test:
Symptoms:
- We reach a maximum of 15 requests per second (rps).
- This limit is per Java VM, not per computer.
- CPU is not at its limit, only at ca. 30%. The test does quite some pre- and post-processing together with the requests, so this could have been a problem, but isn’t.
- Memory (computer with 3.5 GiB) is at ca. 70% - 80%. This is sufficient to go somewhat higher with the rps, so this is not the limit.
- Memory (JVM) has been set according to the recommendations, and also been varied to experiment with it, but no improvement.
- I also checked the TCP connections, a change from “use keep-alive” to “don’t use keep-alive” hasn’t improved anything (was not to be expected).
- All(!) assertions are switched off.
- Logging: Only response times, response times percentiles, throughput, and request rate are logged, together with the standard table output of jmeter.
- All log files are saved to the local hard disk.
Jmeter is started over a jmeter.bat script with thefollowing settings for the JVM:
set HEAP=-Xms768m -Xmx768m -Xss128k set NEW=-XX:NewSize=256m -XX:MaxNewSize=256m set SURVIVOR=-XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=50% set TENURING=-XX:MaxTenuringThreshold=2 set RMIGC=-Dsun.rmi.dgc.client.gcInterval=600000 -Dsun.rmi.dgc.server.gcInterval=600000 set PERM=-XX:PermSize=256m -XX:MaxPermSize=256m set DUMP=-XX:+HeapDumpOnOutOfMemoryError set DDRAW= set ARGS=%DUMP% %HEAP% %NEW% %SURVIVOR% %TENURING% %RMIGC% %PERM% %DDRAW% %JM_START% %JM_LAUNCH% %ARGS% %JVM_ARGS% -jar "%JMETER_BIN%ApacheJMeter.jar" %JMETER_CMD_LINE_ARGS%
jmeter.properties has the following content:
language=en cookies=cookies xml.parser=org.apache.xerces.parsers.SAXParser jmeter.laf.mac=System jmeter.loggerpanel.maxlength=5000 not_in_menu=HTML Parameter Mask,HTTP User Parameter Modifier remote_hosts=127.0.0.1 log_level.jmeter=ERROR log_level.jmeter.junit=ERROR log_level.jorphan=WARN log_file='c:\\temp\\jmeter_'yyyyMMdd'.log' jmeter.save.saveservice.timestamp_format=yyyy/MM/dd HH:mm:ss jmeter.save.saveservice.base_prefix=~/ sampleresult.timestamp.start=true upgrade_properties=/bin/upgrade.properties HTTPResponse.parsers=htmlParser wmlParser htmlParser.types=text/html application/xhtml+xml application/xml text/xml wmlParser.className=org.apache.jmeter.protocol.http.parser.RegexpHTMLParser wmlParser.types=text/vnd.wap.wml summariser.interval=180 summariser.log=true summariser.out=true beanshell.server.file=../extras/startup.bsh time.YMDHMS=yyyyMMdd_HHmmss onload.expandtree=true view.results.tree.max_size=0 classfinder.functions.contain=.functions. classfinder.functions.notContain=.gui. user.properties=user.properties system.properties=system.properties
At the
jmx
the following settings have been specified:<stringProp name="ThreadGroup.num_threads">300</stringProp> <stringProp name="ThreadGroup.ramp_time">0</stringProp> <stringProp name="ThreadGroup.ramp_time">0</stringProp> <longProp name="ThreadGroup.start_time">1404986400000</longProp> <longProp name="ThreadGroup.end_time">1404990000000</longProp> <boolProp name="ThreadGroup.scheduler">false</boolProp> <stringProp name="ThreadGroup.duration">3600</stringProp> <stringProp name="ThreadGroup.delay"></stringProp> <boolProp name="ThreadGroup.delayedStart">true</boolProp>
Question: Where is the bottleneck, and how can we get rid of it?
原文:https://stackoverflow.com/questions/30866466
最满意答案
你错过了很多东西,我很乐意向你解释。
这里
def total_number_of_comments @article = Article.all @comments_total = @article.comments.count end
你必须这样做
def total_number_of_comments @comments_total = Comment.all.count // simple solution end
接下来,您没有使用适当的实例变量。
def total_number_of_articles @articles_total = Article.total_number_of_articles end
看你自己
文章总数:
<%= @total_number_of_articles %> // this is wrong
您指定了
@articles_total
但使用了@total_number_of_articles
。 如果你使用@articles_total
它会工作正常。There are many things you missed, I would happy to explain you.
Here
def total_number_of_comments @article = Article.all @comments_total = @article.comments.count end
You have to do this
def total_number_of_comments @comments_total = Comment.all.count // simple solution end
Next is , you didn't used proper instance variable.
def total_number_of_articles @articles_total = Article.total_number_of_articles end
See yourself
Total number of articles:
<%= @total_number_of_articles %> // this is wrong
You assigned
@articles_total
but used@total_number_of_articles
. if you use@articles_total
it will work fine.
相关问答
更多-
在这种情况下最好承认冗余,以提高速度。 到新闻表中,添加这些字段: comments_count int not null default 0, likes_count int not null default 0, hits_count int not null default 0 当添加/删除评论/ like / hit时,如果数据库支持触发器,则触发引用计数器的递增/递减操作,如果不是,则在每次插入/删除操作时手动执行操作(存储过程可能?)。 这种类型的数据通常比写入的数据要多,因此为了优化读取速度 ...
-
var articles = GetArticleList(); var topArticles = articles.OrderByDescending(a => a.Votes.Count).Take(5); 您需要降序条款,以便您首先获得最高票数的文章。 var articles = GetArticleList(); var topArticles = articles.OrderByDescending(a => a.Votes.Count).Take(5); You need the des ...
-
如何选择MySQL中每个类别文章的所有类别和计数(How to select all categories and count number of each category articles in MySQL)[2023-05-02]
您也可以使用子查询 SELECT c.name,(select count(*) from article where cid = c.id) as count FROM cat c WHERE 1 GROUP BY c.id You can also use subquery like SELECT c.name,(select count(*) from article where cid = c.id) as count FROM cat c WHERE 1 GROUP BY c.id -
计算类别中的文章(Count articles in category)[2022-02-12]
有一个参数允许您已经这样做。 分配类别列表或类别博客菜单项,然后在类别选项参数选项卡下选择 。 更改没有文章消息显示。 您的代码无法正常工作的原因 - 因为单个类别仅由$this->category 。 但是,对于类别博客或类别列表布局,您只需使用: $categoryName = "CategoryName"; if($this->category->title==$categoryName) { count($this->category->getNumItems(true)) } http: ... -
您无法使用status表获取喜欢的信息。 请改用stream表。 type 46将结果限制为仅状态更新。 SELECT message, description, post_id, likes FROM stream WHERE source_id=me() AND type=46 ORDER BY likes.count DESC LIMIT 100 You can't get the likes information using the status table. Use the stream ...
-
你错过了很多东西,我很乐意向你解释。 这里 def total_number_of_comments @article = Article.all @comments_total = @article.comments.count end 你必须这样做 def total_number_of_comments @comments_total = Comment.all.count // simple solution end 接下来,您没有使用适当的实例变量。 def total_ ...
-
Mysql查询不返回没有喜欢或没有评论的文章(Mysql query is not returning articles with no likes or no comments)[2022-07-18]
这将返回没有喜欢或评论的故事(你应该使用左连接): select s.id as story_id, s.title as story_title, COUNT(l.id) as total_likes, COUNT(cm.id) as total_comments from stories s left join likes l on s.id = l.type_id left join comments cm on cm.sto ... -
如何使用注释演化聚合计数替换本机comment_count(How to replace native comment_count with Comments Evolved aggregate count)[2022-03-18]
这似乎有效: function wpse_comments_evolved_number( $count ) { // Override the comment count if( function_exists( 'comments_evolved_get_total_count' ) ) $count = comments_evolved_get_total_count(); // We must then return the value: retu ... -
网络文章/评论计数(Web Articles/Comments Counts)[2020-09-20]
SELECT TOP 10 a.title as articles, count(c.commented_article_id) * 100 / count(b.visitor_id) as percentage FROM articles a JOIN website_pageviews b on a.id = b.article_id JOIN comments c on a.id = c.commented_article_id GROUP BY a.id, a ... -
您可以使用get_comments函数执行此操作。 $num_comments = get_comments( array( 'post_id' => get_the_ID(), 'type' => 'comment', 'count' => true // return only the count ) ); You can use the get_comments function to do this. $num_comments = ...