Chapter 10. Cracking the Case: Whodunnit
While the last chapter focused on systemic failures that can bring an entire application to its knees, this chapter focuses on the much more common problem of debugging ordinary application-level bugs. While we’d all prefer to write bug-free code, evidence suggests that simply introducing a new runtime technology won’t suddenly cause programmers to stop introducing logic errors, forgetting to initialize variables, using unvalidated input, or misusing locking schemes. Unfortunately, new runtime technologies can render certain debugging techniques no longer viable, while increasing the demand for other tools. In this chapter, we’ll explore the differences between debugging live serverless programs and traditional applications, and see where new advances and cloud technologies can lead the way.
Because the first step in debugging a problem is realizing that the problem exists at all, this chapter will include some general best practices around monitoring and observability as well as traditional debugging practices like collecting stack traces or heap dumps. In a mature serverless codebase, monitoring for unexpected edge cases should be woven into the application code in the same way that exception handling or I/O is handled—and often these are the first places where you may want to collect metrics to see whether a certain exception happens. Once the unexpected has been detected, human beings can swing into action with some of the other techniques ...
Get Building Serverless Applications on Knative now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.