Overview

12 Investigating apps’ behaviors in large systems

This chapter explains how troubleshooting changes when you move from a single application to a system of cooperating services. It emphasizes that an app can appear healthy on its own while still failing because of communication problems, deployment conditions, or interactions with other parts of the environment. To investigate those situations effectively, you often need information beyond ordinary debugging, profiling, and logs.

One major focus is tracing communication between services. Using JProfiler, you can observe HTTP server events for incoming requests, HTTP client events for outgoing requests, and even low-level socket activity. These views help you tell whether slowness or failure comes from the app itself, the network, or the remote service. The chapter highlights practical clues such as event duration, completion status, response codes, throughput, and request frequency, showing how repeated polling or faulty retry behavior can create performance and stability issues.

The chapter also introduces integrated log monitoring and deployment-aware investigation techniques. With Sentry, you can collect exceptions across services, organize them by project and team, and inspect stack traces, environment details, and request data to speed up root-cause analysis. Finally, it explains how service meshes can help by enabling fault injection and mirroring: you can deliberately disrupt communication to reproduce hard-to-recreate failures, or copy production traffic into a test environment for safer investigation. Overall, the chapter stresses that understanding system behavior means observing communication, centralizing error visibility, and reproducing real-world conditions whenever possible.

In many cases, an investigation stays within the boundaries of an app. But you may need to go beyond what happens inside a given process. Issues or strange behavior can be caused by apps that have problems communicating with each other, and implementing a monitoring tool will make investigating these types of issues easier.
To start recording received HTTP requests with JProfiler, go to HTTP Server > Events, and then press the star icon to record single events. Now, whenever the profiled app receives HTTP requests, JProfiler will display the details.
After starting to record the HTTP server events (HTTP requests the app receives), the profiling tool shows details of all the received events on the page. You can easily see if an event ended and the time it took to complete.
You can record all the HTTP requests the app sends regardless of the way they’re sent (what technology your app uses) in JProfiler, which displays details such as the duration, the status code, the HTTP method and URI called, and whether an exception has been encountered—which is all useful information when investigating specific scenarios that involve HTTP requests an app sends.
Any message an app exchanges through the network level uses sockets behind the scenes. You can use a profiling tool such as JProfiler to observe all the low-level events at the sockets level. To monitor these events, use the Sockets > Events section. These events can help you to understand whether the app faces networking issues or if it simply doesn’t correctly manage the communication.
When an app starts a data exchange, it first opens a socket. To exchange the data, the app can execute multiple data exchange events (read or write data events). When the data exchange ends, the app closes the socket.
A log-monitoring tool helps you to easily collect and visualize events throughout the whole system. You can use these details to investigate issues and specific app behavior.
Sentry independently monitors the logs of each service in your system and displays a short overview of the events for each service in the initial dashboard. Services (named projects) are allocated to teams, and Sentry can be configured to send email notifications for events to the team members.
In the project settings, in the Client Keys section, you find the DSN value, which is a URL. The application uses this URL to send the events to Sentry.
Sentry collects all the exceptions caused by the monitored services. In the Issues menu, you can browse a list of these issues. You can filter them based on the time the events happened, the environment, and specific services that cause the events, which helps you to more easily identify an issue.
Each of the events Sentry collects—the event stack trace, details about the server and client environments, and even details about the request (headers, HTTP method, etc.)—provides information that can help you to identify the problem’s root cause.
In a service mesh deployment, communication from and to each app is intercepted by a side cart app (a separate application). Since the side cart app intercepts the data exchanged, you can configure it to log details you need and even alter the communication to force the system into scenarios you want to investigate.
You can use the side cart app of a service mesh to force the system into scenarios you want to investigate. Say you want to replicate a production case in which the communication is often disrupted between two services. You can easily configure a service mesh side cart app to force the execution into such a scenario to allow you to investigate.
You can configure the side cart app to mirror the events from a production app to a service deployed in development. This way, you can investigate a problem that is hard to replicate in development without interfering with the production environment.

Summary

  • Systems today are often composed of many services communicating with one another. Faulty communication between services can cause issues such as bad performance or even wrong output. It’s essential to know how to investigate communication between services using tools such as profiling or service meshes.
  • You can use JProfiler to intercept the HTTP requests a server app receives and the event duration. You can then use this information to observe whether a given endpoint is called too many times or takes too long to execute, causing stress on the app instance.
  • You can use JProfiler to observe the behavior of an app as an HTTP client. You can intercept all the requests an app sends, as well as details such as duration, HTTP response status code, and encountered exceptions. This information can help you to figure out if something is wrong with how the app integrates with other services.
  • JProfiler gives you excellent tools to observe low-level communication established by an app by directly investigating the socket events, which allows you to isolate the problem and determine whether the issues are related to either the communication channel or some part of your application.
  • With large, service-oriented systems, using a log-monitoring tool is an excellent way to observe issues and put puzzle pieces together faster to find a problem’s root cause. A log-monitoring tool is software that collects exceptional events in each app in the system and displays the information you need to understand the problem and where it comes from. Sentry is an excellent tool you can use for system log monitoring.
  • In some cases, you can take advantage of tools used to deploy apps. For example, if your service deployments rely on a service mesh, you can use service mesh capabilities to reproduce scenarios you want to investigate. You can configure
    • Fault injection to simulate a service that doesn’t work properly and investigate how other services are affected in this case.
    • Mirroring to get a copy of all the requests an app sends to a replica of the receiver service. This replica is installed in a test environment, where you can investigate a scenario using debugging and profiling techniques without affecting the production system.

FAQ

What is the main goal of investigating apps’ behaviors in large systems?The main goal is to understand problems that arise when multiple applications work together, especially when an app behaves correctly on its own but fails or slows down in the system. This chapter focuses on communication issues, monitoring, and deployment-related investigation techniques.
Why aren’t debugging, profiling, and logs always enough in large systems?Because some issues happen outside a single app’s boundaries. Problems may come from interactions between services, the environment, the network, or deployment setup, so you sometimes need broader clues from monitoring tools and system-level inspection.
How can JProfiler help investigate communication between services?JProfiler can observe HTTP server events, HTTP client events, and low-level socket events. This helps you see what requests an app receives, what it sends, how long operations take, and whether exceptions or network-level issues are involved.
What should you look for in HTTP server events when diagnosing issues?Check whether the request completed or is still in progress, the event duration, and the number of requests received. A long-running or repeated request may point to delays, polling, or overload caused by client behavior.
What information is most useful in HTTP client events?Key details include the request description and method, the target URI, the call duration, the response status code, and whether an exception occurred. These clues help determine whether slowness comes from the remote service, the network, or the app itself.
How do socket events help identify the source of a communication problem?Socket events show the open, read/write, and close phases of network communication. If opening a socket is slow, the issue is often the network or environment. If reading or writing is slow, it may be due to a large payload, a slow channel, or a remote endpoint delay.
What is integrated log monitoring, and why is it useful?Integrated log monitoring is the use of a tool that collects and visualizes exception events across the whole system. It helps teams quickly find where errors happen, what type of exception occurred, and which service or environment was involved.
What kind of details does Sentry provide for exception investigation?Sentry provides the exception stack trace, environment details such as OS, JVM, and server name, plus client and request information when the exception occurs during an HTTP request. This makes it easier to reproduce and understand the root cause.
Why is the Issues board in Sentry a good starting point for investigation?Because it gives a centralized list of exception events with summary data like exception type, message, occurrence count, and first/last seen times. That helps you quickly tell whether a problem is isolated, recurring, or widespread.
How can deployment tools like service meshes help with troubleshooting?Service meshes can intercept communication between services, making it easier to monitor traffic, inject faults, or mirror requests to another environment. This helps replicate hard-to-reproduce problems and investigate system behavior without directly modifying the application.