Fragrance Of Programming
Finally Snapshot Debugger tool is now ready for the Production, it’s a tool that enables you to debug web apps running in production in Azure. With the latest Visual Studio 2017 Enterprise 15.5 you can make use of that tool.
I am sure many developers might have come across a scenario in which it’s very tough to debug an application and that’s the reason we use logs. But many times digging logs is very tough and painful and many times you won’t be able to reproduce the issue in Local Environment. Snapshot Debugger comes as a saviour in such scenario. The Snapshot Debugger enables a safe, non-invasive way for you to use the Visual Studio debugger you know and love directly against the production environment in Azure where the issue is happening.
Just like in memory profiler we take the snapshot of the particular state of our application, Snapshot Debugger works very much similarly. Here Snapshot debugger takes a snapshot of the state of your app at specified lines of code where you set Snappoints. While traditional breakpoints would halt your live server when hit and stop it from serving requests; Snappoints quickly capture state, including locals, watches, and the call stack while your app continues to run. This means that you can debug the actual live, running app, without impacting the experience your customers have while using the app.
Below is the GIF file which Microsoft released showing how to use Snappoints.
Best part of Snapshot debugging is that, it has no performance impact on the application
Behind the Scene
As per Microsoft, Snapshot debugger intelligently captures state where you have pin pointed your snappoints. When snappoint is placed Debugger forks your app’s process and suspends the forked copy, creating a snapshot. You then debug against this snapshot, which sits in-memory on your server. The snapshot is not a copy of the full heap of the app – it’s only a copy of the page table with pages set to copy-on-write. The Snapshot Debugger only makes copies of pages in your app if the page gets modified, minimizing the memory impact on your server. In total, your app will only slow down by 10-30 milliseconds when creating snapshots.
You can try out Snapshot debugger in Visual Studio 2017 Enterprise version 15.5 and greater. Currently, the Snapshot Debugger supports ASP.NET and ASP.NET Core apps running in Azure App Services. For more details you can read at official visual studio blog.
Azure functions is the idea of events and code, developers will provide the Azure with a function or code and you till what event should trigger that function.
Azure Cloud Services: Developer can also use web roles or Worker roles. Web roles are used for hosting websites and web APIs, and Worker roles are designed for your background tasks, like processing queues and other batch work. So in cloud services all the environment related work is taken care by Microsoft and this model looks perfect for developers
Why do we need Azure Functions?
Server less doesn’t means there are no server involved, of course servers are involved but it’s abstract from the users/developers. But we delegate all the management of the server to Azure instead of us doing it. So we can purely focus on business requirement.
All the big enterprise application relies on the third party platform or backend. For example, for database we might use Azure DocumentDb and for authentication we might use some other third party platform. And with growing number of third party platform service, we might need to write our own custom backend code as per our requirement and that’s were Azure Functions comes to help us. So you can just tell the Azure function which events you need to respond to and you can write your own custom code. So with this comes a new term “Function as a Service (FaaS)”.