You have had a great idea, you got it developed, deployed it and have customers vying to buy it. But then suddenly it all stops! The reason is the slow running of your application. With the market littered with thousands of applications, a slow application is a sure-shot recipe of disaster. No matter how amazing your application is, if it runs slow or have other performance issues, it won’t amount to anything.
Ensuring the performance of an application is as important as the application itself. And that can be done with New Relic which is a performance management system. It provides in-depth information about your Ruby on Rails application as it runs in production. It can not only improve your product but can affect the bottom-line of your business in a positive way and keep your customers happy.
Check out the steps below to understand how you can monitor your application with New Relic:
The New Relic Ruby Agent runs in one of two modes:
Production Mode Low overhead instrumentation that captures detailed information on your application running in production and transmits them to newrelic.com where you can monitor them in real time.
Developer Mode
A Rack middleware that maps /newrelic to an application for showing detailed performance metrics on a page by page basis. Installed automatically in Rails applications.
NewRelic Setup
To add ruby-agent to your project add the gem in your gemfile
gem ‘newrelic_rpm’
Create an account in newrelic.com. You will get a 30 day free trial version
Once you signup download newrelic.yml file
Copy and paste the file in your project config folder
Project/config/newrelic.yml
Installation
Bundle install (after adding gem into gemfile)
Rails 2.x without bundler
config.gem “newrelic_rpm” (In environment.rb)
After installation of newrelic go to the newrelic.yml and look into it by default you will get
Development, test, staging and production environments
You can change/add the environment name like staging can change it to uat.
You can find developer_mode only for development environment, so what is developer_mode?
developer_mode:
New Relic Agent will present performance information on the last 100 transactions you have executed since starting the mongrel
NOTE: There is substantial overhead when running in developer mode (Do not use for production or load testing.)
To view the performance information including SQL statement
localhost:3000/newrelic (If your application is running in port 3000)
Set the application name for your required environment, so that the application name will be appearing on your newrelic dashboard and it will be easy to monitor without the name ambiguity
Zum Beispiel:
Produktion:
<<: *default_settings
monitor_mode: true
app_name: Sample_Project
So when you open NewRelic dashboard you can find Sample_Project under Name column, click on it to see all the transactions.
Advantage of NewRelic Monitoring:
- The main advantage of newrelic is Application Performance Management (APM).
- New Relic APM is the only tool you’ll need to see everything in your Ruby application from the end user experience to server monitoring. Trace slow database queries, 3rd party APIs and web services, caching layers, background jobs, and more. Ruby monitoring has never been easier.
- Error Rate: the agent collects and reports all uncaught exceptions by default.
- Transaction history with graphs.
- SQL Query in Transaction block.
- You can also find most time consuming methods, what is making it slow.
- You can also trace background-jobs.
- Every time you’re working on the performance of your application, it’s always good to know what kind of effect does a particular deploy has on the performance of the application. To understand the effect, you can notify New Relic when you are performing a deployment. This way if performance degrades or improves by setting key transactions, you will get to know and then measures could be taken to improve the performance.
Newrelic is a complete tool to monitor your application and quickly response on the errors and help in serving end users in an optimized way.
Unsere Entwickler sind mit allen möglichen Aufgaben bestens vertraut Ruby on Rails-Entwicklungsarbeit und Abwicklung von Projekten jeglicher Art. Kontaktiere uns um mehr über unsere Entwicklungskompetenzen und die Projekte zu erfahren, die wir bearbeiten können.