Application Migration to AWS with New Relic
Transcription
Application Migration to AWS with New Relic
Application Migration to AWS with New Relic PEAK PERFORMANCE FOR THE ENTERPRISE The purpose of this paper is to introduce you to using New Relic to mitigate, resolve, and optimize performance of your software applications while transitioning your existing on-premise applications to an Amazon Web Services (AWS) environment. The paper will briefly cover key features of using New Relic and methodologies for identifying and planning which applications to target for migration to AWS. With New Relic installed in your application, you can get deeper insights to assist the migration to AWS and troubleshoot any performance issues along the way. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 2 Contents GETTING STARTED WITH NEW RELIC 3 Applications Overview 3 Key Transactions 5 X-Ray Sessions 9 MIGRATING TO AWS 12 Planning phased approach 12 Phase 1: Cloud Assessment 13 Phase 2: Proof of Concept 14 Phase 3: Data Migration 15 Phase 4: Application Migration 17 Phase 5: Leverage the Cloud 18 Phase 6: Optimization 22 RUNNING NEW RELIC WITH AWS 24 Side-by-side comparisons 24 APPENDIX: A: New Relic Java agent installer overview 25 B: Amazon Elastic Beanstalk and New Relic install 28 C: Database and Slow SQL monitoring with New Relic 30 D: New Relic Platform (3rd party plug-ins including Amazon CloudWatch) 36 ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 3 GETTING STARTED WITH NEW RELIC We recommend you start the migration and proof-of-concept First register for a New Relic account and select the language exercise first by installing and getting familiar with New Relic agent you need for your respective application. You will on an existing application you run and would consider download the agent and follow our installation steps to write migrating to AWS. the code/place the agent in the application. Once installed, New Relic is a software service that provides data analytics on your application performance by running an agent in your the agent will immediately begin performing and reporting data via our graphs that are updated every minute. application. New Relic supports Java, .NET, Ruby, PHP, Python, and Node.js. KEY FEATURES Below are a few key features you will see as part of New Relic’s Pro service. Note these features represent a subset of the overall New Relic feature set and do not include feature examples of New Relic’s Mobile service for iOS and Android. APPLICATIONS OVERVIEW The Applications Overview dashboard provides general To view your app’s dashboard: From the New Relic menu bar, information about the selected app, including response select Applications > (your application’s name). The Monitoring time, Apdex score, throughput (requests per minute), web > Overview dashboard automatically appears. transactions, error rate, recent events, and server information. TIP: To view the real user monitoring (RUM) information for your app, click the Browser button. Applications > (your app) > Monitoring > Overview: After you select an app from the list on your Applications menu, the Overview dashboard shows current app server and browser information. To toggle between the two views, click the App server or Browser button. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 4 In addition to the standard New Relic UI and dashboard drill-down functions, the Overview dashboard has additional functions. If you want to... Show dashboard information for the selected app’s server or browser View threshold levels for your app’s Apdex score Do this... Click the App Server or Browser button. Point to the Apdex score ? icon. From the Overview’s Browser view, point anywhere on the Global Apdex map. View worldwide Apdex details Tip: To go directly to the selected app’s Geography dashboard, click the Global Apdex title, or click anywhere on the Global Apdex map. For more information, see Geography. View the Web Transactions dashboard Click the Web Transactions table on the Applications Overview dashboard. Or, to view details about a specific web transaction (including Key Transactions), click its name. Click the Error rate chart’s title on the Applications Overview dashboard. View the Errors dashboard Tip: You can also view the Errors dashboard from Applications > (your app) > Events > Errors. Do any of the following: • Toggle between a table view of the hosts or metric details of each host View the app’s server details • Click an Individual server’s name • Point to an individual server’s Apdex score • Click an individual server’s CPU usage or Memory ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 5 KEY TRANSACTIONS In web applications, some transactions are more important and app response time, call counts, and error rates. You can to your business than others; for example: also set alert threshold levels for notifications when your key • Key business events in your application, such as signups or purchase confirmations • Transactions that are particularly important from a performance perspective, such as searches or logins New Relic’s Key Transactions feature lets you closely monitor transactions are performing poorly. Note: The Key Transactions feature is available for Pro accounts and higher. However, if the agent for your selected app does not support custom alerts for key transactions, the Alerts tab is not applicable. Refer to your agent’s release notes to make sure you have the most up-to-date version. and report your business’s key transactions, including end user OPTIONS The New Relic user interface provides two ways to create a key transaction: • From the Transactions menu: This is useful, for example, in this section to create a key transaction. This is useful, when you want to create several key transactions, or you for example, when you are drilling down into an app and want to create key transactions from different apps. want to identify a key transaction immediately. • From the app itself: Select Applications > (your app) > Monitoring > Web Transactions > (transaction name) > TIP: If a key transaction has already been created, you can click Key Transaction to view the key transaction’s Overview dashboard. Track as Key Transaction. Then follow the procedure Applications > (your app) > Monitoring > Web Transactions: To create a key transaction from the list of web transactions in the app itself, select the transaction name, and then click Track as a Key Transaction. In this example, the agent for the selected app does not support custom alerting for key transactions, so the custom alerting values (Apdex T, Warning and Critical thresholds) do not appear. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 6 CUSTOM ALERTING If the agent for your selected app supports custom alerting for key transactions, you can define alert threshold levels as part of the initial setup. Custom alerting for key transactions include: • Apdex T levels for your end users and browser • Caution (yellow) levels and Critical (red) alert levels for error rates If the agent for your selected app does not support custom alerting, the creation process ignores this step. After you create and save your new key transaction, its “traffic light” (green, yellow, red, or gray) on the Transactions dashboard will indicate whether alert levels have been set. A brighter color means yes, a lighter color means no. CREATING KEY TRANSACTIONS The first time you use the Key Transactions dashboard, a Welcome page appears. After you create one or more key transactions, the dashboard will include a list of key transactions that you can select. To create a key transaction: 1. From the New Relic menu bar, select Transactions. 5. Type a name for the key transaction. 2. From the Transactions dashboard, click Track 6.If the agent for the selected app supports custom alerting, a Key Transaction. use the default values that New Relic automatically fills, 3. To select the app for the key transaction, begin typing the name, and then select from the drop-down list. or set the Apdex and alert threshold values. 7. Click Track Key Transaction. 4. Select your choice from the list of available transactions for the selected app. Transactions > Track as Key Transaction: In this example, the agent for the selected app supports custom alerting for key transactions. The Key Transactions dashboard immediately refreshes and shows the Overview dashboard for your new transaction. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 7 TRANSACTIONS DASHBOARD The Transactions dashboard lists each key transaction by its To view detailed information about a key transaction, click customized name, and the associated app’s name appears the key transaction’s name on the Transactions dashboard. below it. The dashboard also shows a list of Recent Events The dashboard immediately refreshes with the selected key for all key transactions. transaction’s Overview information. Transactions: Here is an example of the Transactions dashboard with a list of key transactions. To view detailed information about any key transaction on the list, click its name. Tip: If your New Relic agent supports the X-Ray Sessions feature, you can also gain deeper insights into a key transaction’s performance by creating an x-ray session to show transaction traces alongside long-running profiler results. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 8 Here is a summary of additional options from the Transactions dashboard. If you want to... Do this... Point to the key transaction’s name on Transactions dashboard list. For example, a key Find out the original name of a key transaction transaction’s customized name appears on the list as App Overview. When you point to it, a popup shows its original transaction name (ApplicationsController#show). From the list of visible key transactions, use your mouse to point to a key transaction name, Add a tag to one or more key transactions and then click the tag icon. Or, to add the same tag to all key transactions, click the tag icon above the list. From the search window above the list Filter the list of key transactions of key transactions, select your choice of available search filters. From the Transactions dashboard, look at the “traffic light” (green, yellow, red, or gray) for Find out whether the key transaction has Apdex and alert settings Filter the list of Recent Events on the the key transaction. A darker color indicates it uses Apdex and alert settings; a lighter color indicates it does not. In this example, notice that the top alert traffic light is darker than the bottom one. Click the icon for a specific type of event: All, notifications, critical or caution alerts, etc. Transactions dashboard Set up an RSS feed for event notifications View another key transaction Return to the Transactions dashboard On the Recent Events section of the dashboard, click the orange RSS feed RSS icon if available From the current key transaction’s dashboard, select from the drop-down menu next its name From the current key transaction’s dashboard, click Transactions on the New Relic menu bar. KEY TRANSACTION OVERVIEW DASHBOARD The key transaction’s Overview dashboard functions like other Tip: To view an existing key transaction’s dashboard from the associated New Relic dashboards. It presents summary information about Transactions > (transaction name) > Key Transaction. app’s dashboard, select Applications > (your app) > Monitoring > Web your key transaction in charts and tables. From here you can drill down into specific details or select other tabs to view additional data. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 9 Transactions > (your key transaction) > Overview: Your key transaction’s dashboard provides a wealth of information. To drill down into details and use additional functions (such as notes, custom dashboards, or embedding a publicly accessible URL), point anywhere on a chart. X-RAY SESSIONS New Relic’s X-Ray Sessions feature allows you to gain deeper to 100 transaction traces and a thread profile for your insights into a key transaction’s performance by showing transaction. Collection automatically stops at 100 traces transaction traces alongside long-running profiler results. or 24 hours, whichever comes first. After you start an x-ray session, New Relic will collect up REQUIREMENTS X-Ray Sessions follow the same requirements as key Python: For WSGI environments, if your server uses coroutines transactions and thread profiler agents. Currently the (green threads), Python users will not see any thread profiling X-Ray Sessions feature is available for Pro subscribers data in the existing thread profiler or in the Thread profile tab for (and higher) using the latest Java or Python agent. x-ray sessions. For more information, see Status of Python agent. EVENT THREAD PROFILERS AND X-RAY SESSIONS Both full thread profiling and specific x-ray sessions show the results as a tree structure that you can drill down into details. However, they are not the same. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 10 Transactions > (selected key transaction) > X-Ray > (selected x-ray session) > Thread profile: From an x-ray session’s Thread profile dashboard, you can adjust the drill-down settings, expand or collapse the tree view, and go directly to the dashboards for the key transaction, its corresponding application, or server process. • Full thread profiling (which you start from Events > Thread about the transaction traces and a Thread Profile dashboard profiler) is for a single host or process. with drill-down details you can select. • An x-ray session runs a thread profiler across all hosts or Since an x-ray session runs across more than one process, processes that run the application. Then, the x-ray session New Relic automatically adjusts the time period between captures profiler data only for the selected key transaction. samples to avoid overloading the CPU. The x-ray session includes both an Overview dashboard X-RAY SESSIONS LIST Every ten seconds the X-Ray Sessions list refreshes automatically. The X-Ray Sessions list (newest to oldest) shows: • X-ray session name • When the session started • Current progress • Current status (Starting, Running, Stopped, Finished) • Number of traces • Icons to • Author (email link for the person who created the x-ray session) or edit (rename) and to stop (cancel) delete the x-ray session ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 11 Transactions > (selected key transaction) > X-Ray: From an x-ray session’s list, click the x-ray sessions name to view dashboards for the transaction trace and threat profile results. You can also view the corresponding key transaction or application for the x-ray session by clicking the links at the top of either dashboard. X-RAY DASHBOARDS To view an x-ray session’s Overview and Thread Profile dashboards: 1. From the New Relic menu bar, select Transactions > 3. To toggle between the x-ray session’s Overview and (selected key transaction) > X-Ray > (selected x-ray session). Thread Profile dashboards, click their individual tabs. 2. To view the x-ray session’s corresponding key transaction or application, click the individual links at the top of the Overview or Thread Profile dashboard. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 12 Migrating to AWS *Note significant portions of this section were drawn from the AWS whitepaper ‘Migrating your Existing Applications to the AWS Cloud (with 3 example scenarios), October 2010’ A PHASED STRATEGY FOR MIGRATION: STEP BY STEP GUIDE Cloud Assessment Phase Proof of Concept Phase Data Migration Phase • Assess Cost • Assess Architecture • Assess Security • Learn AWS • Build a Pilot • Build Support within organization • Leverage different storage options • Migrate Application Migration Phase • Forklift Migration • Hybrid Migration Strategy Leverage the Cloud Phase • • • • Optimization Phase • • • • • Auto-scaling Automation Elasticity High Availability Phases Utilization Monitoring Efficiency Performance Re-engineering Benefits Business case for migration (Lower TCO, Cloud Assessment faster time to market, higher flexibility & • Financial Assessment (TCO calculation)• Identify the tools that can be reused • Security and Compliance Assessment and the tools that need to be built • Technical Assessment • Migrate licensed products (Classify application types) • Create a plan and measure success agility, scalability + elasticity) Identify gaps between your current traditional legacy architecture and next-generation cloud architecture Proof of Concept Build confidence with various AWS • Get your feet wet with AWS services • Build a pilot and validate the technology Mitigate risk by validating critical pieces • Test existing software in the cloud of your proposed architecture Moving your Data Redundancy, Durable Storage, Elastic • Understand different storage options • Migrate commercial RDBMS to EC2 + EBS Scalable Storage in the AWS cloud• Migrate MySQL to Amazon RDS • Migrate fileservers to Amazon S3 Moving your Apps • Forklift migration strategy • Build “cloud-aware” layers of code as needed • Hybrid migration strategy •Create AMIs for each component Automated Management Backup Future-proof scaled-out service-oriented elastic architecture Leveraging the Cloud Reduction in CapEx in IT • Leverage other AWS services• Automate elasticity and SDLC Flexibility and agility • Harden security• Create dashboard to manage AWS resources Automation and improved productivity • Leverage multiple availability zones Higher Availability (HA) Optimization Increased utilization and • Optimize usage based on demand• Improve efficiency transformational impact in OpEx • Implement advanced monitoring and telemetry•Re-engineer your application AWS resources Better visibility through advanced • Decompose your relational databases monitoring and telemetry ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 13 PHASE 1: CLOUD ASSESSMENT SECURITY AND COMPLIANCE ASSESSMENT If your organization has specific IT security policies and compliance requirements, we recommend that you involve your security advisers and auditors early in the process. At this stage, you can ask the following questions: • What is my overall risk tolerance? Are there various • What are my security threats? What is a likelihood of those classifications of my data that result in higher or lower threats materializing into actual attacks? tolerance to exposure? • What are my main concerns around confidentiality, integrity, availability, and durability of my data? • What are my regulatory or contractual obligations to store • Am I concerned about intellectual property protection and legal issues of my application and data? • What are my options if I decide that I need to retrieve all of my data back from the cloud? data in specific jurisdictions? • Are there internal organizational issues to address to increase our comfort level with using shared infrastructure services? Data security can be a daunting issue if not properly understood and analyzed. Hence, it important that you understand your risks, threats (and likelihood of those threats), and then based on sensitivity of your data, classify the data assets into different categories (discussed in the next section). This will help you identify which datasets (or databases) to move to the cloud and which ones to keep in-house. It is also important to understand these important basics regarding AWS Security: • You own the data, not AWS. • You choose which geographic location to store the data. It doesn’t move unless you decide to move it. • You can download or delete your data whenever you like. • You can set highly granular permissions to manage access of a user within your organization to specific service operations, data, and resources in the cloud for greater security control. For more up-to-date information about certifications and best practices, please visit the AWS Security Center. • You should consider the sensitivity of your data, and decide if and how you will encrypt your data while it is in transit and while it is at rest. TECHNICAL AND FUNCTIONAL ASSESSMENT A technical assessment is required to understand which applications are more suited to the cloud architecturally and strategically. At some point, enterprises determine which applications to move into the cloud first, which applications to move later and which applications should remain in-house. In this stage of the phase, enterprise architects should ask the following questions: • Which business applications should move to the cloud first? • Does the cloud provide all of the infrastructure building blocks we require? • Can we reuse our existing resource management and configuration tools? • How can we get rid of support contracts for hardware, software and network? ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 14 CREATE A DEPENDENCY TREE AND A CLASSIFICATION CHART • Perform a thorough examination of the logical constructs • Create a spreadsheet that lists all your applications and of your enterprise applications and start classifying your dependencies or simply “white-board” your dependency applications based on their dependencies, risks, and security tree that shows the different levels of interconnections and compliance requirements. of your components. This diagram should be an accurate snapshot of your enterprise application assets. It may look • Identify the applications and their dependencies on other something like the diagram below. It could include all your components and services. Create a dependency tree that ERP systems, HR services, Payroll, Batch processing systems, highlights all the different parts of your applications and backend billing systems and customer-facing web applications, identify their upward and downstream dependencies to internal corporate IT applications, CRM systems etc. as well other applications. as lower-level shared services such as LDAP servers. PHASE 2: PROOF OF CONCEPT PHASE Once you have identified the right candidate for the cloud and you can deploy a small greenfield application and, in the process, estimated the efforts required to migrate, it’s time to test the begin to get your feet wet with the AWS cloud. This is also waters with a small proof of concept. The goal of this phase a good place to incorporate usage of New Relic into your PoC is to learn AWS and ensure that your assumptions regarding to ensure you are getting the performance you expect from suitability for migration to the cloud are accurate. In this phase, your application. GET YOUR FEET WET WITH AWS Get familiar with the AWS API, AWS tools, SDKs, Firefox At a minimum, at the end of this stage, you should know how plug-ins and most importantly the AWS Management to use the AWS Management Console (or the Firefox plug- ins) Console and command line tools (See the Getting Started and command line tools to do the following: Center for more details). Update an Object Learn Amazon S3 Create a Signed URL Create a Bucket Create a CloudFront Distribution Customize AMI Bundle AMI Learn About Security Groups Test Different Availability Zones Create EBS Volume Attach Volume Create a Snapshot of a Volume Create Elastic IP Map DNS to Elastic IP Restore Snapshot Launch a Customized AMI Launch AMI Learn Amazon EC2 Take a Backup Learn Amazon RDS Launch a DB Instance Scale up Vertically Scale out Horizontally (more storage) Setup Multi-AZ ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 15 Be aware of the AWS security features available today. Use At a minimum, learn about the AWS Identity and Access them at every stage of the migration process as you see fit. Management (IAM) features that allow you to create multiple During the Proof of Concept Phase, learn about the various users and manage the permissions for each of these users security features provided by AWS: AWS credentials, Multi within your AWS Account. Figure 5 highlights the topics you Factor Authentication (MFA), authentication and authorization. need to learn regarding IAM: Create Groups Create a Policy Learn About Resources and Conditions Create Users Generate New Access Credentials Assign Users to Groups Learn IAM At this stage, you want to start thinking about whether you want (admins, developers, testers etc.) and whether you want to to create different IAM groups for different business functions create users to match your organization chart or create users within your organization or create groups for different IT roles for each application. BUILD A PROOF-OF-CONCEPT Build a proof-of-concept that represents a microcosm of files on Amazon S3 and mount an EBS volume to the Amazon your application, or which tests critical functionality of your EC2 instance, how to manage/monitor your application using application in the cloud environment. Start with a small Amazon CloudWatch and how to use IAM to restrict access to database (or a dataset); don’t be afraid of launching and only the services and resources required for your application terminating instances, or stress-testing the system. to function. For example, if you are thinking of migrating a web application, Most of our enterprise customers dive into this stage and reap you can start by deploying miniature models of all the pieces tremendous value from building pilots. We have noticed that of your architecture (database, web application, load balancer) customers learn a lot about the capabilities and applicability with minimal data. In the process, learn how to build a Web of AWS during the process and quickly broaden the set of Server AMI, how to set the security group so that only the web applications that could be migrated into the AWS cloud. server can talk to the app server, how to store all the static PHASE 3: DATA MIGRATION PHASE In this phase, enterprise architects should ask following questions: • What are the different storage options available appropriately with minimal effort. You have to make the right in the cloud today? tradeoffs among various dimensions - cost, durability, query- • What are the different RDBMS (commercial and open source) options available in the cloud today? ability, availability, latency, performance (response time), relational (SQL joins), size of object stored (large, small), accessibility, read heavy vs. write heavy, update frequency, • What is my data segmentation strategy? What trade-offs cache-ability, consistency (strict, eventual) and transience do I have to make? (short-lived). Weigh your trade-offs carefully, and decide which ones are right for your application. The beauty about • How much effort (in terms new development, one-off scripts) AWS is that it doesn’t restrict you to use one service or another. is required to migrate all my data to the cloud? You can use any number of the AWS storage options in any When choosing the appropriate storage option, one size does combination. not fit all. There are several dimensions that you might have to consider so that your application can scale to your needs ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 16 UNDERSTAND VARIOUS STORAGE OPTIONS AVAILABLE IN THE AWS CLOUD The table will help explain which storage option to use when Amazon S3 + Amazon EC2 CloudFront Ephemeral Store Amazon EBS Amazon Simple DB Storing large writeIdeal for once, read-many Storing non- Off-instance Query-able light- types of objects, persistent transient persistant storage weight attribute Static Content updates for any kind of data data Distribution Media files, audio, Ideal examples for Storing and querying structured relational and referential data Querying, Index Web apps, Complex Clusters, boot Mapping, tagging, transactional video, images, Config data, scratch data, Log or data of click-stream systems, inventory Backups, archives, files, TempDB commercial RDBMS logs, metadata, management and like Oracle, DB2 Configuration, order fulfillment catalogs systems versioning Not recommended Amazon RDS Querying, Searching Storing database Static data, Web- logs or backups, facing content, customer data key-value data Complex joins or transactions, BLOBs Relation, Typed Clusters data Not recommended Database, File Shared drives, Content OLTP, DW cube Clustered DB, examples Systems Sensitive data Distribution rollups Simple lookups MIGRATE YOUR FILESERVER SYSTEMS, BACKUPS AND TAPE DRIVES TO AMAZON S3 If your existing infrastructure consists of Fileservers, Log servers, is to point your “pipe” to Amazon S3 so that new data is stored Storage Area Networks (SANs) and systems that are backing up in the cloud right away. Then, you can have an independent the data using tape drives on a periodic basis, you should batch process to move old data to Amazon S3. Most enterprises consider storing this data in Amazon S3. Existing applications take advantage of their existing encryption tools (256-bit AES can utilize Amazon S3 without major change. If your system is for data at-rest, 128-bit SSL for data in-transit) to encrypt the generating data every day, the recommended migration flow data before storing it on Amazon S3. MIGRATE YOUR MYSQL DATABASES TO AMAZON RDS If you use a standard deployment of MySQL, moving to Amazon you are monitoring all the metrics you need. It is also highly RDS will be a trivial task. Using all the standard tools, you will be recommended that you set your retention period so AWS can able to move and restore all the data into an Amazon RDS DB automatically create periodic backups. instance. After you move the data to a DB instance, make sure MIGRATE YOUR COMMERCIAL DATABASES TO AMAZON EC2 USING RELATIONAL DB AMIS If you require transactional semantics (commit, rollback) and Images and are supported in the cloud by the vendors. Migrating are running an OLAP system, simply use traditional migration your data from an on-premise installation to an Amazon EC2 tools available with Oracle, MS SQL Server, DB2 and Informix. cloud instance is no different than migrating data from one All of the major databases are available as Amazon Machine machine to another. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 17 MOVE LARGE AMOUNTS OF DATA USING AMAZON IMPORT/EXPORT SERVICE When transferring data across the Internet becomes cost or time If you have a 100TB Oracle database with 50GB of changes per prohibitive, you may want to consider the AWS Import/Export day in your data center that you would like to migrate to AWS, service With AWS Import/Export Service, you load your data you might consider taking a full backup of the database to disk on USB 2.0 or eSATA storage devices and ship them via a carrier then copying the backup to USB 2.0 devices and shipping them. to AWS. AWS then uploads the data into your designated Until you are ready to switch the production DBMS to AWS, buckets in Amazon S3. you take differential backups. The full backup is restored by the For example, if you have multiple terabytes of log files that need to be analyzed, you can copy the files to a supported device and ship the device to AWS. AWS will restore all the log files in your designated bucket in Amazon S3, which can then be import service and your incremental backups are transferred over the Internet and applied to the DB Instance in the cloud. Once the last incremental backup is applied, you can begin using the new database server. fetched by your cloud-hosted business intelligence application or Amazon Elastic MapReduce services for analysis. PHASE 4: APPLICATION MIGRATION PHASE In this phase, you should ask the following question: • How can I move part of or an entire system to the cloud without disrupting or interrupting my current business? In this phase, you will learn two main application migration help you decide the best approach that suits your application. strategies: Forklift Migration Strategy and Hybrid Migration Based on the classification of application types (in Phase 1), you Strategy. We will discuss the pros and cons of each strategy to can decide which strategy to apply for what type of application. FORKLIFT MIGRATION STRATEGY Stateless applications, tightly coupled applications, or self- In this strategy, the applications might not be able to take contained applications might be better served by using the immediate advantage of the elasticity and scalability of the forklift approach. Rather than moving pieces of the system over cloud because, after all, you are swapping real physical servers time, forklift or “pick it all up at once” and move it to the cloud. with EC2 instances, or replacing file servers with Amazon S3 Self-contained Web applications that can be treated as single buckets or Amazon EBS volumes; logical components matter components and backup/archival systems are examples of these less than the physical assets. However, it’s important to realize types of systems that can be moved into the cloud using this that, by using this approach for certain application types, you strategy. Components of a 3-tier web application that require are shrinking your IT infrastructure footprint (one less thing to extremely-low latency connectivity between them to function worry about) and offloading the undifferentiated heavy lifting and cannot afford internet latency might be best suited to this to AWS. This enables you to focus your resources on things that approach if the entire application including the web, app and actually differentiate you from your competitors. You will revisit database servers, is moved to the cloud all at once. this application in the next stages and will be able to realize In this approach, you might be able to migrate an existing app- even more benefits of the cloud. lication into the cloud with few code changes. Most of the Like with any other migration, having a backup strategy, a roll- changes will involve copying your application binaries, creating back strategy and performing end-to-end testing is a must and configuring Amazon Machine Images, setting up security when using this strategy. groups and elastic IP addresses, DNS, switching to Amazon RDS databases. This is where AWS’s raw infrastructure services (Amazon EC2, Amazon S3, Amazon RDS and Amazon VPC) really shine. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 18 HYBRID MIGRATION STRATEGY A hybrid migration consists of taking some parts of an application In this strategy, you might have to design, architect and build and moving them to the cloud while leaving other parts of the temporary “wrappers” to enable communication between parts application in place. residing in your traditional datacenter and those that will reside The hybrid migration strategy can be a low-risk approach to migration of applications to the cloud. Rather than moving the entire application at once, parts can be moved and optimized in the cloud. These wrappers can be made “cloud- aware” and asynchronous (using Amazon SQS queues, wherever applicable) so that they are resilient to changing internet latencies. one at a time. This reduces the risk of unexpected behavior This strategy can also be used to integrate cloud applications after migration and is ideal for large systems that involve several with other cloud-incompatible legacy applications (Mainframe applications. For example, if you have a website and several applications or applications that require specialized hardware batch processing components (such as indexing and search) to function). In this case, you can write “cloud-aware” web that power the website, you can consider using this approach. service wrappers around the legacy application and expose them The batch processing system can be migrated to the cloud first as web service. Since web ports are accessible from outside while the website continues to stay in the traditional data center. enterprise networks, the cloud applications can make a direct The data ingestion layer can be made “cloud-aware” so that call to these web services and which in turn interacts with the the data is directly fed to an Amazon EC2 instance of the batch mainframe applications. You can also setup a VPN tunnel processing system before every job run. After proper testing between the legacy applications that reside on-premise and of the batch processing system, you can decide to move the cloud applications. website application. CONFIGURING AND CREATING YOUR AMIS In many cases, it is best to begin with AMIs either provided It is recommended that you create an AMI for each component by AWS or by a trusted solution provider as the basis of AMIs designed to run in a separate Amazon EC2 instance. It is also you intend to use going forward. Depending on your specific recommended to create an automated or semi-automated requirements, you may also need to leverage AMIs provided deployment process to reduce the time and effort for re- bundling by other ISVs. In any case, the process of configuring and AMIs when new code is released. This would be a good time creating your AMIs is the same. to begin thinking about a process for configuration management to ensure your servers running in the cloud are included in your process. PHASE 5: LEVERAGE THE CLOUD After you have migrated your application to the cloud, run • How can I take advantage of some of the other advanced the necessary tests, and confirmed that everything is working AWS features and services? as expected, it is advisable to invest time and resources to determine how to leverage additional benefits of the cloud. Questions that you can ask at this stage are: • Now that I have migrated existing applications, what else can I do in order to leverage the elasticity and scalability benefits that the cloud promises? What do I need to do differently in • How can I automate processes so it is easier to maintain and manage my applications in the cloud? • What do I need to do specifically in my cloud application so that it can restore itself back to original state in an event of failure (hardware or software)? order to implement elasticity in my applications? LEVERAGE OTHER AWS SERVICES ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 19 AUTO SCALING SERVICE Auto Scaling enables you to set conditions for scaling up or At minimum, you can create an Auto Scaling group and set down your Amazon EC2 usage. When one of the conditions a condition that your Auto Scaling group will always contain is met, Auto Scaling automatically applies the action you’ve a fixed number of instances. Auto Scaling evaluates the health defined. of each Amazon EC2 instance in your Auto Scaling group and Examine each cluster of similar instances in your Amazon EC2 fleet and see whether you can create an Auto Scaling group automatically replaces unhealthy Amazon EC2 instances to keep the size of your Auto Scaling group constant. and identify the criteria of scaling automatically (CPU utilization, network I/O etc.) AMAZON CLOUDFRONT With just a few clicks or command line calls, you can create that customers don’t wait until this phase to take advantage of an Amazon CloudFront distribution for any of your Amazon CloudFront; they do so much earlier in the plan. The Migrating S3 buckets. This will edge cache your static objects closer to to CloudFront whitepaper gives you more information. the customer and reduce latency. This is often so easy to do AMAZON ELASTIC MAPREDUCE For analyzing any large dataset or processing large amount of you can create repeatable job flows that can launch a Hadoop media, one can take advantage of Amazon Elastic MapReduce. cluster, process the job, expand or shrink a running cluster Most enterprises have metrics data to process or logs to analyze and terminate the cluster all in few clicks. or large data sets to index. With Amazon Elastic MapReduce, AUTOMATE ELASTICITY Elasticity is a fundamental property of the cloud. To understand be to scale your application horizontally and therefore the benefit elasticity and learn about how you can build architectures that of running it in the cloud is increased. supports rapid scale up and scale down, refer to the Architecting for the cloud whitepaper. Elasticity can be implemented at different levels of the application architecture. Implementing elasticity might require refactoring and decomposing your application into components so that it is more scalable. The more you can automate elasticity in your application, the easier it will In this phase, you should try to automate elasticity. After you have moved your application to AWS and ensured that it works, there are 3 ways to automate elasticity at the stack level. This enables you to quickly start any number of application instances when you need them and terminate them when you don’t, while maintaining the application upgrade process. Choose the approach that best fits your software development lifestyle. MAINTAIN INVENTORY OF AMIS It’s easiest and fastest to setup inventory of AMIs of all the different configurations but difficult to maintain as newer versions of applications might mandate updating the AMIs. MAINTAIN A GOLDEN AMI AND FETCH BINARIES ON BOOT This is a slightly more relaxed approach where a base AMI (“Golden Image”) is used across all application types across the organization while the rest of the stack is fetched and configured during boot time. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 20 MAINTAIN A JUST-ENOUGH-OS AMI AND A LIBRARY OF RECIPES OR INSTALL SCRIPTS This approach is probably the easiest to maintain especially when you have a huge variety of application stacks to deploy. In this approach, you leverage the programmable infrastructure and maintain a library of install scripts that are executed on-demand. Apache Your Code FETCH ON BOOT Your Code FETCH ON BOOT Log4J FETCH ON BOOT Tomcat Struts Apache Your Code Recipes Log4J Apache Struts Log4J Tomcat CHEF Log4J Log4J Spring Spring Struts Apache Apache Your Code Tomcat Log4J Apache Apache Your Code Struts Log4J Apache Log4J Log4J Linux Spring Hibernate JEE Tomcat Spring Hibernate JEE Linux Tomcat Hibernate JEE Linux Hibernate Hibernate Apache JEE JEE Hibernate Linux Linux JEE Tomcat Linux Hibernate Tomcat JEE Apache Tomcat Hibernate Linux JEE CHEF Linux JEE AMAZON EC2 Linux Apache Hibernate JEE JEE Linux Hibernate Hibernate JEE Your Code Spring Spring Hibernate Struts Your Code Hibernate Tomcat Apache Tomcat Your Code Log4J Spring Spring Tomcat Tomcat Struts Log4J Apache Apache Tomcat Struts Linux JEE AMAZON EC2 Linux Linux AMAZON EC2 JEE JAVA AMI JAVA AMI JeOS AMI Linux JAVA APP STACK INVENTORY OF AMIs GOLDEN AMI AND FETCH BINARIES ON BOOT JeOS AMI AND LIBRARY OF RECIPES (INSTALL SCRIPTS) The cloud does not absolve you from your responsibility of securing your applications. At every stage of your migration process, you should implement the right security best practices. Some are listed here: • Safeguard your AWS credentials • Continuously revisit and monitor IAM user policies • Timely rotate your AWS access credentials, and immediately • Leverage the power of security groups in Amazon EC2 rotate if you suspect a breach • Protect your data by encrypting it at-rest (AES) • Leverage multi-factor authentication and in-transit (SSL) • Restrict users to AWS resources • Automate security policies • Create different users and groups with different access • Adopt a recovery strategy privileges (policies) using AWS Identity and • Access Management (IAM) features to restrict and allow access to specific AWS resources • Create periodic Amazon EBS snapshots and Amazon RDS backups. • Occasionally test your backups before you need them AUTOMATE THE IN-CLOUD SOFTWARE DEVELOPMENT LIFECYCLE AND UPGRADE PROCESS In the AWS cloud, there is no longer any need to place purchase With a scriptable infrastructure, you can completely automate orders for new hardware ahead of time or to hold unused hard- your software development and deployment lifecycle. You could ware captive to support your software development lifecycle. manage your development, build, testing, staging and production Instead, developers, system builders, and testers can request environments by creating re-usable configuration tools, mana- the infrastructure they need minutes before they need it, taking ging specific security groups and launching specific AMIs for advantage of the vast scale and rapid response time of the cloud. each environment. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 21 Automating your upgrade process in the cloud is highly recom- versions of software on old machines, but instead throw away mended at this stage so that you can quickly advance to newer old instances and re-launch new fresh pre- configured instances. versions of the applications and also rollback to older versions If upgrade fails, you simply throw it away and switch to new when necessary. With the cloud, you don’t have to install new hardware with no additional cost. CREATE A DASHBOARD OF YOUR ELASTIC DATACENTER TO MANAGE AWS RESOURCES It should be easy and friction-free for the engineering and project forward to create a web client that consumes the web services managers to provision and relinquish AWS cloud resources. At the API and create custom control panels to suit your needs. For same time, the management team should also have visibility into example, if you have created a pre-sales demo application the ways in which AWS resources are being consumed. The AWS environment in the cloud for your sales staff so that they can Management Console provides a view of your cloud datacenter. quickly launch a preconfigured application in the cloud, you It also provides you with basic management and monitoring may want to create a dashboard that displays and monitors the capabilities (by way of Amazon CloudWatch) for your cloud activity of each sales person and each customer. Manage and resources. The AWS Management Console is continually evolving. limit access permissions based on the role of the sales person It offers rich user interface to manage AWS services. However, and revoke access if the employee leaves the company. if the current view does not fit your needs, we advise you to consider using third party tools that you are already familiar with (like CA, IBM Tivoli) or to create your own console by leveraging the Web Service APIs. Using Web Service APIs, It’s fairly straight- There are several libraries available in our Resource Center that can help you get started with creating the dashboard that suits your specific requirement. CREATE A BUSINESS CONTINUITY PLAN AND ACHIEVE HIGH AVAILABILITY (LEVERAGE MULTIPLE AVAILABILITY ZONES) Many companies fall short in disaster recovery planning because the entire process of launching cloud resources which can the process is not fully automatic and because it is cost prohib- bring up an entire cloud environment within minutes. When itive to maintain a separate datacenter for disaster recovery. it comes to failing over to the cloud, recovering from system The use of virtualization (ability to bundle AMI) and data failure due to employee error is the same as recovering from snapshots makes the disaster recovery implementation in an earth-quake. Hence it is highly recommended that you the cloud much less expensive and simpler than traditional have your business continuity plan and set your Recovery Time disaster recovery solutions. You can completely automate Objective (RTO) and Recovery Point Objective (RPO). Your business continuity plan should include: • Data replication strategy • Creating AMIs with the latest patches and code updates (source, destination, frequency) of databases (Amazon EBS) (Amazon EC2) • Data backup and retention strategy • Recovery plan to fail back to the corporate data center (Amazon S3 and Amazon RDS) from the cloud post-disaster The beauty of having a business continuity strategy implemented replication strategies. You can create a much higher availability in the cloud is that it automatically gives you higher availability environment by cloning the entire architecture and replicating across different geographic regions and Availability Zones it in a different Availability Zone or by simply using Multi-AZ without any major modifications in deployment and data deployments (in case of Amazon RDS). ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 22 PHASE 6: OPTIMIZATION PHASE In this phase, you should focus on how you can optimize your cloud-based application in order to increase cost savings. Since you only pay for the resources you consume, you should strive to optimize your system whenever possible. In most cases, you will see immediate value in the optimizations. A small optimization might result in thousands of dollars of savings in your next monthly bill. At this stage, you can ask the following questions: • How can I use some of the other AWS features and services • Do I have the necessary cloud-aware system administration in order to further reduce my cost? tools required to manage and maintain my applications? • How can I improve the efficiency (and reduce waste) • How can I optimize my application and database to run in in my deployment footprint? more elastic fashion? • How can I instrument my applications to have more visibility of my deployed applications? How can I set metrics for measuring critical application performance? UNDERSTANDING YOUR USAGE PATTERNS With the cloud, you don’t have to master the art of capacity facing website, deployed in AWS global infrastructure, does planning because you have the ability to create an automated not expect any traffic from certain part of the world in certain elastic environment. If you can understand, monitor, examine time of the day, you can scale down your infrastructure in that and observe your load patterns, you can manage this elastic AWS region for that time. The closer you can align your traffic to environment more effectively. You can be more proactive if you cloud resources you consume, the higher the cost savings will be. understand your traffic patterns. For example, if your customer- TERMINATE THE UNDER-UTILIZED INSTANCES Inspect the system logs and access logs periodically to under- of the overall system. For example, examine the application stand the usage and lifecycle patterns of each Amazon EC2 that is running on an m1.large instance (1X $0.40/hour) and see instance. Terminate your idle instances. Try to see whether you whether you can scale out and distribute the load across to can eliminate under-utilized instances to increase utilization two m1.small instances (2 X $0.10/hour) instead. LEVERAGE AMAZON EC2 RESERVED INSTANCES Reserved Instances give you the option to make a low, one- server or domain controller. You may want to consider investing time payment for each instance you want to reserve and in turn in Amazon EC2 Reserved Instances (3 year term) for servers receive a significant discount on the hourly usage charge for running above 24% or higher utilization. This can save up to 49% that instance. When looking at usage patterns, try to identify of the hourly rate. instances that are running in steady-state such as a database IMPROVE EFFICIENCY The AWS cloud provides utility-style pricing. You are billed only Improving performance of the application running in the cloud for the infrastructure that has been used. You are not liable for might also result in overall cost savings. For example, if your the entire infrastructure that may be in place. This adds a new application is transferring a lot of data between Amazon EC2 dimension to cost savings. You can make very measureable and your private data center, it might make sense to compress optimizations to your system and see the savings reflected in the data before transmitting it over the wire. This could result your next monthly bill. For example, if a caching layer can reduce in significant cost savings in both data transfer and storage. your data requests by 80%, you realize the reward right in the The same concept applies to storing raw data in Amazon S3. next bill. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 23 MANAGEMENT AND MAINTENANCE Advanced Monitoring and Telemetry Implement telemetry in your cloud applications so it gives identify any performance issues and help you diagnose the root you the necessary visibility you need for your mission-critical causes so you take appropriate actions. For example, if an applications or services. It is important to understand that end-user accessing the nearest node of your globally hosted end-user response time of your applications depends upon application is experiencing a lower response rate, perhaps you various factors, not just the cloud infrastructure – ISP connec- can try launching more web servers. You can send yourself tivity, third-party services, browsers and hops, just to name notifications using Amazon Simple Notifications Service (HTTP/ a few. Measuring and monitoring the performance of your Email/SQS) if the metric (of a given AWS resource or an cloud applications will give you the opportunity to proactively application) approaches an undesired threshold. TRACK YOUR AWS USAGE AND LOGS Monitor your AWS usage bill, Service API usage reports, Amazon S3 or Amazon CloudFront access logs periodically. MAINTAIN SECURITY OF YOUR APPLICATIONS Ensure that application software is consistent and always up to date and that you are patching your operating systems and applications with the latest vendor security updates. Patch an AMI, not an instance and redeploy often; ensure that the latest AMI is deployed across all your instances. RE-ENGINEER YOUR APPLICATION To build a highly scalable application, some components may need to be re-engineered to run optimally in a cloud environment. Some existing enterprise applications might mandate refactoring so that they can run in an elastic fashion. Some questions that you can ask: • Can you package and deploy your application into an AMI can you separate a complex web application into individual so it can run on an Amazon EC2 instance? Can you run components or layers of Web, App and DB and run them multiple instances of the application on one instance, on separate instances? if needed? Or can you run multiple instances on multiple Amazon EC2 instances? • Is it possible to design the system such that in the event of a failure, it is resilient enough to automatically re- launch and restart? • Can you divide the application into components and run them on separate Amazon EC2 instances? For example, • Can you extract stateful components and make them stateless? • Can you consider application partitioning (splitting the load across many smaller machines instead of fewer larger machines)? • Is it possible to isolate the components using Amazon SQS? • Can you decouple code with deployment and configuration? DECOMPOSE YOUR RELATIONAL DATABASE Most traditional enterprise applications typically use a relational database system. Database administrators often start with a DB schema based on the instructions from developer. Enterprise developers assume unlimited scalability on fixed infrastructures and develop the application against the schema. Developers and database architects may fail to communicate with each other on what type of data is being served, which makes it extremely difficult to scale that relational database. As a result, much time may be wasted migrating data to a “bigger box” with more storage capacity, or scaling up to get more computing horsepower. Moving to the cloud gives them the opportunity to analyze their current relational database management system and make it more scalable as a part of the migration. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 24 Some techniques that might help take the load off of your RDBMS: • Move large blob object and media files to Amazon S3 and • Move all relational data into Amazon RDS so you have the store a pointer (S3 key) in your existing database flexibility of being able to scale your database compute and • Move associated meta-data or catalogs to Amazon SimpleDB • Keep only the data that is absolutely needed (joins) in the relational database storage resources with an API call only when you need it • Offload all the read load to multiple Read Replicas (Slaves) • Shard (or partition) the data based on item IDs or names IMPLEMENT BEST PRACTICES Implement various best practices highlighted in the Architecting for the cloud whitepaper. These best practices will help you to create not only a highly scalable application conducive to the cloud but will also help you to create a more secure and elastic application. SIDE-BY-SIDE APPLICATION PERFORMANCE MONITORING As you go through the migration process, you have the applicable, and via running on the AWS environment. Then go opportunity to monitor and review application performance to the Applications overview section and you can see the same in a single dashboard via New Relic. Install New Relic in application and performance comparisons as it runs in different your applications both in your on-premise environment, if environments. Example graph showing performance running the same application on-premise compared to running on AWS: ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 25 Appendices: A: NEW RELIC JAVA AGENT SELF-INSTALLER Note: Currently the self-installer is fully compatible with For Java agent installation tips, watch this New Relic Tomcat, Jetty, JBoss, and Glassfish. Other platforms may still video (approximately 1 minute). require manual editing of the start scripts. QUICK LINKS • Use the Java self-installer • Uninstallation • Alternate file download procedure • Jsvc on Windows • Running the installer • For more help USE THE JAVA SELF-INSTALLER Note: To use the Java agent, you need a New Relic account. If you have created an account but not yet installed New Relic, when you log in you will be taken to the Get started with Web App Monitoring page. 1. Log in to New Relic. 3.Click the big, orange Download button. 2.Select Java from the Installation instructions drop down. When you use this method, the downloaded files will include basic information about your New Relic account. Unless you have special install considerations, you should be able to complete your New Relic install by following the directions on Get started with Web App Monitoring. This page provides additional information on the install process. Get started with Web App Monitoring: Your initial landing page when you first create a New Relic account. You can pick which platform you are using with the Installation instructions drop down. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 26 ALTERNATE FILE DOWNLOAD PROCEDURE The Account settings page has a list of the most recent agents • Unpack newrelic.zip into your app server’s root directory. by platform in the right-hand column. For Glassfish, and unpack newrelic.zip into your domain’s • From the title bar, select (account name) > Account settings. • Download the agent for your platform. directory. unzip newrelic.zip -d /path/to/appserver/ • Copy a clean config file into the newrelic directory. Account settings is on the title bar in the menu under your account name. RUNNING THE INSTALLER The installer is bundled inside the agent jar. Execute it from the newrelic directory with the install command. cd /path/to/appserver/newrelic java -jar newrelic.jar install The installer will find your start script, back it up, and edit it to add the agent switch. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 27 Optional Options for the installer include: Option Description -h Display the usage help -l licensecode Account license key -s /path/to/applicationserver Location of your application server. Required if newrelic not located in your app server home directory The installer provides feedback on whether the install succeeded. • If it runs successfully, it will tell you to restart your app server, exercise your app, and log in to see your data. • If it did not complete, it will explain why, and point you to Java agent manual install. UNINSTALLATION 1. Rename your backed-up start script to its original name. 2.Delete the newrelic directory from your app server’s root directory. 3.Restart your server. JSVC ON WINDOWS On Windows, the installer will add itself to catalina.bat, but not to the jsvc startup command. Look for jsvc support in an upcoming release. FOR MORE HELP Additional documentation resources include: • Java agent manual installation (directions for manual install on Java platforms) If you still have problems, submit a support ticket (for fastest service) or email support @ New Relic. Also, you may be able to find support from the community at Stack Overflow. Tag your post with newrelic. • New Relic for Java (system requirements and directions for other Java platforms) ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 28 APPENDIX B: ELASTIC BEANSTALK INSTALLATION FOR JAVA To install New Relic you will need: •A New Relic account. • A supported Amazon Web Services account. QUICK LINKS • Downloading New Relic • Agent activation • Installation • For more help DOWNLOADING NEW RELIC To download the latest New Relic agent: 1. Log in to New Relic. 2.From the New Relic title bar, select (account name) > Account settings. 3.Select the option to download the agent for your platform. As part of the installation process you will use the newrelic.jar and newrelic.yml files. Account settings is on the title bar in the menu under your account name. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 29 INSTALLATION Your newrelic.yml (config) file should work without modification. If you decide to customize your config file, see Java agent configuration. • In your WAR file, add the newrelic.jar and newrelic.yml files • Re-package and deploy your new WAR file, as a new to WEB-INF/lib/. application or an update to a previous application. AGENT ACTIVATION Note: These directions are for the Tomcat 6/7 container. You may need to alter the file path for your container. • From the Default Environment page, select Environment Details > Overview. •Select Edit Configuration. • From the Container tab, enter the following into the JVM Command Line Options field: For Tomcat 6 -javaagent:/var/lib/tomcat6/webapps/ROOT/WEB-INF/lib/newrelic.jar For Tomcat 7 -javaagent:/usr/share/tomcat7/webapps/ROOT/WEB-INF/lib/newrelic.jar • Click Apply Changes. The JVM will re-start and the application should start appearing in your New Relic account within minutes. Default Environment > Environment Details > Overview > Configuration: FOR MORE HELP Add the New Relic path to the Container field. Additional documentation resources include: • Elastic Beanstalk documentation • Java agent configuration (Amazon documentation for Elastic Beanstalk) (directions for manual install on Java platforms) • Java agent self installer • New Relic for Java (directions for working with the config file) (system requirements and directions for other Java platforms) • Manual Java agent installation (directions for manual install on Java platforms) If you still have problems, submit a support ticket (for fastest service) or email support @ New Relic. Also, you may be able to find support from the community at Stack Overflow. Tag your post with newrelic. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 30 APPENDIX C: DATABASE AND SLOW SQL New Relic’s Database feature shows individual database transactions as a table that you can sort. It also shows database operations, throughput, and response time as charts. If slow SQL information is available, it appears in the Slow SQL traces section at the bottom of the dashboard. Note: The Slow SQL feature is for New Relic Pro and higher. QUICK LINKS • Procedures • Slow SQL troubleshooting • Slow SQL • For more help PROCEDURES To view information about database performance: From the New Relic menu bar, select Applications > (your application’s name) > Monitoring > Database. Applications > (your app) > Monitoring > Database: Use this dashboard to view and sort detailed information about database performance and slow SQL (if applicable). ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 31 In addition to the standard New Relic UI and dashboard drill-down functions, the Database dashboard has additional functions. • To view details about a chart, point or click anywhere on it. • To view details about a individual database transactions • To close the transaction window and return to the Database dashboard, click the closeX button. or slow SQL transaction traces, click the individual row. Applications > (your app) > Monitoring > Database > (selected transaction): Here is an example of the details window for an individual database transaction. If slow SQL information is available, it appears at the bottom of the Database dashboard. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 32 SLOW SQL Slow SQL samples are examples of the worst performing SQL on your site. Along with the SQL, New Relic collects the context and diagnostic information you need to fix your database performance issues. To view slow SQL information: 1. From the New Relic menu bar, select Applications > 3.To view additional details, click the Query analysis or (your application’s name) > Monitoring > Database. Stack trace links. 2.From the Slow SQL traces section, click any row to 4.To exit the SQL information and return to the Database view SQL details. dashboard, click the close X button. Applications > (your app) > Monitoring > Database > (selected SQL transaction): Here is an example of the details window for an individual SQL trace transaction. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 33 For context, New Relic includes a stack trace and the start time. The agent captures all SQL that exceed the transaction trace The stack trace shows you where in the code the statement explain plan threshold. The agent aggregates similar statements was called, and the start time shows you when it was collected. together but only keeps the details for the worst of each similar To diagnose the problem, New Relic shows the maximum statement. Every minute, the agent sends several samples to time for all similar collected SQL statements and the total Tip: To define your SQL obfuscation preferences: From the New Relic number of statements collected (the sample count). This is not menu bar, select Applications > (your app) > Settings > Application, and click Show advanced settings. Then select your choices in the total number of times it was called in your application, but the Transaction tracing settings for slow SQL. the number of times New Relic identified it as one of the slower Exception: PHP users must use their .ini file, not the user interface, SQL statements in your site. In addition, New Relic collects to define slow SQL settings. the explain plan whenever possible. In MySQL, New Relic provides a query analysis, which explains the New Relic service. These represent the worst performing what happened in your query and what you might do to speed SQL statements during that minute. it up. Other databases display an explain plan. SLOW SQL TROUBLESHOOTING If you do not see slow SQL in the New Relic user interface, make sure: • Your New Relic account is Pro or higher. • The Slow SQL feature is enabled in your agent configuration. (From the New Relic menu bar, select Applications > (your application’s name) > Settings > Application, and verify that the Slow SQL checkbox option is selected.) • The transaction trace explain plan threshold is lower than the execution time of your SQL. (From the New Relic menu bar, select Applications > (your application’s name) > Settings > Application, and click Show advanced settings. Then verify the Transaction tracing settings for slow SQL.) Exception: PHP users must use their .ini file, not the user interface, to define slow SQL settings. FOR MORE HELP Additional documentation resources include: • Transaction Traces • SQL statements (overview of transaction traces) (viewing the SQL Statements tab for a transaction trace) • Security options for transaction traces (SQL queries, HTTP parameters, and customization options for enhanced security) If you still have problems, submit a support ticket (for fastest service) or email support @ New Relic. Also, you may be able to find support from the community at Stack Overflow. Tag your post with newrelic. DEPLOYMENTS DASHBOARD ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 34 The Deployments dashboard lists recent deployments and the error, share it with others, or file a ticket about it. To view their impact on your end user and app server’s Apdex scores, the Deployments dashboard: From the New Relic menu bar, response times, throughput, and errors. You can view and select Applications > (your application’s name) > Events > drill down details, use search and sort options, hide or delete Deployments. Applications > (your app) > Events > Deployments > Show Instructions: Here is an example of the online instructions for sending deployment information by HTTP. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 35 SETUP The Deployments dashboard includes a Show instructions link with details on how to configure your system to record deployments. For example, you can send deployment information directy by HTTP with New Relic’s REST API. Here is an example of using curl to send deployment information directly by HTTP with your API key and application ID: Applications > (your app) > Events > Deployments: Here is an example of the Deployments dashboard and details about a selected deployment. PROCEDURES After you configure the deployments information, you can view and drill down into details: From the New Relic Tip: The Deployments dashboard link for individual deployments also appears on the selected app’s Overview dashboard in the Recent Events section. menu bar, select Applications > (your application’s name) > Events > Deployments. From here you can use any of the available standard New Relic UI and dashboard drilldown functions. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 36 To view a dashboard with details about an event on the If applicable, you can also select the Change Log and Change Deployments dashboard, click its date link. Or, to view the Report tabs for a specific deployment. errors dashboard for the deployment, click the error link. APPENDIX D: NEW RELIC PLATFORM (PLUGINS) THE PLUGIN CENTRAL DIRECTORY The plugin agent collects, sends, and stores the metric data in From Plugin Central, users can select and download whatever New Relic. Plugin Central provides a searchable directory for plugins they want to use. After users install or configure a plugin, plugins that developers publish and make publicly available they can view the plugin’s dashboard data securely from New to users. New Relic has developed a plugin that pulls Amazon Relic’s user interface. CloudWatch metrics into the New Relic dashboard (via an AMI). Plugins > Plugin Central: Select any published plugin from New Relic’s Plugin Central directory to view a description and install it. ©2008-13 New Relic, Inc. All rights reserved. APPLICATION MIGRATION TO AWS WITH NEW RELIC | 37 VIEWING PLUGINS IN PLUGIN CENTRAL To view information about available (published) plugins, go to New Relic’s Plugin Central. By default, available plugins appear in alphabetical order. 1. From the New Relic menu bar, select Plugins. 5.From the plugin’s description page, review additional details. 2.From the Plugin Central alphabetical directory, review 6.To learn more about the plugin’s publisher, the descriptions of publicly available plugins. click About us or Support site. 3.Optional: To limit the directory listing, type a value in 7.To select a plugin, click its Download or Continue button, Search plugins. and follow the online instructions to get your plugin installed 4.To view additional details about a plugin, click the plugin’s title or its Get started button. and running. Or, to return to the Plugin Central directory, click your browser’s Back icon. Depending on the selected plugin, installation and configuration instructions will vary. Refer to your plugin’s documentation for specific details. After you install or configure a plugin, it automatically appears on your New Relic menu bar, where you can select and view it directly. You may need to wait a few minutes for data to appear. Here is an example of a plugin the user has downloaded and installed from New Relic’s Plugin Central. ©2008-13 New Relic, Inc. All rights reserved.