MongoDB Management Service To Rescue Your Application!

In today’s tutorial we’ll be looking at:
Installing Python
Installing PyMongo (Note: PyMongo is a python driver for MongoDB)
..and running mms-agent from your computer(localhost)

I’m using Windows 7 64-bit machine and the installation procedure are shown for the same.

mms-on-devices

Disclaimer: This is not a paid post and neither am I using any affiliate links in this post. I found MMS(MongoDB Management Service) incredibly useful and I wish I knew about it earlier. The monitoring and alerting services can save your applications reputation, and the backup service will literally save your application in disasters situations.

Requirements
MongoDB software: MongoDB – Getting Started Guide
Python 2.7.3
Setuptools
PyMongo driver software

mms-installation-software

Why use MMS ?

  • MMS tracks the key database and hardware metrics important for managing a MongoDB deployment
  • Performance Visualization
  • Custom Alerts
  • Back-up service ..etc

MongoDB Management Service To Rescue Your Application!


[youtube https://www.youtube.com/watch?v=HkvrksJL3Jg]

YouTube Link: https://www.youtube.com/watch?v=HkvrksJL3Jg [Watch the Video In Full Screen.]



Steps
Step 1: Install Python 2.7.3 at C:\Python27
Step 2: Install setuptools
Command to install setuptools

1
2
C:\>cd Python27
C:\Python27>python D:\Python\setuptools\ez_setup.py

This installs easy_installer inside C:\Python27\Scripts folder. Easy installer helps in installing drivers.
Step 3: Now install Pythons MongoDB driver: PyMongo, with the following command.

1
2
C:\Python27>cd Scripts
C:\Python27\Scripts>easy_install PyMongo

This would install PyMongo driver

Step 4: Start MongoDB server.

Step 5: Log into your MMS account, and download the MMS-AGENT. Extract the mms-agent files into a folder. In our case, we extract it to D:\Python\mms-agent
Step 6: Now run the mms-agent with the following command

1
2
3
4
C:\>D:
D:\>cd Python
D:\Python>cd mms-agent
D:\Python\mms-agent>agent.py

This starts mms-agent.

Step 7: Go to your mms account – Fill the form with the host name, port number and other details

add-a-host-mongoDB-management-service-mms

Host Type: Standalone (for this example)
Internal Hostname: 127.0.0.1 (ip address for localhost)
Port: 27017 (default port used my MongoDB server)
DB Username and DB Password: are optional

inside-mms-account

Now it’ll start to fetch the meta data metrics via your IP address, as the agent is installed on your local machine and it knows your network IP address.

inside-mongoDB-management-service-account

Key things inside your account
Events: restart, shut-down or downtime etc
Alerts: To alert you in certain situations. You get emails for downtime etc, once setup.
Backup: It’s a premium service, which costs a little – backup service is pay-as-you-go service billed via credit card.
Users: You could invite people as admin or read only user. This way, you could bring in your team mates/colleagues to analyze and help you in performance tuning of your application.
Dashboard: You can customize your dashboard to give you quick view of key aspects of your application is a rich web console. You could have RAM usage statistics or query performance metrics etc.
Settings: Normal profile information: email id, password, phone verification etc.

Application Performance
Checking with the query performance and your application behavior from the very beginning of application development is recommended. And MMS is a perfect solution for this. This is one of the main reasons for this video tutorial. Running MMS on production servers is easy. You’ve bunch of plugins pre-installed at your host, you just need to enable it and insert the secret keys provided to you inside mms-agent file. But I would recommend you to watch for your application behavior from as early as in its development stage.

Note: You should know the norms of your application behavior, so that you can notice when there is abnormalities. MMS helps you effectively do that.

MongoDB Management Service is free service for getting metrics and setting alerts. And you only pay, if you use backup service and you pay for it as you use it.

Optimize / Improve Performance of jQuery Applications

Video tutorial illustrating simple tweaks which help optimize / improve the performance of jQuery Applications.

To Optimize
1. Write all javascript programs in an external file and embed it into the html pages.
2. Whenever possible, embed the javascript file at the end of body tag. i.e., just before the closing body tag.
3. It’s also good practice to separate CSS coding to an external file and then embed it to the web pages.

How it helps ?
1. i. If you have thousands of web pages, writing the same code on all the pages and maintaining it and/or modifying it is a touch job.
Having it in an external file helps in re-usability and maintainability.
ii. It only loads the javascript files once and do not load the same files again and again for all other pages, hence saving a lot of bandwidth. Also highly optimizing the load time of web pages.
2. When the parser encounters these javascript files, they stop loading all other elements and allocate all its bandwidth to load javascript file. So writing it at the end of body tag helps. Since all other important elements like images, content will be loaded before these time-consuming javascript files.

Video Tutorial: Optimize / Improve Performance of jQuery Applications


[youtube https://www.youtube.com/watch?v=BsPgkr-YGMs]

YouTube Link: https://www.youtube.com/watch?v=BsPgkr-YGMs [Watch the Video In Full Screen.]



Above video uses Animation of Text and Image: jQuery code to illustrate the optimization concept. If you have not already seen the video, we highly encourage you to watch it and practice it.

In our future tutorials we will be writing most of our javascript code in external file and will be embedding them at the end of body tag. With this tutorial you know why we would do that!