Building ERP Solutions with Microsoft Dynamics NAV

By Stefano Demiliani
  • Instant online access to over 7,500+ books and videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Introduction to Microsoft Dynamics NAV Architectures

About this book

Implementing Microsoft Dynamics NAV in the real world often requires you to integrate the ERP with external applications or solve complex architectural tasks in order to have a final successful project. This book will show you how to extend a Microsoft Dynamics NAV installation to the enterprise world in a practical way.

The book starts with an introduction to Microsoft Dynamics NAV architecture and then moves on to advanced topics related to implementing real-world solutions based on NAV and external applications. You will learn how an enterprise distributed architecture with NAV at the core can be implemented.

Through a series of real-world cases on every topic and every industry (sales, retail, manufacturing, distribution, healthcare, and so on), you’ll see step by step how to efficiently solve a technical problem. These common problems encountered in a NAV implementation will be solved using the entire technology stack that Microsoft offers.

By the end of the book, you will have the knowledge to efficiently solve certain scenarios, you will know which is the best solution architecture to propose to a customer and how to implement it.

Publication date:
March 2017
Publisher
Packt
Pages
392
ISBN
9781787123083

 

Chapter 1.  Introduction to Microsoft Dynamics NAV Architectures

Microsoft Dynamics NAV is an Enterprise resource planning (ERP) software and it is part of the Microsoft Dynamics product's family.

In this chapter, we will cover the following topics:

  • Microsoft Dynamics NAV and its functional areas 

  • History of Microsoft Dynamics NAV 

  • An overview of Microsoft Dynamics NAV architectures and components

  • NAV deployment's solutions and the differences between them

 

Introducing Microsoft Dynamics NAV


Microsoft Dynamics NAV delivers integrated functionality to provide support for the following aspects:

  • Financial management

  • Supply chain management

  • Manufacturing

  • Distribution

  • Customer relationship management

  • Sales and marketing

  • Service management

  • Human resource management

  • Project and resource management

  • Warehouse management

Microsoft Dynamics NAV is considered to be one of the most versatile and agile ERPs on the market. It's very quick and affordable to customize and it has the power to be able to grow with your business needs.

With NAV you can customize every aspect of the application (from fields to business logic) and you can build new modules from scratch. You have complete access to the source code of the application and you have an integrated environment that helps you to make customizations and implementations.

 

Microsoft Dynamics NAV history


Microsoft Dynamics NAV was born from Navision, a suite of accounting applications which Microsoft acquired in 2002.

Navision was created at Personal Computing and Consulting (PC&C A/S), a company founded in Denmark in 1983 by three college students. This company released its first accounting package, PC Plus, in 1984 (a single-user character-based application) and then in 1987 they released the first version of Navision, a character-based client/server accounting application that works over a LAN and with more simultaneous users:

In 1990, Navision 3.0 was launched. This version introduced AL, an internal application language similar to the actual Client/server Application Language (C/AL). This was a killer feature: the new application language made it possible to customize every part of the application and this was unique on the market at that time.

The product grew and in 1995 Navision Financials 1.0 was launched based on the Microsoft Windows 32-bit client/server platform:

The product was improved in the following years by adding more features as follows:

  • Integration of e-commerce applications such as Commerce Gateway, Commerce Portal

  • User portal, browser-based access

  • Supply chain collaboration functionality including manufacturing and distribution

  • Extended financial management functionality

  • Extended and new functionality within customer relationship management

  • Multicurrency

  • Multilanguage

On July 11, 2002, Navision was acquired by Microsoft and Microsoft created the Microsoft Business Solutions division. In September, 2005 Microsoft re-branded the product as Microsoft Dynamics NAV.

In November 2008, Microsoft announced Microsoft Dynamics NAV 2009, with a totally new architecture, as follows:

  • A new client called the RoleTailored Client

  • An old client (renamed as the Classic Client)

  • New objects called Pages for the RoleTailored Client

  • A new report architecture (RDLC with Visual Studio)

  • The possibility to have a three-tier architecture (with the RoleTailored Client) and the old client/server architecture (with the Classic Client):

Microsoft Dynamics NAV has had continuous improvements over the years on every aspect of its technical and functional side.

Microsoft Dynamics NAV 2013 introduced the following new features:

  • A totally new Web client with rich experience

  • A SharePoint client

  • Internal encoding is now Unicode (no longer ASCII)

The next main release, Microsoft Dynamics NAV 2013 R2, introduced the following new features:

  • Multitenancy (optional): The multitenancy architecture in NAV 2013 R2 consists of a single application database (containing tables common to all databases and objects) and multiple data databases (customer data and login tables). One NAV service tier can serve one application database and multiple tenant databases (and can also sit on different SQL server instances).

  • Provisioning tools: These tools are used for fully automating the deployment of NAV in Azure virtual machines (as IaaS). The provisioning tools include a set of Windows PowerShell cmdlets and scripts that install and configure Microsoft Dynamics NAV components, including Microsoft Dynamics NAV web server components, Microsoft Dynamics NAV Server, and SQL database components.

With Microsoft Dynamics NAV 2015, we saw the introduction of the following topics:

  • RapidStart Services: This is a set of tools and services to automate and speed up the setup and initialization phase of a NAV installation

  • New Tablet client: This is a new client for touch-optimized devices that enables you to access your NAV data regardless of location or what device you are using

  • Web client: The Web client is much improved and faster

  • Office 365 integration: This is simplified e-mail messaging via SMTP including Office 365, signing in to the Windows client using an Office 365 account

  • Document reporting with Microsoft Word: With this release, Microsoft has introduced the possibility to make document reporting by using Word with NAV

With the next release, Microsoft Dynamics NAV 2016, Microsoft introduced the following services:

  • NAV Universal App: By using the Universal Windows Platform, now we have one single app for all devices (it works as a tablet application or as a phone application according to the device you're using).

  • Eventing: Now we have events triggered on code like standard object oriented programming. A publisher raises an event when something happens and a subscriber can listen to this triggered event and make actions.

  • Code editor: We have a new code editor with code completion and IntelliSense.

  • Workflows: Based on eventing, you are now able to create your own business workflows with conditions and responses.

  • Microsoft Dynamics NAV support in Power BI: When you enter your Power BI account, now you have a new service called Microsoft Dynamics NAV that permits you to integrate your data to Power BI.

  • Integration with CRM: Integration with CRM is now native (coded in C/AL), so no more need to use the old CRM External Connector for handling integration tasks.

  • Microsoft Dynamics NAV managed service for partners: A significant new option for Microsoft partners interested in providing multitenant Software as a Service (SaaS) solutions built on Microsoft Dynamics NAV and deployed in the cloud on Microsoft Azure.

The latest release (Microsoft Dynamics NAV 2017) introduced the following new features:

  • Assisted setup

  • Smart notifications

  • Cash flow forecast with Cortana Intelligence

  • Design mode in the Web client

  • Improved integration with Office 365 and a new Outlook add-in

  • Embedded Power BI reports in the NAV RoleTailored Client

  • Improved extensions (new ways to develope customizations)

  • Dynamics 365 for Financials (NAV as SaaS)

Now we have a complete and full-featured enterprise platform that is appreciated all over the world, able to work on-premise and on-cloud, and on many devices as shown in the following screenshot:

 

Microsoft Dynamics NAV architecture


Before version 2009, Microsoft Dynamics NAV had a two-tier architecture.

In two-tier architectures (client/server data model), the data layers reside on the server and the application logic, presentation logic, and presentation layers reside on the client.

Starting from version 2009, Microsoft Dynamics NAV is composed of three major components (three-tier architecture), as follows:

  • Data tier: A database (database server) where the data are stored. Actually Microsoft Dynamics NAV supports only Microsoft SQL Server as the database server.

  • Middle or service tier: This is an application server. A NAV service that controls all the NAV business logic and operations.

  • Client tier: This represents NAV clients and is the layer that handles the real user interface for the application (presentation logic). NAV can have different types of client as follows:

    • Windows client

    • Web client

    •  Tablet client

    • Phone client

In a production environment, you can obviously have multiple instances of each of the core NAV components:

The most common NAV architecture configurations that you can have in a real-world installation are as follows:

  • All three tiers are on the same computer, useful only for a demo or a developer dedicated environment.

  • The RoleTailored client and Microsoft Dynamics NAV Server are on the same computer, the data tier is on a separate computer.

  • The data tier and Microsoft Dynamics NAV Server are on the same computer. The RoleTailored client is on a separate computer (one of the most common scenarios).

  • Each of the three tiers is on a separate computer. This is the suggested configuration for a production environment.

In addition to these three core components, there are other additional components that you can have on a NAV installation:

Component

Purpose

Microsoft Dynamics NAV Help Server

A website with the Help content for Microsoft Dynamics NAV in the languages that your version of Microsoft Dynamics NAV includes. You can deploy a single Help Server for all users, or customer-specific Help Servers, depending on your requirements.

Web Server Components

The components that are needed to enable Microsoft Dynamics NAV Web clients to connect with a browser.

Microsoft Dynamics NAV Server Administration Tool

A tool for configuring and managing the Microsoft Dynamics NAV Server and Microsoft Dynamics NAV sites. It has a GUI that permits an easy way to manage all the server's features.

Development Environment (C/SIDE)

The Development Environment for creating and modifying Microsoft Dynamics NAV applications (business logic) in C/AL.

Microsoft Office Outlook Add-In and Business Inbox

A set of components for synchronizing data, such as to-dos, contacts, and tasks, between Microsoft Dynamics NAV and Outlook and using Dynamics NAV as your business Inbox in Outlook.

Automated Data Capture System

A Microsoft Dynamics NAV tool for accurately capturing data for inbound, outbound, and internal documents, primarily in connection with warehouse activities. With Automated Data Capture System (ADCS), company employees use handheld devices and radio frequency technology to continuously validate warehouse inventories.

ClickOnce Installer Tools

A set of tools designed to create ClickOnce deployments for applications for the Microsoft Dynamics NAV Windows client.

When using the NAV Web client, all NAV web server components are installed as a website on the Internet Information Server (IIS), so you need to install and properly configure it:

You can deploy the web server components on one computer or on separate computers (for example, Microsoft Dynamics NAV web server components installed on a server and Microsoft Dynamics NAV Server and SQL Server installed on another server). When you install Microsoft Dynamics NAV web server components, the setup adds a web server instance (virtual directory and application) on IIS for the Microsoft Dynamics NAV Web client.

Microsoft Dynamics NAV supports four methods for authenticating users who access the Microsoft Dynamics NAV Web client: Windows, UserName, NavUserPassword, and AccessControlService. Windows authentication is configured by default.

When installing the Microsoft Dynamics NAV web server components (or after installation), you can also enable Secure Sockets Layer (SSL) on the connection to the Microsoft Dynamics NAV Web client to increase security.

The following table describes the required components when using the Web client:

Tier

Description

Device

A computer or device that has access to the Internet with a browser.

Web Server

A computer that is running IIS. Microsoft Dynamics NAV web server components are installed on a website on IIS.

Microsoft Dynamics NAV Server (Service Tier)

A Microsoft .NET Framework-based Windows service that manages communications and provides a security layer between clients and Microsoft Dynamics NAV databases in SQL Server.

When activated, the NAV Web client appears as shown in the following screenshot:

As previously described, starting from Microsoft Dynamics NAV 2016, we have also native clients for mobile devices. Here is a quick view of the NAV Phone client in the following screenshot:

You can now download a native Microsoft Dynamics NAV application from the store of your mobile platform (iOS, Android, Windows):

After downloading the app from the store, you can start using Microsoft Dynamics NAV from your mobile device. You can also work with your NAV data directly from Outlook:

In Outlook, you can now also create new NAV documents:

The new three-tier architecture is multithreaded and it can handle more than one process at a time. Actually, the Microsoft Dynamics NAV server can be installed only on 64-bit operating systems and it requires a 64-bit Microsoft SQL Server version.

Regarding the NAV client, the Windows client can be installed on 32-bit or 64-bit operating systems.

If you install the NAV Windows client on a 64-bit OS, you will have two version of the client installed (32-bit and 64-bit). The default is the 64-bit Windows client, but obviously you can change it.

If you install the NAV Windows client on a 32-bit OS, you will have only the 32-bit client installed.

Microsoft Dynamics NAV also supports deployments where several different companies access a centrally maintained Microsoft Dynamics NAV application. This is called a multitenant architecture.

In a multitenant architecture, information about the Microsoft Dynamics NAV application is stored in a separate application database while data is stored in separate business databases, each of which is a tenant in your deployment.

By separating the application from the data, you can deploy the same solution to many customers with centralized maintenance of the application and isolation of each tenant.

The application database contains the tables that define an application and other NAV system tables.

Microsoft Dynamics NAV now includes Windows PowerShell cmdlets that create an application database, and other cmdlets that enable you to create and administer tenant-specific databases. You can find a complete overview of every cmdlets at https://msdn.microsoft.com/en-us/library/jj672916(v=nav.90).aspx.

The Export-NAVApplication cmdlet is the one used to extract application tables in a Microsoft Dynamics NAV database to a separate database. The new application database is created on the same SQL Server instance as the original database.

The following table describes which system tables are moved to the application database when you run this cmdlet and which tables remain in the business data database:

Application database

Business data database

Chart

Access Control

Client Add-in

Active Session

Client Add-in Resources

Company

Debugger Breakpoint

Device

Debugger Watch

Document Service

Object

Integration Page

Object Metadata

Object Metadata Snapshot

Object Tracking

Object Translation

Permission

Page Data Personalization

Permission Set

Printer Selection

Profile

Record Link

Profile Metadata

Report List Translation

Send-To Program

Session Event

Server Instance

User

Style Sheet

User Default Style Sheet

Web Service

User Metadata

User Personalization

User Property

Note

For more information and details about NAV installation, you can check the Installation and Configuration Walkthroughs section at https://msdn.microsoft.com/en-us/library/dd301193(v=nav.90).aspx.

 

Microsoft Dynamics NAV deployments


A NAV deployment can essentially be as follows:

  • On-premise

  • On-cloud (IaaS or PaaS)

  • SaaS

With an on-premise deployment, Microsoft Dynamics ERP software is hosted at your own location on your own servers.

This type of architecture guarantees predictable performance (not subject to Internet connection related fluctuations in performance or availability), you can use the hardware and software infrastructure you already own, you can easily connect NAV with external systems that you can have inside your company, and obviously you have to guarantee data security (backup and so on) by yourself.

With on-cloud deployment, you can choose to deploy your NAV installation on the cloud by choosing from an Infrastructure as a Service (IaaS) architecture or a PaaS architecture. The Windows Azure platform permits you to have a complete NAV environment (virtual machine) totally scalable. Security is guaranteed by the Azure platform (redundancy, scalability, and so on).

Azure is the fastest and recommended way to implement a totally on-cloud NAV deployment.

The on-cloud deployment permits you to minimize your initial IT investments (no hardware costs, no IT staff for maintenance) and it supports your business as it grows (costs can scale with the actual use and needs of your solutions).

In an on-cloud deployment, you can choose to have the Microsoft SQL Server installed on a dedicated instance on an Azure virtual machine or you can use the Azure SQL database, a cloud service that permits you to have the SQL Server as a service, with reduced costs and no investments in database management tasks. With Azure SQL, you could also have a mixed deployment, where only the database tier is on the cloud.

There's also a very new option available on the market now: Microsoft Dynamics 365 for Financials (also known as Project Madeira).

Microsoft Dynamics 365 is a Software as a Service (SaaS) business proposition by Microsoft that aims to bring together the best of their CRM and ERP cloud offerings into one cloud service with specific, purpose built apps for each of your key business processes.

Microsoft Dynamics 365 for Financials is available on a simplified subscription model similar to the actual Office 365 offering and it guarantees a rapid ERP implementation (nothing to install or configure for the startup, no IT staff needed) and a familiar usage and user interface. You can work with Dynamics 365 from within Office 365 (no separate login to connect to the ERP) and you can do all your business from your familiar applications, for example, without having to leave Outlook (Dynamics 365 recognizes content such as invoice numbers inside an Outlook message and it suggests to you all the tools you need to process the document and complete your business process).

The interesting feature of this new SaaS ERP platform is that Dynamics 365 shares a Common Data Model (CDM) with Office 365. According to Microsoft's definition: it is a database of entities that are common across industry domains.

This new CMD provides all the standard business entities and it allows you to extend them and create new entities that suit your business. The CDM uses Azure technologies such as Service Fabric and Elastic SQL and it guarantees security, scalability, and consistency across applications.

The following screenshot shows an overview of the Dynamics 365 platform's architecture:

Dynamics 365 is available in the following two editions:

  • Business (a cloud-based solution based on NAV core)

  • Enterprise (AX and CRM core)

Dynamics 365 is licensed by the following three features:

  • License by App: It will be licensed by app (you can activate a specific functionality you need).

  • License by Role (or by Plan): It will be licensed based on the role of your employees. Licensing by Role/Plan is a package of apps for companies that need to access multiple functions (for example when an employee works on Operations and Finance at the same time) 

  • License for team members: It will be licensed by team members (something like a light user):

A big new feature of Dynamics 365 will be the app concept. Users will be able to go to Microsoft's dedicated marketplace called AppSource and download a range of applications to suit their specific needs. You can reach the AppSource website at https://appsource.microsoft.com:

The new apps are built as extensions to the ERP core and they can be easily and independently deployed (you can pay for what you really need and use).

The new platform is natively integrated with Power BI and Cortana Intelligence. For example, you can install a feature from the Extension MarketPlace called Sales and Inventory Forecast and after a quick setup you can go on the item list, select an item, click the Forecast FactBox, and immediately see its sales and inventory forecast:

The connection with Cortana Intelligence is given natively by the platform (no configuration needed), as shown in the following screenshot:

Dynamics 365 is an ongoing project, and more and more features will be added in the coming months and years.

 

Differences between NAV deployments


Choosing the best NAV installation architecture is not always an easy task.

The first question that an IT staff has to decide is: should I go on-premise or should I want to embrace the cloud?

Normally, the ERP is a core software component for a company and this decision can affect your business a lot.

Statistically, about 49% of IT decision makers said that they are worried about the security implications of cloud services. Data protection, privacy, and availability are the main obstacles to cloud adoption.

But is this true?

When a company stores all its core data internally, it has more or less complete control over who can access the data and data availability. An IT decision maker normally considers the company's data more secured when it is stored in a data center that he/she can completely manage and protect from the devil outside world.

This could be true in theory, but the practice is often very different. Actually, there's no company that can guarantee a service level agreement and a security policy like the cloud. Obviously, a safe backup and data protection strategy must always be guaranteed, no matter if you go on-premise or on-cloud.

There are many other aspects to consider when choosing between on-premise or cloud-based solutions, as follows:

  • Infrastructure costs

  • Performance

  • Growth of solutions

  • Upgrades

Infrastructure costs

On-premise architectures require an initial investment in order to buy the required hardware and software and to have experienced IT staff to manage the system. Once the system is fully functional, you will also require costs and time for periodically maintaining and upgrading the entire hardware and software solutions.

In a cloud-based architecture, normally you have a much lower initial cost (pay-as-you-go) and you don't have to take care of hardware maintenance. The cloud platform gives you these services.

Performance

The main obstacle in this field is certainly the latency of Internet connection. When you're on-premise, everything is on your LAN and performance is managed by the internals.

On a cloud-based solution, Internet connection and bandwidth are a requirement that can affect your business a lot. If the Internet connection is missing, your business could be blocked. If the bandwidth is poor and network latency is high (too much delay in data communication over the network), your working experience could be a pain. You need stable and high speed Internet connectivity to go on-cloud.

Growth of solutions

When you start a project, normally you analyze all the requirements and at the final stage you arrive at a final hardware size structure that satisfies your needs and maybe your predictable growth:

  • In an on-premise solution, you have your hardware infrastructure that satisfies your actual needs. If one day you have to increase the growth of your architecture, you have to review your hardware and invest money for on infrastructure upgrades.

  • In a cloud-based solution, if your business has big growth or during peak periods, you can easily expand your solutions by increasing the calculation performance or expand your infrastructure in new regions, all in an easy, quick, and transparent way (scaling).

Upgrades

With an on-premise architecture, you have complete control over your infrastructure's upgrades (hardware and software) and you can decide what type of upgrade to apply and when to apply it.

In an on-cloud architecture, you could have some aspects of the infrastructure where upgrades are not completely under your control but they can be deployed globally from the solution provider.

Here's a comparison between the different types of Microsoft Dynamics NAV installation previously discussed (pros and cons):

On-premise

On-cloud with Azure VM

On-cloud with Azure SQL

SaaS (Dynamics 365)

Physical hardware is required.

No hardware is required.

No hardware is required.

No hardware is required.

IT staff (internal or partners) is required for infrastructure maintenance and SLA.

Infrastructure SLA comes from the Azure platform. IT tasks are reduced.

Infrastructure service level agreements (SLAs) come from the Azure platform. IT tasks are reduced.

No IT staff is required

Software installation is required (server + NAV + clients).

Server installation is deployed via the Azure portal.

Server installation is deployed via the Azure portal.

No installation is required.

Predictable performances, but is difficult to scale.

It is easy to scale as needed.

It is easy to scale as needed.

There is no control on scaling.

It is not dependent on Internet connection.

It is dependent on Internet connection.

It is dependent on Internet connection.

It is dependent on Internet connection.

It involves high startup costs.

It invovles medium startup costs.

It involves medium startup costs.

It involves low startup costs.

There are no costs per usage.

There are costs per usage (Azure VM).

There are costs per usage, based on database throughput units (DTUs) consumed.

There are costs per usage.

SQL Server license is required.

SQL Server license is required.

No SQL Server license is required (Azure SQL has different pricing).

No SQL Server license is required.

Maximum DB size is based on SQL Server license.

Maximum DB size is 16 terabytes (due to Azure VM disk restrictions).

Maximum DB size is actually 1 terabyte (via the P11 offering).

Actually, we have also a new value proposition by Microsoft: Microsoft Dynamics NAV Managed Services for Partners. With this PAAS proposition, Microsoft hosts your NAV database to the cloud and you build and sell your NAV solution to your customers.

This proposition could be interesting if your business model is repeatable, volume-oriented, and with a low cost of sale. The solution must be multitenant.

As a final consideration, we can say that nowadays a cloud-based solution has more benefits than risks. The only real limit to this choice is availability: if your cloud service shuts down or your Internet connection is down, your business could be at a huge risk.

If you decide to embrace the cloud for the deployment of a Microsoft Dynamics NAV architecture, you have to carefully check your Internet connectivity and bandwidth and you have to carefully choose your cloud provider. It has to guarantee a big uptime (SLA) over time.

Note

For the Microsoft Azure SLA, you can check out https://azure.microsoft.com/en-us/support/legal/sla/.

 

Performance and installation tips


For a successful NAV implementation, performance is an important aspect to consider and to carefully monitor.

The following are the main NAV points to check in order to have better performance:

  • Data tier (SQL Server Database)

  • Service tier

  • C/AL code

Data tier (SQL Server Database)

Microsoft Dynamics NAV relies on Microsoft SQL Server as its database, so recommendations on optimizing SQL Server performance for NAV are much the same as other types of data-intensive applications:

  1. Split the database into more data files and locate them on different disks.

  2. Every time a record is added, modified, or deleted from any table in the database, SQL Server updates all the indexes that are related to those tables. Check the indexes and re-build them periodically by using SQL Server Maintenance Plans. By rebuilding the indexes, you avoid fragmentation.

  3. Rebuild the indexes and recalculate the statistics (this is automatically done when you rebuild an index).

  4. Check your database Recovery Model and periodically shrink your transaction log.

SQL Server indexes are created on a column level in tables and views and they provide a quick way to retrieve data based on the values within the indexed columns. After frequent database operations (insert, update, delete) indexes can have pages where logical ordering (based on the key value) differs from the physical ordering inside the data file. This means that there is a high percentage of free space on index pages, and that SQL Server has to read higher number of pages when scanning each index. As a result, performances will suffer.

You can use this script to manually rebuild indexes on your NAV database:

    DECLARE @TableName varchar(255)  
 
    DECLARE TableCursor CURSOR FOR  
    SELECT table_name FROM information_schema.tables  
    WHERE table_type = 'base table'  
 
    OPEN TableCursor  
 
    FETCH NEXT FROM TableCursor INTO @TableName  
    WHILE @@FETCH_STATUS = 0  
    BEGIN  
    DBCC DBREINDEX(@TableName,' ',90)  
    FETCH NEXT FROM TableCursor INTO @TableName  
    END  
 
    CLOSE TableCursor  
 
    DEALLOCATE TableCursor 

Note

For more information, check the MSDN site at https://msdn.microsoft.com/en-us/library/hh169233(v=nav.90).aspx.

Service tier 

Here is a summary of the most important things to check.

Number of Microsoft Dynamics NAV service tiers

If you have many users, you have to consider creating more than one NAV service tier and balance the user's connection between the different services. In my experience, the number of users for the service tier without impacting on performance is about 40. If the number of your users is more than 40, you should start thinking about using more than one service tier.

Server memory

Each Microsoft Dynamics NAV service tier needs about 500 MB of memory to run and a certain amount of memory for every active session (even if idle). The standard amount of memory to count is about 10 MB per session, but obviously the more pages a user opens, the more memory usage increases.

Server CPU - cores and speed

This could be obvious, but if you have a fast CPU you will have better performance. The more cores you have, the more things in parallel you can do (the NAV service tier is 64-bit and multicore enabled). Idle sessions on the Microsoft Dynamics NAV service tier don't use any CPU power.

Data cache size

This is a Microsoft Dynamics NAV server setting, which is located in the CustomSettings.config file:

    <add key="DataCacheSize" value="9" /> 

The number specified in the DataCacheSize setting determines how much memory is used for caching the data:

Value

Memory

9 (default)

512 MB

10

1 GB

11

2 GB

12

4 GB

13

8 GB

14

16 GB

15

32 GB

When running a single tenant system (classic installation) the default value of 9 is probably good but on a multitenant installation (where the cache is shared between tenants) this value could be increased.

Metadata provider cache size

This is a Microsoft Dynamics NAV server setting, which is located in the CustomSettings.config file. It sets the metadata provider cache size (the number of objects cached). A value of 0 means the cache is disabled:

    <add key="MetadataProviderCacheSize" value="150" /> 

In the three-tier environment, objects are cached in the service tier. The value of 150 is default one but in my experience this value is too low. You can try to up this parameter and monitor memory load on the server.

Maximum concurrent calls

This is a Microsoft Dynamics NAV server setting, located in the CustomSettings.config file, and it's the maximum number of concurrent client calls that can be active on the Microsoft Dynamics NAV server.

To disable this setting, set the value to MaxValue:

    <add key="MaxConcurrentCalls" value="40" /> 

The more cores in your server, the higher this value can be.

Maximum concurrent connections

This is a Microsoft Dynamics NAV server setting, which is located in the CustomSettings.config file, and it's the maximum number of concurrent client connections that the service tier will accept. To disable this setting, set the value to MaxValue:

    <add key="ClientServicesMaxConcurrentConnections" value="150" /> 

Note

For more information about monitoring the Microsoft Dynamics NAV Server using performance counters, check the MSDN site at https://msdn.microsoft.com/en-us/library/dn414713(v=nav.90).aspx.

C/AL performance

Obviously, the way you write code on NAV can seriously affect performance.

C/AL (the NAV native language) has a set of commands optimized for SQL Server data access and your code should consider these new instructions. Here are a few basic things to remember:

  • Never use FIND('-') or FIND('+') but use FINDFIRST or FINDLAST instead (these are optimized for finding the single first or last record in the specified filter and range).

  • Use GET when you have to retrieve a record via a primary key.

  • When you want to retrieve a set of data or loop through it, use FINDSET. This function is optimized for finding and modifying sets of data, without creating cursors (and without using the FETCH commands called on SQL Server). However, this is only valid for the first 500 records (this number can be changed in the NAV database properties and can be increased if needed). After the default 500 records, the loop will still create a cursor, like in the old NAV versions. These are the general rules when using FINDSET:

    • FINDSET(FALSE,FALSE): This is a read-only command and uses no server cursors, and the record set is read with a single server call.

    •  FINDSET(TRUE,FALSE): This is used to update non-key fields. This uses a cursor with a fetch buffer (similar to FIND('-')).

    •  FINDSET(TRUE,TRUE): This is used to update key fields.

  • To check if a set of records contains data after filters have been applied, use the ISEMPTY function.

  • Avoid too many FlowFields on tables and pages.

  • Use SETAUTOCALCFIELDS when you have to retrieve data and request a calculation of associated FlowFields.

  • When you have to apply filters to a set of records, use the right index by using SETCURRENTKEY.

    Note

    For more information, check the MSDN site at https://msdn.microsoft.com/en-us/library/dd355237(v=nav.90).aspx.

  • It is recommended to check also the C/AL Coding Guidelines published by the NAV Design Pattern Team at https://community.dynamics.com/nav/w/designpatterns/156.cal-coding-guidelines.

  • You can perform C/AL performance testing by using tools such as the Microsoft Dynamics NAV performance testing repository in GitHub at https://github.com/NAVPERF. This is out of the scope of this book but it could be useful to bookmark the link.

 

Summary


In this chapter, we have covered the NAV architecture and we took an overview of the different NAV installations (on-premise, on-cloud, SaaS), discussing the pros and cons of each.

In the second part of the chapter, we analyzed the performance problems you can have in your NAV architecture and provided tips to help you rectify them.

In the next chapter, we'll see how to open a Microsoft Dynamics NAV implementation to the outside world by using the web services native functionalities of NAV.

About the Author

  • Stefano Demiliani

    Stefano Demiliani is a Microsoft MVP on business applications, a Microsoft Certified Solution Developer (MCSD), Azure Certified Architect, and an expert in other Microsoftrelated technologies. His main activity is architecting and developing enterprise solutions based on the entire stack of Microsoft technologies (mainly focused on ERP and the cloud). He has worked with Packt Publishing on many IT books related to Azure cloud applications and Dynamics 365 Business Central, and is a speaker at conferences around Europe. You can reach him on Twitter (@demiliani) or LinkedIn.

    Browse publications by this author
Book Title
Unlock this full book FREE 10 day trial
Start Free Trial