简体   繁体   English

Java应用程序状态不一致

[英]Java application inconsistent state

I find my entire application messed up. 我发现我的整个应用程序混乱了。 First log got mingled up . 第一本日志混在一起 Application seems to be freezing after every regular interval,freezing for almost half a minute after every minute or so.The regular threads which performs majority of task seems to have got lost and they have no traces of theirs.All these are drawn up from the logging. 应用程序似乎在每个常规间隔后都冻结了,每分钟左右冻结了将近半分钟。执行大部分任务的常规线程似乎已经丢失,没有任何痕迹。所有这些都是从记录。 Socket seems to had hanged up as per report of the user. 套接字似乎已根据用户报告挂断。

Still very little clue, what had triggered all these. 仍然很少有线索,是什么触发了所有这些。 CPU usage record shows everything fine at that time. CPU使用记录显示当时一切正常。 As I'm left to guess,can you point out a starting point or any particular instance escaping my mind,hitting which I can decrypt possible reason for all these mess. 我有话要说,您能指出一个起点或任何实例逃避我的想法,但我可以解密所有这些混乱的可能原因。

Thanks, Mawia 谢谢,Mawia

I experienced such behavior when running java application that uses GC very intensively on virtual box with limited memory. 当我在有限内存的虚拟盒子上运行大量使用GC的Java应用程序时,遇到了这种行为。 The guest OS did not have enough "physical" memory so it used swap memory. 来宾操作系统没有足够的“物理”内存,因此它使用了交换内存。 But the swap was on "virtual" disk mapped to the physical disk of host OS. 但是交换位于映射到主机OS物理磁盘的“虚拟”磁盘上。

When java GC running on guest OS started working it had to remove garbage from heap that actually was located on physical disk of host OS. 当运行在来宾OS上的Java GC开始工作时,它必须从实际位于主机OS物理磁盘上的堆中删除垃圾。

I do not want to say that your situation is identical but probably it is similar. 我不想说您的情况是相同的,但可能是相似的。 So, try to check how much physical memory you have and how often is your GC running and how much memory is it attempting to clear. 因此,请尝试检查您有多少物理内存,GC运行的频率以及试图清除的内存量。 You gave 1GB to your JVM. 您给JVM分配了1GB。 Do you have enough physical memory? 您是否有足够的物理内存? Probably your JVM heap is actually located in OS swap memory, ie on disk? 也许您的JVM堆实际上位于OS交换内存中,即磁盘上?

Try to investigate your application. 尝试调查您的应用程序。 Is there a chance it allocates huge memory and cleans it too often? 它是否有机会分配巨大的内存并经常清理它? Is it possible to use cache etc? 是否可以使用缓存等? Check how much memory is used by perm gen and how my by short-living objects. 检查perm gen占用了多少内存,以及寿命短的对象如何占用内存。

Why don't you try attaching to your program with a sample based monitoring tool and see what the threads and the JVM subsystem are doing? 为什么不尝试使用基于示例的监视工具将程序附加到程序上,并查看线程和JVM子系统在做什么? JVisualVM ships with the JDK and it's easy to use. JVisualVM随JDK一起提供,并且易于使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM