Eight ways to optimize costs on Azure SQL

Across the globe, businesses are emerging into a new normal, eager to restart or rebuild, but still operating in uncertain times. Optimizing costs and redirecting the spend to where it matters most is as important as ever, and many companies see the cloud as a way to control costs, build resilience, and accelerate time to market.

Customers choose Azure for a variety of reasons, but one of the main reasons is to lower their costs. What more could you do if you could save up to 80 percent or more on your database costs? We introduced the Azure SQL family of database services to help businesses cost-effectively adapt and scale to rapidly changing conditions. Here are the top eight ways you can optimize your data spend, with savings available wherever you are in your digital transformation journey.

1. Maintain business continuity in the cloud with free SQL Server licenses

Use your active Software Assurance benefit to get a free license for every SQL Server in your datacenter for a secondary passive replica you can use for disaster recovery to an Azure Virtual Machine.

2. Shift capex to opex with SQL Server on Azure Virtual Machines

Migrating your data to virtual machines hosted on Azure can yield real savings, over $10 million in three years,1 by avoiding the cost and complexity of buying and managing your own physical servers. With SQL Server on Azure Virtual Machines, Azure manages the infrastructure while you purchase, install, configure, and manage your own software. Benefit even more when you register your VM with Resource Provider and operate more productively with a comprehensive set of manageability features like automated backups, patching, and AlwaysOn availability groups.

3. Protect your data with free security updates

For applications that rely upon SQL Server 2008 or 2008/R2, activate three years of free extended security updates when you migrate to Azure Virtual Machines. Use Azure Site Recovery for easy migration to the cloud with pre-configured SQL Server 2008 and 2008 R2 images in Azure Gallery.

4. Boost productivity with fully managed Azure SQL database services

Modernize your existing apps on evergreen, fully managed services that are always on the latest version of SQL Server, where backups, high availability, performance tuning, data protection, and more are performed on your behalf. A recent Forrester Consulting study indicated Azure SQL Database and Azure SQL Managed Instance provide up to a 238 percent return on investment in addition to productivity improvements up to 40 percent.2

“We’ve reduced our operating costs by about 70 percent or one-seventh of our previous IT budget. We’re using those savings to focus on research and development to make our product better and faster.” Shoji Ueda: Senior Architect, Benesse Corporation

5. Use your SQL Server licenses for discounted rates on Azure

Save up to 80 percent3 versus other cloud providers with Azure Hybrid Benefit, a unique offer that maximizes the value of your on-premises licenses in the cloud. Unlike the License Mobility benefit on other clouds, Azure Hybrid Benefit covers your Windows Server licenses, too, and eases the migration of heavily virtualized SQL Server workloads by providing four vCores of SQL Database or SQL Managed Instance for every one core of SQL Server Enterprise. On top of this, you get 180-days of dual-use rights so you can maintain your on-premises operation while migrating to Azure.

6. Optimize costs through better insights

Use Azure Advisor to obtain cost savings insights on idle or underutilized VMs. Or, use Azure Cost Management to monitor and control your storage expenses and optimize usage in your SQL databases.

7. Pay only for the resources you use

Pay by the second with the only serverless SQL in the cloud. SQL Database serverless automatically scales, pauses, and resumes compute resources based upon your workload activity, so you only pay for the resources you consume. Icertis, a leading provider of contract lifecycle management in the cloud, cut its database costs by nearly 70 percent with SQL Database serverless.

“Azure SQL Database serverless enables us to offer an even more robust and resilient solution, helping us build deeper partnerships with our customers and go to market stronger than ever before.” Purna Rao, Senior DevOps Architect, Icertis

8. Commit upfront and lock-in rates for up to three years

Reduce your compute costs by up to 72 percent4 versus pay-as-you-go pricing and budget more effectively with reservation pricing. You can save even more, up to 80 percent, when you combine reservation pricing with Azure Hybrid Benefit. Prepay upfront at a reserved price or with convenient monthly payments at no extra cost.

When you factor in the savings from Azure Hybrid Benefit with the performance on Azure, you get an unbeatable value for your mission-critical workloads, costing up to 86 percent less5 than AWS on SQL Database and up to 84 percent less6 for workloads on SQL Server on Azure Virtual Machines.

Get started with Azure SQL today

Need help with next steps? We can guide you to the right Azure SQL service for your workload and the tools and services to help you cost-effectively migrate to the cloud.

Azure. Invent with Purpose.

1 “The Total Economic ImpactTM of Microsoft Azure IaaS,” a commissioned study conducted by Forrester Consulting in August 2019 on behalf of Microsoft.

2“The Total Economic ImpactTM of Migration to Azure SQL Managed Databases,” a commissioned study conducted by Forrester Consulting in March 2020 on behalf of Microsoft.

3 Calculations based on scenarios running 744 hours/month for 12 months at 3-year Reserved Instances or Reserved Capacity. Prices as of 10/24/2018, subject to change. Azure Windows VM calculations based on one D2V3 Azure VM in US West 2 region at the SUSE Linux Enterprise Basic rate. AWS calculations based on one m5.Large VM in US West (Oregon) using Windows Server pay-as-you-go rate for Reserved Instances under Standard 3-year term, all upfront payment. SQL Server calculations based on 8 vCore Azure SQL Database Managed Instance Business Critical in US West 2 running at Azure Hybrid Benefit rate. AWS calculations based on RDS for SQL EE for db.r4.2xlarge on US West (Oregon) in a multi AZ deployment for Reserved Instances under Standard 3-year term, all upfront payment. Extended security updates cost used for AWS is based on Windows Server Standard open NL ERP pricing in USD. Actual savings may vary based on region, instance size, and performance tier. Savings exclude Software Assurance costs, which may vary based on Volume Licensing agreement. Contact your sales representative for details.

4 The 72 percent saving is based on one M32ts Azure VM for Windows OS in US Gov Virginia region running for 36 months at a Pay as You Go rate of ~$3,660.81/month; reduced rate for a 3-year Reserved Instance of ~$663.45/month. Azure pricing as of 10/30/2018 (prices subject to change). Actual savings may vary based on location, instance type, or usage.

5 Price-performance claim based on data from a study commissioned by Microsoft and conducted by GigaOm in August 2019. The study compared price performance between a single, 80 vCore, Gen 5 Azure SQL Database on the business-critical service tier and the db.r4.16xlarge offering for SQL Server on AWS RDS. Benchmark data is taken from a GigaOm Analytic Field Test derived from a recognized industry standard, TPC Benchmark™ E (TPC-E), and is based on a mixture of read-only and update intensive transactions that simulate activities found in complex OLTP application environments. Price-performance is calculated by GigaOm as the cost of running the cloud platform continuously for three years divided by transactions per second throughput. Prices are based on publicly available US pricing in East US for Azure SQL Database and US East (Ohio) for AWS RDS as of August 2019. Price-performance results are based upon the configurations detailed in the GigaOm Analytic Field Test. Actual results and prices may vary based on configuration and region.

6 Price-performance claims based on data from a study commissioned by Microsoft and conducted by GigaOm in February 2020. The study compared price performance between SQL Server 2019 Enterprise Edition on Windows Server 2019 Datacenter edition in Azure E32as_v4 instance type with P30 Premium SSD Disks and the SQL Server 2019 Enterprise Edition on Windows Server 2019 Datacenter edition in AWS EC2 r5a.8xlarge instance type with General Purpose (gp2) volumes. Benchmark data is taken from a GigaOm Analytic Field Test derived from a recognized industry standard, TPC Benchmark™ E (TPC-E). The Field Test does not implement the full TPC-E benchmark and as such is not comparable to any published TPC-E benchmarks. Prices are based on publicly available US pricing in West US for SQL Server on Azure Virtual Machines and Northern California for AWS EC2 as of January 2020. The pricing incorporates three-year reservations for Azure and AWS compute pricing, and Azure Hybrid Benefit for SQL Server and Azure Hybrid Benefit for Windows Server and License Mobility for SQL Server in AWS, excluding Software Assurance costs. Actual results and prices may vary based on configuration and region.
Quelle: Azure

Three reasons to migrate your ASP.NET apps and SQL Server data to Azure

The way we work and live has changed. Over the last several months, enterprises have had to shift their strategy from “physical first” to digital first and accelerate their digital transformation to enable remote productivity, reduce costs, or rapidly address new opportunities. In a digital first world, websites and web applications play a significant role in how customers interact with a business. To make a great first impression, companies are modernizing their web applications and data to the cloud for optimal performance, and saving money along the way.

Nearly a third1 of the world’s public websites are built on ASP.NET, and for good reasons; it’s fast, scalable, and secure. What if you could combine those benefits with the operational and financial benefits of the cloud? Microsoft Azure offers the only end-to-end application hosting platform to build and manage .NET applications, enabling significant cost savings, operational efficiencies, and business agility.

Here are three ways you’ll benefit from migrating your ASP.NET apps and SQL Server data to Azure.

Optimize costs with fully managed services that do more for you

Operating your .NET applications on a fully managed platform allows your teams to focus on what matters most by offloading apps, infrastructure, and data management to Azure. With our deep expertise in Windows, Visual Studio and ASP.NET, we have designed Azure App Service and Azure SQL Database from the ground up for .NET applications and the SQL Server Databases that power them. Simply put, there is no better place to build, host, manage, and scale your .NET applications.

“After having used Azure for the past couple of years, we don’t want to do it any other way, and the capital cost savings were just too compelling.” —Anand Kulanthaivelu, Solutions Architect for autoTRADER.ca

Use the power of built-in AI, with capabilities that surface savings opportunities for you. Azure SQL Database offers automatic tuning and adaptive query optimization to support peak performance. You can break down how increased traffic or upstream dependencies are affecting website response times with rich out of the box monitoring for ASP.NET applications in Application Insights.

Operate confidently with mission-critical performance and security

App Service and SQL Database can help simplify your operations while enabling you to operate confidently to address any business need. With App Service on Windows operating on an Internet Information Services (IIS) server in the backend and SQL Database sharing the same codebase with on-premises SQL Server, your developers and database admins can continue to use their familiar tools and processes to be effective from day one without a steep learning curve.

Azure .NET app hosting platform serves over 2 million websites and processes, 41 billion requests and 9 trillion SQL queries per day. Built-in auto-scaling quickly adapts to meet workload demand from these apps, ensuring that user experiences stay great. Cloud-native technology like Azure SQL Database Hyperscale removes many of the limits seen in other cloud databases, with a flexible storage architecture that grows as needed, up to 100 TB. Both App Service and SQL Database are available in all 60+ Azure regions, enabling you to deploy your applications closer to customers and meet local regulatory compliance needs.

“Hyperscale made it easy for us to support our growing workload and the dozens of microservices that power our core ecosystem.” —Andrew Wieck, Manager of Business Analytics, Clearent

Azure Security Center provides enterprise grade protection for all your Azure resources, so you can monitor all your applications and databases and receive recommendations to improve your security posture and threat protection. Azure SQL Database offers the broadest range of built-in security controls across T-SQL, authentication, networking and key management as well as advanced data security that proactively detects threats and vulnerabilities. You can protect applications with Azure Web Application Firewall, leverage Azure CDN to optimize performance or use Azure Front Door to route user traffic to the lowest latency backend, all while gaining built-in distributed denial of service (DDoS) protection and global load balancing.

“We looked at moving to the cloud for better DDoS protection and lowered cost of operations for our apps. We have successfully migrated 200 apps to Azure, while using the App Service Migration Assistant to migrate 60 different .NET Apps. The Azure Migrate App Service Migration Assistant really simplified our migration journey by identifying any migration blockers and enabling us to migrate apps with just a few clicks. As an App development team, we really like the value proposition of Azure managed services for .NET Apps such as App Service and Azure SQL Database. We don’t have to worry about patching virtual machines or containers.” —Tim Fragakis, Director of Cloud Services, IT, Clover Imaging Group

Accelerate innovation and ship new features faster

Native integration between Visual Studio, GitHub, App Service and CI/CD enable developers to build and ship changes faster. Features such as remote and live-site debugging for ASP.NET apps let developers and operators diagnose issues in production environments and resolve them quickly, without impacting traffic.

Building on Azure opens the door to new features and services that provide off-the-shelf value to accelerate innovation. Developers can easily connect to new data sources and backend systems with 300+ pre-built connectors for Azure Logic Apps. Turn legacy web services into modern REST-based APIs by creating façades with Azure API Management, then innovate with many of the pre-built APIs for Azure Cognitive Services such as Speech, Text and Image processing. Add interactivity to your website with Azure Bot Service to serve customers more efficiently and deliver personalized results faster with Azure Cognitive Search.

Get started today

Azure offers easy-to-use tools with step by step guidance to help you migrate your apps and data quickly and efficiently. Use the Azure App Service Migration Assistant to perform readiness checks on your application and receive a detailed assessment that walks you through the migration process. Azure Database Migration Service provides a step-by-step guide to help you get to the cloud with near-zero downtime from multiple database sources. Go through this Microsoft Learn module for migrating .NET Apps to get a hands-on migration experience.

Learn more about building .NET applications on Azure and view our on-demand webinar to learn more about the tools you can use to migrate those apps to the cloud. For best-practice guidance and access to Azure engineers, consider the Azure Migration Program. If you are a Microsoft Partner, view our recent session at Microsoft Inspire to learn how you can build and grow your .NET Apps Modernization practice.

1 Framework Usage Distribution on the Entire Internet (as of July 2020).
Quelle: Azure

Monitoring Azure Arc enabled Kubernetes and servers

Azure Arc is a preview service that enables users to create and attach Kubernetes clusters both inside and outside of Azure. Azure Arc also enables the user to manage Windows and Linux machines outside of Azure the same way native Azure Virtual Machines are managed. To monitor these Azure Arc enabled clusters and servers, you can use Azure Monitor the same way you would use it for the Azure resources.

With Azure Arc, the Kubernetes clusters and servers are given a full-fledged Azure Resource ID and managed identity, enabling various scenarios that simplifies management and monitoring of these resources from a common control plane. For Kubernetes, this enables scenarios such as deploying applications through GitOps-based management, applying Azure policy, or monitoring your containers. For servers, users also benefit from applying Azure policies and collecting logs with Log Analytics agent for virtual machine (VM) monitoring.

Monitoring Azure and on-premises resources with Azure Monitor

As customers begin their transition to the cloud, monitoring on-premises resources alongside their cloud infrastructure can feel disjointed and cumbersome to manage. With Azure Arc enabled Kubernetes and Servers, Azure Monitor can enable you to monitor your full telemetry across your cloud-native and on-premises resources in a single place. This saves the hassle of having to configure and manage multiple different monitoring services and bridges the disconnect that many people experience when working across multiple environments.

For example, the below view shows the Map experience of Azure Monitor on an Azure Arc enabled server, with the dashed red lines showing failed connections. The graphs on the right side of the map show detailed metrics about the selected connection.

Also, here you can see your data from Azure Kubernetes Services (AKS), Azure Arc, and Azure Red Hat OpenShift side-by-side in Azure Monitor for containers:

Using Azure Monitor for Azure Arc enabled servers

Azure Monitor for VMs is a complete monitoring offering that gives you views and information about the performance of your virtual machines, as well as dependencies your monitored machines may have. It provides an insights view of a single monitored machine, as well as an at-scale view to look at the performance of multiple machines at once.

Azure Arc enabled servers fit right into the existing monitoring view for Azure Virtual Machines, so the monitoring view on an Azure Arc enabled server will look the same as the view of a native Azure Virtual Machines. From within the Azure Arc blade, you can look at your Azure Arc machines and dive into their monitoring, both through the Performance tab, which shows insights about different metrics such as CPU Utilization and the Map tab, which shows dependencies.

In the at-scale monitoring view, your Azure Arc machines are co-mingled with your native Azure Virtual Machines and Virtual Machines Scale Sets to create a single place to view performance information about your machines. The monitoring data shown in these at-scale views will include all VMs, Virtual Machines Scale Sets, and Azure Arc enabled servers that you have onboarded to Azure Monitor.

The Getting Started tab provides an overview of the monitoring status of your machines, broken down by subscription and resource group.

The Performance tab shows trends at scale, as the performance in certain metrics of all the machines in the chosen subscription and resource group. Within the at-scale view, with the provided Type filter, you can drill down any view to show either your native Azure Virtual Machines, native Azure Virtual Machine Scale Sets, or your Azure Arc enabled servers.

You can check out our onboarding documentation to learn how to start monitoring your Azure Arc enabled Servers.

Using Azure Monitor for Azure Arc enabled Kubernetes

Azure Monitor for Containers provides numerous monitoring features to create a thorough experience to understand the health and performance for your Azure Arc clusters.

Azure Monitor provides both an at-scale view for all your clusters, ranging from standard AKS, AKS-engine, Azure Red Hat OpenShift, and Azure Arc. Azure Monitor provides important details, such as:

Health statuses (healthy, critical, warning, unknown).
Node count.
Pod count (user and system).

At the resource level for your Azure Arc enabled Kubernetes, there are several key performance indicators for your cluster. Users can toggle the metrics for these charts based on percentile and pin them to their Azure Dashboards.

In the Nodes, Controllers, and Containers tab, data is displayed across various levels of hierarchy with detailed information in the context blade. By clicking on the View in Analytics, you can take a deep dive into the full container logs to analyze and troubleshoot.

Next steps

There are Azure Monitor Workbooks and Grafana integrations available as well if you want to explore additional metrics or create your own custom monitoring experiences.

You can check out our onboarding documentation to learn how to start monitoring your Azure Arc enabled Kubernetes clusters.
Quelle: Azure

Containerized Python Development – Part 3

This is the last part in the series of blog posts showing how to set up and optimize a containerized Python development environment. The first part covered how to containerize a Python service and the best development practices for it. The second part showed how to easily set up different components that our Python application needs and how to easily manage the lifecycle of the overall project with Docker Compose.

In this final part, we review the development cycle of the project and discuss in more details how to apply code updates and debug failures of the containerized Python services. The goal is to analyze how to speed up these recurrent phases of the development process such that we get a similar experience to the local development one.

Applying Code Updates

In general, our containerized development cycle consists of writing/updating code, building, running and debugging it.

For the building and running phase, as most of the time we actually have to wait, we want these phases to go pretty quick such that we focus on coding and debugging.

We now analyze how to optimize the build phase during development. The build phase corresponds to image build time when we change the Python source code. The image needs to be rebuilt in order to get the Python code updates in the container before launching it.

We can however apply code changes without having to build the image. We can do this simply by bind-mounting the local source directory to its path in the container. For this, we update the compose file as follows:

docker-compose.yaml…  app:
    build: app
    restart: always
    volumes:      – ./app/src:/code

With this, we have direct access to the updated code and therefore we can skip the image build and restart the container to reload the Python process.

Furthermore, we can avoid re-starting the container if we run inside it a reloader process that watches for file changes and triggers the restart of the Python process once a change is detected. We need to make sure we have bind-mounted the source code in the Compose file as described previously.

In our example, we use the Flask framework that, in debugging mode, runs a very convenient module called the reloader. The reloader watches all the source code files and automatically restarts the server when detects that a file has changed. To enable the debug mode we only need to set the debug parameter as below:

server.pyserver.run(debug=True, host=’0.0.0.0′, port=5000)

If we check the logs of the app container we see that the flask server is running in debugging mode.

$ docker-compose logs app
Attaching to project_app_1
app_1 | * Serving Flask app “server” (lazy loading)
app_1 | * Environment: production
app_1 | WARNING: This is a development server. Do not use it in a production deployment.
app_1 | Use a production WSGI server instead.
app_1 | * Debug mode: on
app_1 | * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
app_1 | * Restarting with stat
app_1 | * Debugger is active!
app_1 | * Debugger PIN: 315-974-099

Once we update the source code and save, we should see the notification in the logs and reload.

$ docker-compose logs app
Attaching to project_app_1
app_1 | * Serving Flask app “server” (lazy loading)

app_1 | * Debugger PIN: 315-974-099
app_1 | * Detected change in ‘/code/server.py’, reloading
app_1 | * Restarting with stat
app_1 | * Debugger is active!
app_1 | * Debugger PIN: 315-974-099

Debugging Code

We can debug code in mostly two ways. 

First is the old fashioned way of placing print statements all over the code for checking runtime value of objects/variables. Applying this to containerized processes is quite straightforward and we can easily check the output with a docker-compose logs command.

Second, and the more serious approach is by using a debugger. When we have a containerized process, we need to run a debugger inside the container and then connect to that remote debugger to be able to inspect the instance data.

We take as an example again our Flask application. When running in debug mode, aside from the reloader module it also includes an interactive debugger. Assume we update the code to raise an exception, the Flask service will return a detailed response with the exception.

Another interesting case to exercise is the interactive debugging where we place breakpoints in the code and do a live inspect. For this we need an IDE with Python and remote debugging support. If we choose to rely on Visual Studio Code to show how to debug Python code running in containers we need to do the following to connect to the remote debugger directly from VSCode. 

First, we need to map locally the port we use to connect to the debugger. We can easily do this by adding  the port mapping to the Compose file:

docker-compose.yaml…  app:
    build: app
    restart: always
    volumes:      – ./app/src:/code
    ports:      – 5678:5678…

Next, we need to import the debugger module in the source code and make it listen on the port we defined in the Compose file. We should not forget to add it to the dependencies file also and rebuild the image for the app service to get the debugger package installed. For this exercise, we choose to use the ptvsd debugger package that VS Code supports.

server.py…import ptvsdptvsd.enable_attach(address=(‘0.0.0.0′, 5678))…

requirements.txtFlask==1.1.1
mysql-connector==2.2.9
ptvsd==4.3.2

We need to remember that for changes we make in the Compose file, we need to run a compose down command to remove the current containers setup and then run a docker-compose up to redeploy with the new configurations in the compose file.

Finally, we need to create a ‘Remote Attach’ configuration in VS Code to launch the debugging mode.

The launch.json for our project should look like:

{    “version”: “0.2.0”,    “configurations”: [        {            “name”: “Python: Remote Attach”,            “type”: “python”,            “request”: “attach”,            “port”: 5678,            “host”: “localhost”,            “pathMappings”: [                {                    “localRoot”: “${workspaceFolder}/app/src”,                    “remoteRoot”: “/code”                }            ]        }    ]}

We need to make sure we update the path map locally and in the container. 

Once we do this, we can easily place breakpoints in the IDE, start the debugging mode based on the configuration we created and, finally, trigger the code to reach the breakpoint.

Conclusion

This series of blog posts showed how to quickly set up a containerized Python development environment, manage project lifecycle and apply code updates and debug containerized Python services.  Putting in practice all we discussed should make the containerized development experience identical to the local one. 

Resources

Project samplehttps://github.com/aiordache/demos/tree/master/dockercon2020-demoBest practices for writing Dockerfileshttps://docs.docker.com/develop/develop-images/dockerfile_best-practices/https://www.docker.com/blog/speed-up-your-development-flow-with-these-dockerfile-best-practices/Docker Desktop https://docs.docker.com/desktop/Docker Compose https://docs.docker.com/compose/Project skeleton samples  https://github.com/docker/awesome-compose
The post Containerized Python Development – Part 3 appeared first on Docker Blog.
Quelle: https://blog.docker.com/feed/