如何调试大型服务器端分布式Java应用程序 [英] How to debug large server side distributed Java application

查看:280
本文介绍了如何调试大型服务器端分布式Java应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题:我正在尝试调试Apache Cassandra,并了解应用程序的流程. IE.当客户端发送请求时,说put(),将调用什么方法以及系统在内部如何工作.

Here is my problem: I am trying to debug Apache Cassandra and understand the flow of the app. I.e. when a request is sent by the client, say put(), what methods are called and how the system is working internally.

所以,这就是我的想法:

So, here is what I am thinking:

  1. 在cassandra代码中编写一个主要方法,该方法调用入口点put()方法,在eclipse中放置断点,等等或
  2. 不编写主要方法,只需使用常规客户端(可通过TCP访问服务器)和使用log4j记录器(已在cassandra中实现)调试"(通过读取日志文件并理解代码)即可.

所以,我的问题是,调试这种分布式应用程序的理想方法是什么?

So, my question is, what is the ideal way of debugging such a distributed application?

推荐答案

理想的方式吗?两者,还有更多.

Ideal way? Both, and more.

您提到了目标:调试"和了解应用程序的流程"-好的,在您了解流程之前很难进行调试,但是了解本身可能就是目的.

You mentioned objectives: "debug" and "understand the flow of the application" - OK it's very hard to debug before you do understand the flow, but understanding may be an end in itself.

在现实世界中,处理大型分布式系统时,通常至少在最初时不能依赖调试器,这尤其是因为某些问题仅在系统繁忙或运行数小时后才会出现.因此,在应用程序代码和基础结构代码中,良好的调试跟踪以及对该跟踪的细粒度控制至关重要.

In the real world, when dealing with large distributed systems on often cannot rely on debuggers, at least initially, not least because some problems only show up when the system is busy or after hours of running. Hence good debug trace, and fine-grained control over that trace, in the application code and infrastructure code is essential.

但是,如果您有机会在非常有启发性的调试器中运行.

However if you have the opportunity to run in a debugger that can be quite illuminating.

在此之前,我认为您需要:

Before all of that I think you need to:

a).研究可能存在的任何设计文档.

a). Study any design documentation that there may be.

b).在良好的IDE中浏览源代码,例如.蚀.只需遵循控制即可.嗯,这是一个有趣的地方,想知道它是从哪里调用的?在类上调用该方法,该怎么做?那个构造函数什么时候被调用?

b). Browse the source code in a good IDE, eg. Eclipse. Just follow the control. Hmmm here's an interesting bit, wonder where it gets called from? Call to that method on a class, what does that do? When does that constructor get called?

将其中的一些内容放在脑海中,跟踪就容易多了,而且您对将断点放在何处有了更好的主意.

With some of that in your head followng the trace is much easier, and you have a better idea where to put the breakpoints.

这篇关于如何调试大型服务器端分布式Java应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆