In the cloud, it's important to look regularly and closely at how your applications and services are architected and utilized. It's the best way to identify opportunities that will let you right-size your instances, fine tune your databases, modify your storage usage, better configure your load balancers, or even re-architect your applications.
For example, if you have a set of 20 instances all running at 10% CPU usage, you might consider using smaller instances or consolidating more work onto those instances. This kind of thinking about your cloud utilization and spend will help you optimize your environment and save money quickly.
Optimizing your cloud architecture has three main goals:
- Improve performance, availability, and end-user experience by taking better advantage of cloud services
- Optimize your cloud spend, striking the delicate balance between cost and performance
- Capture business and technical metrics that help justify your current cloud spend that can be referenced as justification for a larger cloud budget as growth dictates
In this tutorial, we'll show you how to use the New Relic platform to capture all the data you should leverage to optimize your cloud architecture and spend.
Make sure the following products and integrations are instrumented:
Instrument infrastructure: If you haven't already done so, review the requirements for the Infrastructure agent. Infrastructure comes with several types of integrations, including Amazon Web Services (AWS), Microsoft Azure, and on-host integrations. After you've installed the Infrastructure agent on your host(s), you'll immediately have access to the broad spectrum of metrics the agent collects out-of-the-box.
Instrument your applications with APM. Doing so will let you monitor how your applications are performing while you are optimizing the underlying cloud services. That way, you can confirm that your changes to the infrastructure are in fact improving application performance.
New Relic Infrastructure's Amazon integrations let you monitor your AWS data in several New Relic products, including Infrastructure, dashboards, and New Relic Alerts.
If you are hosted in an AWS environment, New Relic can help you monitor your cloud spend with our AWS Billing integration. To leverage New Relic's AWS Billing integration, follow the procedures in the Connect AWS Billing documentation
Dashboards lets you write powerful custom queries about your data and visualize the results in widgets displayed on a common dashboard. You can also feed the results of your queries directly into New Relic Alerts, where you can get immediate notifications on any deviation identified.
For this step, you should display baseline infrastructure metrics related to performance and usage (CPU, memory, disk, database, etc.). Include AWS Budgets if available. To get you started, here are ways to use Insights dashboards to visualize your AWS cloud utilization and spend data:
This dashboard shows data broken out by the applications and budgets you set up in the AWS budgeting area.
Create individual dashboards for each application, and then collect those dashboards into a single “data app,” as shown here. This AWS Production Overview data app displays a set of widgets relevant to an AWS production budget. Data apps are great for presentations where you want to step through a series of topics and also provide a clear overview of an entire environment or service.
This step shows you how to use the metrics New Relic has captured to determine which resources to optimize.
In the sample dashboard above, the CPU-usage widget on the left reveals that this application uses many instances sizes. Note that the “c4.xlarge” instance (in coral) consistently consumes only around 20% CPU capacity. However, when you analyze the c4.xlarge Memory usage in the center widget (light green), you'll see that memory usage for this instance ranges from 20% to 80%. This suggests that the application is more memory-intensive than CPU-intensive. In this case, the instance type should be changed from a compute-optimized instance to one that is memory-optimized. (Note: the chart on the right of the dashboard can be used to monitor the application's average response time as you make these optimizations.)
This is just one example of how to identify cloud-based resources that could be candidates for optimization.
Now that you've identified architecture for optimization, go ahead and do so. Whether you right-size your instances, fine tune your databases, modify your storage usage, better configure your load balancers, or even re-architect your applications, in the end your goal is to be able to compare your new, optimized architecture against the baselines you captured in Step 2. For more about baselines please review the Establish Objectives & Baselines tutorial.
You can create an alert condition for NRQL queries. Be sure to reference the complete documentation as needed.
In the data app for the AWS production budget introduced in Step 2, this was one of the widgets:
Here is the query that we used to create that widget:
SELECT latest(`provider.actualAmount`) as '$ Actual', latest(`provider.forecastedAmount`) as '$ Forecast', max(`provider.limitAmount`) as '$ Limit' FROM FinanceSample WHERE provider = 'BillingBudget' AND `provider.budgetName` = '[Your Cloud Budget]'
If you can write queries on your data and show them in Insights, then you can easily use them to generate Alert conditions.
New Relic also lets you write “baseline queries” against your data. These are queriesy you write without setting hard limits on the results. Rather, you let New Relic Applied Intelligence “machine-learn” your performance data, and then alert you when your data strays too far outside of your baseline numbers.
To create a baseline query, head over the the Alert console, go into Alert policies, and add a New alert policy. Then follow these steps:
Create alert policy. Give your policy a concise and descriptive name and select an Incident Preference. Then select Create alert policy.
Create a condition. Select NRQL
Define your query, and decide how restrictively Applied Intelligence should analyze your data using a simple slider and visualization based on your recent performance.
The slider at the bottom of the chart either increases or decreases the gray band around your budget threshold (the blue line). The setting shown would have resulted in zero violations based on recent data, and that is what you're looking for. However, if that blue line spikes up or down out of the gray band, New Relic will immediately notify you.
Using New Relic Applied Intelligence is a great way to help you proactively learn about your cloud spending or about any of your performance data.
- Review the Proactive alerting and incident orchestration tutorial for a deeper dive on some of the best practices outlined above.
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's and and documentation.