- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 DropWizard 框架创建了一个 RestFul 应用程序,在处理了大约 20 个请求后应用程序就停止响应了。在日志文件中未发现错误/异常条目。
通过管理员控制分析统计,我发现jvm.threads.waiting.count =47 随着每个新请求的增加而不断增加。
应用程序没有在其中实现多线程,因此应用程序没有机会进入等待状态。
此外,如果我重新启动应用程序,它工作正常。
下面是未收到响应的请求之一的 header
*152226 INFO c.s.j.a.c.filter.LoggingFilter - 22 * Server in-bound request*
*22 > POST http://text.com/quotes*
*22 > Accept-Language: en-US,en;q=0.5*
*22 > Host: localhost:8080*
*22 > Content-Length: 1041*
*22 > Accept-Encoding: gzip, deflate*
*22 > User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:34.0) *Gecko/20100101Firefox/34.0*
*22 > Trace-Id: kiki-12345*
*22 > Connection: keep-alive*
请求数据没有被有意共享。
连netstat都查不出原因
我想知道这是应用程序级别的问题还是由于 DropWizard 应用程序配置不正确造成的?
管理部分的完整统计数据如下,另外我有兴趣了解下面的每一项数据,并请求分享一个解释这些字段的链接。
===========================
{
"version": "3.0.0",
"gauges": {
"jvm.buffers.direct.capacity": {
"value": 1466889
},
"jvm.buffers.direct.count": {
"value": 116
},
"jvm.buffers.direct.used": {
"value": 1466990
},
"jvm.buffers.mapped.capacity": {
"value": 0
},
"jvm.buffers.mapped.count": {
"value": 0
},
"jvm.buffers.mapped.used": {
"value": 0
},
"jvm.gc.PS-MarkSweep.count": {
"value": 16
},
"jvm.gc.PS-MarkSweep.time": {
"value": 1354
},
"jvm.gc.PS-Scavenge.count": {
"value": 21
},
"jvm.gc.PS-Scavenge.time": {
"value": 153
},
"jvm.memory.heap.committed": {
"value": 177733632
},
"jvm.memory.heap.init": {
"value": 64984960
},
"jvm.memory.heap.max": {
"value": 924844032
},
"jvm.memory.heap.usage": {
"value": 0.02400968728962939
},
"jvm.memory.heap.used": {
"value": 22205216
},
"jvm.memory.non-heap.committed": {
"value": 50266112
},
"jvm.memory.non-heap.init": {
"value": 24576000
},
"jvm.memory.non-heap.max": {
"value": 136314880
},
"jvm.memory.non-heap.usage": {
"value": 0.30244334294245795
},
"jvm.memory.non-heap.used": {
"value": 41227528
},
"jvm.memory.pools.Code-Cache.usage": {
"value": 0.03484217325846354
},
"jvm.memory.pools.PS-Eden-Space.usage": {
"value": 0.027302608311733353
},
"jvm.memory.pools.PS-Old-Gen.usage": {
"value": 0.018778225297105475
},
"jvm.memory.pools.PS-Perm-Gen.usage": {
"value": 0.45908793007455223
},
"jvm.memory.pools.PS-Survivor-Space.usage": {
"value": 0
},
"jvm.memory.total.committed": {
"value": 227999744
},
"jvm.memory.total.init": {
"value": 89560960
},
"jvm.memory.total.max": {
"value": 1061158912
},
"jvm.memory.total.used": {
"value": 63434984
},
"jvm.threads.blocked.count": {
"value": 0
},
"jvm.threads.count": {
"value": 78
},
"jvm.threads.daemon.count": {
"value": 8
},
"jvm.threads.deadlocks": {
"value": [ ]
},
"jvm.threads.new.count": {
"value": 0
},
"jvm.threads.runnable.count": {
"value": 23
},
"jvm.threads.terminated.count": {
"value": 0
},
"jvm.threads.timed_waiting.count": {
"value": 8
},
"jvm.threads.waiting.count": {
"value": 47
},
"org.eclipse.jetty.util.thread.QueuedThreadPool.dw.jobs": {
"value": 0
},
"org.eclipse.jetty.util.thread.QueuedThreadPool.dw.size": {
"value": 33
},
"org.eclipse.jetty.util.thread.QueuedThreadPool.dw.utilization": {
"value": 0.9696969696969697
}
},
"counters": {
"io.dropwizard.jetty.MutableServletContextHandler.active-dispatches": {
"count": 28
},
"io.dropwizard.jetty.MutableServletContextHandler.active-requests": {
"count": 28
},
"io.dropwizard.jetty.MutableServletContextHandler.active-suspended": {
"count": 0
}
},
"histograms": { },
"meters": {
"ch.qos.logback.core.Appender.all": {
"count": 1,
"m15_rate": 7.747995257374595e-22,
"m1_rate": 0.008714462773784218,
"m5_rate": 0.000016544813111326462,
"mean_rate": 0.00035368404453324113,
"units": "events/second"
},
"ch.qos.logback.core.Appender.debug": {
"count": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"units": "events/second"
},
"ch.qos.logback.core.Appender.error": {
"count": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"units": "events/second"
},
"ch.qos.logback.core.Appender.info": {
"count": 1,
"m15_rate": 7.747995257374595e-22,
"m1_rate": 0.008714462773784218,
"m5_rate": 0.000016544813111326462,
"mean_rate": 0.00035368403287775683,
"units": "events/second"
},
"ch.qos.logback.core.Appender.trace": {
"count": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"units": "events/second"
},
"ch.qos.logback.core.Appender.warn": {
"count": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"units": "events/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.1xx-responses": {
"count": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"units": "events/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.2xx-responses": {
"count": 13,
"m15_rate": 4.94961760464336e-10,
"m1_rate": 0.0034421634791656336,
"m5_rate": 0.000711983613661116,
"mean_rate": 0.004598973132381405,
"units": "events/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.3xx-responses": {
"count": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"units": "events/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.4xx-responses": {
"count": 3,
"m15_rate": 2.5736064313211317e-20,
"m1_rate": 0.00018660583536242524,
"m5_rate": 0.0000018719139194908126,
"mean_rate": 0.0010613014574099948,
"units": "events/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.5xx-responses": {
"count": 3,
"m15_rate": 1.3432085553605237e-10,
"m1_rate": 0.0008942559715277348,
"m5_rate": 0.00019309079729952434,
"mean_rate": 0.001061301432161492,
"units": "events/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.async-dispatches": {
"count": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"units": "events/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.async-timeouts": {
"count": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"units": "events/second"
}
},
"timers": {
"com.flightnetwork.insurance.resource.Book.book": {
"count": 0,
"max": 0,
"mean": 0,
"min": 0,
"p50": 0,
"p75": 0,
"p95": 0,
"p98": 0,
"p99": 0,
"p999": 0,
"stddev": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"com.flightnetwork.insurance.resource.Policies.doSearch": {
"count": 0,
"max": 0,
"mean": 0,
"min": 0,
"p50": 0,
"p75": 0,
"p95": 0,
"p98": 0,
"p99": 0,
"p999": 0,
"stddev": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"com.flightnetwork.insurance.resource.Quote.getQuote": {
"count": 16,
"max": 2.218201954,
"mean": 0.5852605546875,
"min": 0.36994936300000003,
"p50": 0.468106361,
"p75": 0.533698946,
"p95": 2.218201954,
"p98": 2.218201954,
"p99": 2.218201954,
"p999": 2.218201954,
"stddev": 0.4414850207038381,
"m15_rate": 6.29282616000388e-10,
"m1_rate": 0.004336419450693371,
"m5_rate": 0.0009050744109606403,
"mean_rate": 0.005660256743426155,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"com.flightnetwork.insurance.resource.Refund.doRefund": {
"count": 0,
"max": 0,
"mean": 0,
"min": 0,
"p50": 0,
"p75": 0,
"p95": 0,
"p98": 0,
"p99": 0,
"p999": 0,
"stddev": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.connect-requests": {
"count": 0,
"max": 0,
"mean": 0,
"min": 0,
"p50": 0,
"p75": 0,
"p95": 0,
"p98": 0,
"p99": 0,
"p999": 0,
"stddev": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.delete-requests": {
"count": 0,
"max": 0,
"mean": 0,
"min": 0,
"p50": 0,
"p75": 0,
"p95": 0,
"p98": 0,
"p99": 0,
"p999": 0,
"stddev": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.dispatches": {
"count": 19,
"max": 2.2550000000000003,
"mean": 0.5016315789473684,
"min": 0.001,
"p50": 0.46,
"p75": 0.528,
"p95": 2.2550000000000003,
"p98": 2.2550000000000003,
"p99": 2.2550000000000003,
"p999": 2.2550000000000003,
"stddev": 0.463604622080103,
"m15_rate": 6.292826160261246e-10,
"m1_rate": 0.004523025286055793,
"m5_rate": 0.0009069463248801308,
"mean_rate": 0.006721571867253656,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.get-requests": {
"count": 3,
"max": 0.05,
"mean": 0.017666666666666667,
"min": 0.001,
"p50": 0.002,
"p75": 0.05,
"p95": 0.05,
"p98": 0.05,
"p99": 0.05,
"p999": 0.05,
"stddev": 0.028005951748393293,
"m15_rate": 2.5736064313211317e-20,
"m1_rate": 0.00018660583536242524,
"m5_rate": 0.0000018719139194908126,
"mean_rate": 0.001061300945529201,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.head-requests": {
"count": 0,
"max": 0,
"mean": 0,
"min": 0,
"p50": 0,
"p75": 0,
"p95": 0,
"p98": 0,
"p99": 0,
"p999": 0,
"stddev": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.move-requests": {
"count": 0,
"max": 0,
"mean": 0,
"min": 0,
"p50": 0,
"p75": 0,
"p95": 0,
"p98": 0,
"p99": 0,
"p999": 0,
"stddev": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.options-requests": {
"count": 0,
"max": 0,
"mean": 0,
"min": 0,
"p50": 0,
"p75": 0,
"p95": 0,
"p98": 0,
"p99": 0,
"p999": 0,
"stddev": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.other-requests": {
"count": 0,
"max": 0,
"mean": 0,
"min": 0,
"p50": 0,
"p75": 0,
"p95": 0,
"p98": 0,
"p99": 0,
"p999": 0,
"stddev": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.post-requests": {
"count": 16,
"max": 2.2560000000000002,
"mean": 0.5925625,
"min": 0.372,
"p50": 0.47200000000000003,
"p75": 0.5355000000000001,
"p95": 2.2560000000000002,
"p98": 2.2560000000000002,
"p99": 2.2560000000000002,
"p999": 2.2560000000000002,
"stddev": 0.4497823130878611,
"m15_rate": 6.29282616000388e-10,
"m1_rate": 0.004336419450693371,
"m5_rate": 0.0009050744109606403,
"mean_rate": 0.005660270596836139,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.put-requests": {
"count": 0,
"max": 0,
"mean": 0,
"min": 0,
"p50": 0,
"p75": 0,
"p95": 0,
"p98": 0,
"p99": 0,
"p999": 0,
"stddev": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.requests": {
"count": 38,
"max": 2.2560000000000002,
"mean": 0.5017105263157895,
"min": 0.001,
"p50": 0.46,
"p75": 0.528,
"p95": 2.25505,
"p98": 2.2560000000000002,
"p99": 2.2560000000000002,
"p999": 2.2560000000000002,
"stddev": 0.4573666639487485,
"m15_rate": 1.2585652320522491e-9,
"m1_rate": 0.009046050572111585,
"m5_rate": 0.0018138926497602615,
"mean_rate": 0.013443138586906005,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"io.dropwizard.jetty.MutableServletContextHandler.trace-requests": {
"count": 0,
"max": 0,
"mean": 0,
"min": 0,
"p50": 0,
"p75": 0,
"p95": 0,
"p98": 0,
"p99": 0,
"p999": 0,
"stddev": 0,
"m15_rate": 0,
"m1_rate": 0,
"m5_rate": 0,
"mean_rate": 0,
"duration_units": "seconds",
"rate_units": "calls/second"
},
"org.eclipse.jetty.server.HttpConnectionFactory.80.connections": {
"count": 37,
"max": 116.233045153,
"mean": 18.87723851451351,
"min": 0.078290967,
"p50": 0.570973454,
"p75": 33.0824538595,
"p95": 87.55158713740005,
"p98": 116.233045153,
"p99": 116.233045153,
"p999": 116.233045153,
"stddev": 32.65398107624642,
"m15_rate": 0.006718640480106826,
"m1_rate": 0.018519557829824465,
"m5_rate": 0.024412722112445752,
"mean_rate": 0.013086852776973062,
"duration_units": "seconds",
"rate_units": "calls/second"
}
}
}
========================
最佳答案
此问题有 2 个潜在原因:
更多信息来自 this blog post .
您可以使用 netstat -a | grep CLOSE_WAIT | wc -l
获取线程数。
您可以通过运行获取线程转储:
jps
然后查看您的应用程序的进程 ID,并将其传递给此命令:要使用 jstack 获取线程转储,请运行以下命令:
jstack <pid>
每隔一段时间运行相同的命令并追加到同一个文件。您需要多个转储,并及时间隔开以检测长时间运行的线程
jstack <pid> >> threaddumps.log
然后使用 thread dump analyzer比较你的第一个转储和第二个转储,通过选择多个转储来查看哪些线程运行时间长,右键单击并选择“查找长时间运行的线程”
您可能需要确保关闭一个 ClientResponse,就像这里所做的那样:
public boolean isSessionActive(HttpServletRequest httpRequest) {
ClientResponse response = null;
try{
response = jerseyClient
.resource(url)
.type(APPLICATION_JSON_TYPE)
.header("Cookie", httpRequest.getHeader("Cookie"))
.get(ClientResponse.class);
return response.getStatus() == SC_OK;
}
finally {
if (response != null){
// #############################################
// This next line is the fix you're looking for!
// #############################################
response.close();
}
}
}
MultiThreadedHttpConnectionManager 的默认配置只允许每个主机有 2 个并发请求!因此,如果您不断地使用不同的请求数据访问同一台服务器,您可能一次被限制为 2 个 Activity 请求。如果碰巧这 2 个请求需要很长时间才能完成,那么您就没有可用的连接,并且会等待。
这怎么会发生?对于我们来说,我们使用 ApacheHttpClient 和 DropWizard 0.6.2,它在幕后创建了一个具有默认配置的 MultiThreadedHttpConnectionManager - 并且 default configuration一次只允许 2 个并发 http 连接)
我们以为我们正在传递配置来提高这个#,但实际上它没有被使用,我们的服务器一次只处理 2 个请求;-)
因此请检查以下内容以确保它们是您期望的值!
MultiThreadedHttpConnectionManager connectionManager = ...;
connectionManager.getParams().getDefaultMaxConnectionsPerHost();
connectionManager.getParams().getMaxTotalConnections();
关于java - Dropwizard 线程等待计数增加,服务器停止响应所有资源请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27874894/
我正在使用 Tkinter 在 python 上写一个小游戏(顺便说一下,我不允许使用任何其他非内置模块)并且我想在主窗口上播放背景歌曲,这是那个包含标题,以及转到其他窗口和内容的按钮... 所以问题
我有一个 Azure WebJob,它在一个非常简单的应用服务标准:1 Small(计划)上运行。 现在,我的 WebJob(有 5 个函数正在运行)出现问题 - 我想停止 5 个正在运行的函数中的
我在 MacOS Lion 上使用 XCode 4.2。在模拟器中调试 iPhone/iPad 应用程序时,我使用 XCode 工具栏上的“停止”按钮(产品 | 停止)退出应用程序。在此之后,XCod
我刚刚下载了android开放源代码项目,并尝试使用make来构建它,我收到了以下消息: build/core/prebuilt.mk:91: *** recipe commences before
我以前从未制作过 makefile,但我们已经收到了这个,但是,如果我尝试运行它,它只会说, missing separator. stop. 我不知道可能出了什么问题 - 我已经确保空格只按制表符。
好吧,这段代码非常基本。用户将答案输入文本框,如果等于“第一+第二”,他们就得到一分。然后,他们有 5 秒钟的时间回答下一个数学问题。如果他们这样做了,函数“doCalculation”将再次运行,他
我在 viewController 中有一个循环动画 - (void)moveAnimating { [UIView animateWithDuration:2.0f animations:^
当我有一个待处理的 ASIFormDataRequest(作为异步任务启动)仍在执行并且用户按下后退按钮(为了弹出 View )时,我的 viewController 出现问题。 有什么方法可以停止该
我们正在使用 flashdevelop 和 flash CS 3 开发基于 flash 的游戏。我们正在使用 flash CS3 发布 swc,swc 将作为库在 flashdevlop 中使用。 一
我在线程中有一个连接,因此我将其添加到运行循环中以获取所有数据: [[NSRunLoop currentRunLoop] run]; [connection scheduleInRunLoop
你好,我做了一个 php 套接字服务器来从 plc 获取数据,plc 被配置为 tcp 套接字客户端。 我有一个严重的问题,如果本地网络出现故障,似乎功能 socket_accept 停止,plc 无
这个问题已经有答案了: How to stop a setTimeout loop? (10 个回答) 已关闭 8 年前。 请帮助获得正确的函数或方法来停止 setTimeout 函数。 我一直在尝试
我正在运行一个多项目SBT(v0.13)构建,并且希望它在子项目中遇到的第一个错误(编译)时快速失败(停止)。 当前的行为是,当某项无法在子项目中进行编译时,构建将继续(以编译所有其他子项目)。 一旦
我有播放.wav文件中声音的代码,但是我无法停止播放歌曲,甚至无法退出程序直到播放结束。因为这是一首5分钟的歌曲,所以这是一个问题。这是我如何播放wav的代码: public class EasySo
我正在寻找一种解决方案,该如何控制从JSF应用程序播放音频文件。 我不需要完整的解决方案,只需引用我可以用来控制播放音频文件(开始/停止/更改声音)的组件即可。 我尝试搜索过去的问题,但没有成功。 我
我已经在test.ps1中编写了以下函数,在运行该脚本以启动/停止/ ..时我想做一个选择: function getState($SeviceName) { $server = @('hos
我必须设置一个 10 分钟的计时器,它会重定向到主屏幕。此外,它必须在每个操作(例如按下按钮)时重置。我找到了这个计时器:https://github.com/fengyuanchen/vue-cou
我正在制作一个聊天应用程序,功能之一就是发送声音。发送的HTML如下: LOL Stop Play 第一次发送时,“自动播放”效果很好。因此,现在我
我基本上希望页面能够接受用户输入的时间(以秒为单位)。 之后我希望当用户按下“开始”按钮时开始倒计时按下暂停按钮时“暂停”。还有一个重置按钮,以便用户可以从头开始倒计时。 这是我到目前为止得到的:
我需要停止 $.each 循环,加载图像,然后继续循环。我有 Canvas ,可以在其中加载对象图像。对象以正确的顺序排列在数组中。现在,当我尝试从数组加载对象时,存在一个问题:由于尺寸不同,并且它们
我是一名优秀的程序员,十分优秀!