Optimize serverless apps with real-time troubleshooting

0
62

Evaluate
Weigh the pros and cons of technologies, products and projects you are considering.

Serverless computing demands a new way of thinking to successfully troubleshoot apps. Carefully define error states, and maintain logs to pinpoint and solve performance issues.



Serverless computing introduces a lot of change into an IT organization. There are no fixed VMs to deploy and manage,…

“;
}
});

/**
* remove unnecessary class from ul
*/
$(“#inlineregform”).find( “ul” ).removeClass(“default-list”);

/**
* Replace “errorMessageInput” class with “sign-up-error-msg” class
*/
function renameErrorMsgClass() {
$(“.errorMessageInput”).each(function() {
if ($(this).hasClass(“hidden”)) {
$(this).removeClass(“errorMessageInput hidden”).addClass(“sign-up-error-msg hidden”);
} else {
$(this).removeClass(“errorMessageInput”).addClass(“sign-up-error-msg”);
}
});
}

/**
* when validation function is called, replace “errorMessageInput” with “sign-up-error-msg”
* before return
*/
function validateThis(v, form) {
var validateReturn = urValidation.validate(v, form);
renameErrorMsgClass();
return validateReturn;
}

/**
* DoC pop-up window js – included in moScripts.js which is not included in responsive page
*/
$(“#inlineRegistration”).on(“click”,”a.consentWindow”, function(e) {
window.open(this.href, “Consent”, “width=500,height=600,scrollbars=1”);
e.preventDefault();
});

applications are about events rather than workflows and you only pay for the exact compute processing you perform. But these changes pale in comparison to the adjustments a dev team needs to make to troubleshoot software in a serverless world.

Troubleshooting and debugging serverless apps is essentially an extreme form of real-time development. You need to troubleshoot event-driven systems differently, because the events are both spontaneous and asynchronous. Because the timing of and between events is one of the most critical things to test, you can’t just run a piece of data and see what happens.

The framework for real-time troubleshooting and debugging is fairly well-understood. You test each element in isolation — known as unit testing — and then perform integration testing in a controlled environment, where you can inject test data in strict timing to mimic the real world. Then, you shift to a controlled test in your live environment — again, using time-synchronized data injection. Extensive logging helps you understand if everything works, and if something doesn’t work, logging helps isolate the problem.

Use this process as your baseline framework to troubleshoot and debug serverless apps. However, serverless is a more complex form of real-time development and testing because functions float unpredictably around a pool of hosting resources, rather than run in a single place. This introduces a variable delay as the function is scheduled in response to an event. It also means developers can’t watch for function execution because it probably won’t run on the exact resources they watch.

To account for this, adapt basic, real-time testing and debugging to this floating resource model. In addition, design serverless applications to signal any issues that you can then dive into with more detailed troubleshooting and testing.

Detect trouble early on

The first and most critical step to fix a serverless problem is to produce it dependably.

While user complaints or application failures clearly signal trouble, IT professionals are eager to find problems before they reach that level. In most cases, teams can achieve early detection through analysis of application logs. They can also use tools to spot conditions across multiple logs. But logging in a serverless architecture extends the period in which an application runs — which costs you time and money. Logging times can also impact the relationship between events and processes, leading to errors. As a result, most serverless apps will run with little or no real-time logging, and IT teams will selectively enable logging when they suspect a problem.

So, other than user complaints, how will that suspicion arise? Fortunately, you can use the real-time processing in a serverless architecture to send you warnings. To process events, serverless apps are organized into systems that have a finite number of operating states. For example, an application component could be waiting for a signal, processing an event or generating a back-end transaction. Applications interpret events according to the expectations set by these operating states. So, anywhere an operating state exists, you can define one or more error states that represent an illogical or unexpected combination of previous conditions and arriving events. These states can send a message or log an incident and serve as a trigger for IT teams to more closely examine an app.

When that occurs, carefully and selectively enable logging. Don’t turn on all levels of logging across your serverless environment, as you could alter application timing so much that you can’t reproduce the problem. Instead, use your error state information to enable logging where it’s most likely to be helpful, and expand the logging as you zero in on the conditions that caused the problem. When you think you’ve found the condition, try first to reproduce it in a controlled testing framework with test data. If that doesn’t work, use test data in the live serverless deployment to produce it. The first and most critical step to fix a serverless problem is to produce it dependably.

Usually, the combination of error state analysis and log analysis pinpoints the problem with serverless apps and enables developers to make corrections. But, even then, it’s still critical to test and validate any changes to ensure they haven’t broken something else in the application. How you perform these tests will depend on the specific serverless execution framework you use.



Dig Deeper on Cloud management and monitoring





Source link

LEAVE A REPLY