big data analytics in m2m

13
Big Data Analytics In M2M WHITE PAPER Performance Optimization of EMS commands

Upload: others

Post on 26-Apr-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Big Data Analytics In M2M

Big Data Analytics In M2M

WHITE PAPER

Performance Optimization of EMS commands

Big Data Analytics In M2M

WHITE PAPER

Page 2: Big Data Analytics In M2M

2 | © 2015, HCL Technologies. Reproduction Prohibited. This document is protected under Copyright by the Author, all rights reserved.

Table of Contents

Abstract ............................................................................................. 3

About Exchange Server ..................................................................... 4

High Level Architecture of Exchange Server Environment .............. 5

Approaches to Execute EMS Commands .......................................... 6

Case Study ......................................................................................... 8

High Level Approach to Optimize the Execution .............................. 9

Proof Points of Success from the Case Study ................................. 11

Conclusion ....................................................................................... 11

References ...................................................................................... 12

About the Author ............................................................................ 12

Page 3: Big Data Analytics In M2M

3 | © 2015, HCL Technologies. Reproduction Prohibited. This document is protected under Copyright by the Author, all rights reserved.

Abstract

This paper provides an approach for optimizing the execution time of Exchange Server Management

Shell (EMS) commands. Conventionally, a web application developed in Java will use EMS commands by

invoking Powershell commands directly. But, this method provides very slow response, and the GUI or

application using this method will get into an unresponsive state due to the slow performance of the

EMS commands.

To find alternative methods to this approach, a case study was done to improve the performance of

Java-based web applications. This whitepaper captures the case to improve the execution time of the

web application calling the EMS commands.

Page 4: Big Data Analytics In M2M

4 | © 2015, HCL Technologies. Reproduction Prohibited. This document is protected under Copyright by the Author, all rights reserved.

About Exchange Server Microsoft Exchange Server is a calendaring software, a mail server, and a contact manager developed by

Microsoft. It is a server program that runs on Windows Server and is part of the Microsoft Server line of

products.

Introduction to Exchange Management Shell (EMS) commands EMS commands mean the PowerShell commands available to manage Exchange Server with respect to

all the available mailbox and mail server related operations.

In general, every EMS command could be executed using the PowerShell prompt or Exchange

Management Shell console, so that the required Exchange Server management operation could be

performed. The operations could be any or all of the following:

Creation of a mailbox

Getting the mailbox database information

Getting the mailbox database statistics

Mounting the mailbox

Dismounting the mailbox

Restoring the mailbox, and more

The above listed commands are majorly used to manage Exchange Server in storage systems over the

Exchange Management Shell where the Exchange Server has been deployed.

The following table details the commands which are taken in to consideration to optimize the execution

time w.r.t the case study as mentioned in Case Study.

Sl. No.

Exchange Management Shell Command

Purpose of Command Command Syntax

1 Get-MailboxDatabase This command will provide the list of all mailbox databases against the provided server.

Get-MailboxDatabase -Server {MailboxServerName} -Status | Format-List Name,Recovery,WhenCreated,Mounted

2

Dismount-Database This command will dismount the database against the provided database name.

Dismount-Database -Identity {DatabaseName} -Confirm:$false

3 Mount-Database This command will mount the database against the provided database name.

Mount-Database -Identity {DatabaseName} -Confirm:$false

4 Get-MailboxStatistics This command will provide the information – i.e. size of mail box, number of messages it contains, and

Get-MailboxStatistics -Database {DatabaseName} | Format-list DisplayName,Itemcount, LastLogonTime

Page 5: Big Data Analytics In M2M

5 | © 2015, HCL Technologies. Reproduction Prohibited. This document is protected under Copyright by the Author, all rights reserved.

the last time it was accessed against the provided database name.

5 New-MailboxRestoreRequest

This command will restore a soft-deleted or disconnected database.

New-MailboxRestoreRequest -SourceDatabase {RecoveryDatabase} -SourceStoreMailbox {SourceMailboxName} -TargetRootFolder {TargetRootFolder} -TargetMailbox {TargetMailbox}

High Level Architecture of the Exchange Server Environment The following diagram describes the basic high level design to setup the Exchange Server environment.

Diagram 1: Exchange Server High Level Architecture

Based on the diagram above, the individual environment component details are as follows:

Sl. No.

Diagram Components

Details

1 Active Directory Active Directory (AD) is a directory service that Microsoft developed for Windows domain networks, and is included in most Windows Server operating systems as a set of processes and services.

2 LAN A local area network (LAN) is a computer network that interconnects computers within a limited area, such as a home, school, computer laboratory, or office building, using network media.

3 Exchange Server Microsoft Exchange Server is a calendaring software, a mail server, and a contact manager developed by Microsoft. It is a server program that runs on Windows Server and is a part of the Microsoft Server line of products.

4 Workstations Workstations are the machines that are connected to the LAN of a

Exchange Server

Active Directory

LAN

Firewall

WorkStation1 WorkStation2

Page 6: Big Data Analytics In M2M

6 | © 2015, HCL Technologies. Reproduction Prohibited. This document is protected under Copyright by the Author, all rights reserved.

premise and would be used to access the Exchange Server after authenticating the users from the concerned Active directory.

The details added above, are captured from web links for which the respective web link references are added in the Reference section of this paper.

Approaches to execute EMS commands There are multiple ways to execute EMS commands, as shown in the following diagram.

In order to provide the details, we first need to understand the high level design of command execution.

Diagram2: Ways to execute Exchange Management Shell commands

The following sub-sections describe the command execution approaches in a bit more detail.

Execution from PowerShell prompt

The EMS command can be executed from the Windows PowerShell prompt, and the command syntax would be like this: 1) First, execute the following command over PowerShell prompt. This command would initialize the

environment to run the EMS command from PowerShell prompt :

If we are going to execute the EMS command from PowerShell prompt, then the following command is mandatory to execute.

Exchange Server

Active Directory

Execution Interface: Execution from PowerShell prompt (Or) Execution from EMS console (Or) Programmatically execution from Java (Or) Programmatically execution from C# through SDK Execution

Exchange Management Shell Command Execution

Page 7: Big Data Analytics In M2M

7 | © 2015, HCL Technologies. Reproduction Prohibited. This document is protected under Copyright by the Author, all rights reserved.

PS C:\Users\administrator>add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010

2) Execute the required EMS command over PowerShell prompt:

PS C:\Users\administrator> Get-MailboxStatistics -Database "Mailbox Database 0997598911" | Format-list DisplayName,Itemcount, LastLogonTime

Execution from Exchange Management Shell console

The EMS command can directly be executed from the Exchange Management Shell prompt; the command syntax would be like this: (no need to initialize the environment because the command is being executed from Exchange Management Shell prompt)

PS C:\Users\administrator> Get-MailboxStatistics -Database "Mailbox Database 0997598911" | Format-list DisplayName,Itemcount, LastLogonTime

Programmatical execution from Java

The EMS command can be executed using Java; the sample command syntax would be like this:

PowershellPath -PSConsoleFile ExchangeConsoleFile -Command "get-mailboxdatabase -Server {MailboxServerName} -Status | Format-List Name,Recovery,WhenCreated,Mounted"

In this approach, first “add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010” the command should be executed in order to execute to EMS command.

Programmatically execution from C# Other than the Exchange Management Shell, Microsoft also provides Windows PowerShell SDK using which we can see how the performance can be improved when used through the Java application. Using the SDK Exchange Management Shell commands for execution, the sample code snippet would be like this:

//Environment Creation and Initialization RunspaceConfiguration rsConfig = RunspaceConfiguration.Create(); PSSnapInException snapInException = null; PSSnapInInfo info = rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.E2010", out snapInException); Runspace runspace = RunspaceFactory.CreateRunspace(rsConfig); runspace.Open(); //Command creation and Execution Command getMailbox = new Command("Get-MailboxDatabase");

Page 8: Big Data Analytics In M2M

8 | © 2015, HCL Technologies. Reproduction Prohibited. This document is protected under Copyright by the Author, all rights reserved.

getMailbox.Parameters.Add(new CommandParameter("Server", "<Name of Server>")); Pipeline commandPipeLine = runspace.CreatePipeline(); commandPipeLine.Commands.Add(getMailbox); Collection<PSObject> getmailboxResults = commandPipeLine.Invoke();

Case Study

The problem in consideration is a web application that is monitoring /managing the Exchange Server by invoking the EMS commands. The commands take a very long time to execute because every command needs an environment scenario, as described below:

Page 9: Big Data Analytics In M2M

9 | © 2015, HCL Technologies. Reproduction Prohibited. This document is protected under Copyright by the Author, all rights reserved.

When an EMS command is executed, it would require a referencing environment in which the command itself can be validated and executed. This referencing environment activity would take a long time to execute any command, because in this condition, every command corresponds the following time: a) Time taken to initialize or create the referencing environment.

+

b) Time taken to execute the Exchange Management Shell command.

Due to this reason, every command requires total time (i.e. a + b as mentioned above), in which (a) plays a major role for every command. In the absence of (a), (b) by itself is nothing. Once the above action is performed from a web application, then the web page gets unresponsive due to the action taking time (i.e. (a) + (b) as mentioned above).

The conventional method of executing, using the PowerShell Management console, is given in the sample code mentioned in section programmatically execution from Java. The provided case study is based on an investigation to optimize the performance of Exchange Management Shell Command Execution time programmatically instead of running from PowerShell and Exchange Management Shell (Exchange Management Shell) prompt. The case study describes the high level design of an existing implementation.

Diagram3: Current execution method of Exchange Management Shell commands

High level approach to optimize the execution After analyzing the existing approach used along with the captured data points of every command execution, the following high level solution was derived. It uses C# as a core in which the Windows PowerShell SDK has been used to execute the EMS command. The C# native wrapper should be used by

Exchange Server

Active Directory

Web application: For every command, the following action should be executed:

1) Initialization of Exchange

Environment

2) Execution of Exchange

Management Shell command

Exchange Management Shell Command Execution

Page 10: Big Data Analytics In M2M

10 | © 2015, HCL Technologies. Reproduction Prohibited. This document is protected under Copyright by the Author, all rights reserved.

the existing core web application to execute the EMS command programmatically, not by forming the PowerShell command as mentioned in section programmatically execution from Java.

Diagram4: High level approach to optimize the execution of Exchange Management Shell command

In order to optimize the performance of EMS command execution time, the initialization / referencing the environment would be initiated only once in that object life cycle, so that every command would take the reference from the same object to execute the EMS command. As per the diagram above, it is clear that Logic to Initialization of Exchange Environment of C# is called once in that object’s life cycle and other commands would take the reference to execute. This approach is proven to tremendously enhance the performance gain for every command.

Exchange Server

Active Directory

C# Wrapper Logic to Initialization of Exchange Environment Logic to execute the individual Exchange Management Shell command.

Exchange Management Shell Command Execution

PowerShell

SDK

Native Layer

Caller Web Application: Call to Logic of Initialization of Exchange Environment. Call to Logic of Execute the individual Exchange Management Shell commands.

Page 11: Big Data Analytics In M2M

11 | © 2015, HCL Technologies. Reproduction Prohibited. This document is protected under Copyright by the Author, all rights reserved.

Proof points of success from the Case study After comparing the facts captured from the previous implementation, we see that the performance gain is enhanced tremendously. The following table describes the performance gain achieved after implementing the solution.

Exchange Management Shell Command Performance Gain increased more than 50%

Get-Mailboxdatabase 54.79%

Get-MailboxStatistics 97.99%

Mount-Database 80.36%

Dismount-Database 90.52%

New-MailBoxRestoreRequest 78.10%

Conclusion Based on the high level solution / approach as mentioned above, the following has been observed as the findings for performance optimization in time:

Page 12: Big Data Analytics In M2M

12 | © 2015, HCL Technologies. Reproduction Prohibited. This document is protected under Copyright by the Author, all rights reserved.

1) Microsoft PowerShell SDK has better performance in terms of time than using the PowerShell

console or Exchange Management Shell commands.

2) To improve performance, when C# SDK is called from the web application, a native layer can be

utilized.

3) By utilizing the native layer, the initialization time (which is high every time a command is called) is

now segregated from the commands’ actual execution time.

4) Therefore, there was a significant and visible performance gain in terms of command execution time

of the Exchange Management Shell using this approach.

5) The derived solution provides a tremendous performance gain of 54% - 98% (on a case to case basis

for different commands).

Special thanks to Yash Agarwal for guidance on this paper.

References

http://en.wikipedia.org/

https://msdn.microsoft.com/en-us/library/dd182449(v=vs.85).aspx

http://en.wikipedia.org/wiki/Active_Directory

http://en.wikipedia.org/wiki/Local_area_network

http://en.wikipedia.org/wiki/Microsoft_Exchange_Server

About the author Naveen Kumar Jain

Naveen has more than 10 years of experience in application development using various programming languages. He has experience in various domains - Finance, Job Search, Infrastructure Monitoring, and BPMN, and is currently working for the Storage domain. He is involved in designing and implementing backup and restore solutions.

Page 13: Big Data Analytics In M2M

Hello, I'm from HCL's Engineering and R&D Services. We enable technology led organizations to go to market with innovative products and solutions. We partner with our customers in building world class products and creating associated solution delivery ecosystems to help bring market leadership. We develop engineering products, solutions and platforms across Aerospace and Defense, Automotive, Consumer Electronics, Software, Online, Industrial Manufacturing, Medical Devices, Networking & Telecom, Office Automation, Semiconductor and Servers & Storage for our customers. For more details contact: [email protected] Follow us on Twitter: http://twitter.com/hclers & LinkedIn: http://lnkd.in/bt8hDXM View our blog-site: http://www.hcltech.com/blogs/engineering-and-rd-services Visit our website: http://www.hcltech.com/engineering-rd-services