Enhancing the ArabSea SMACC system by using Azure Functions
ArabSea is the leading accounting/CRM solution provider in their region, which we engaged with throughout our fiscal year 2016 as managed ISV. Recently, we introduced Microsoft Azure Functions to help in migrating and centralizing all scheduled tasks. The solution built to migrate three Windows services from IaaS to PaaS using Azure Functions. Azure Functions serves as middleware to settle the customer transactions. In this project we used Azure Functions, Azure Storage, the Elastic Database feature of SQL Database, and Visual Studio to implement and publish the functions.
Core team:
- Nasser AlNasser – Sr. Technical Evangelist, Microsoft
- Ali AlKhudair – Audience Evangelism Manager, Microsoft
- Muhamed AlGhazawi – Apps Development Specialist, Microsoft
Customer profile
ArabSea is a Saudi company, based in Riyadh, that provides financial solutions for small and medium-sized businesses (SMB) with its product SMACC, which is the leading accounting/CRM solution for SMBs in the region. It has been used by more than 55,000 customers with more than 500,000 user licenses. It works with 13 languages: Arabic, English, Chinese, French, Portuguese, Spanish, Turkish, German, Persian, Urdu, Indian, Russian, and Indonesian.
Products and services:
- SMACC (Saudi Administration & Accounting System)
- SCRIBES System
- Warehouses, Government Procurement Management System (GIC)
- Customs Clearance System
Problem statement
ArabSea is the leader in accounting solutions in the region. They were looking for modern cloud solutions to help them easily scale and roll out new features with faster time to market, easier manageability, and higher availability. At the beginning of 2016, they started their migration from IBM to Azure, and they found what they are looking for in terms of a robust and trusted cloud platform.
One thing they brought with them from their legacy infrastructure is a set of complicated and unmanaged Windows services scheduled tasks, which handle critical business processes such as migrating users from trial to paid. These Windows services are running on infrastructure as a service (IaaS) virtual machines (VMs), which make them less manageable in comparison with platform as a service (PaaS) equivalents. Also, having all these Windows services on the VMs gave misleading utilization stats about the VM capacity, so ArabSea couldn’t focus on the real load that is caused by the user demand rather than the Windows services processing time.
The process of releasing new features and updates to those services required touching many source code files, which meant that the development team had a tough time to synchronize and ensure they were releasing the correct build.
Because of these issues, operational efficiency, development time, and quality were suffering and needed an immediate solution.
Solution, steps, and delivery
We worked extensively with ArabSea development team to analyze these Windows services and determine how we could migrate them to a more robust and reliable service that provides full control over the development and operation. Most importantly, the solution shouldn’t leave any compute dependency on the VMs, while at the same time it needed to provide full integration and accessibility to those VMs.
ArabSea’s managing director about the solution:
Previously, we were using Windows Service scheduler for performing operation of database backup at storage drive and restoration of database in elastic pool, but now we are using Azure Functions for these type of features. Azure Functions are serverless, reduce the load on VM, and also reduce the cost in the long-term use.
We successfully implemented three core business scenarios and migrated them from Windows services to Azure Functions.
Scenario 1: Move trial customers to paid licenses
ArabSea provides a 30-day free trial subscription. To lower the cost, these trial accounts are hosted on SQL on a VM, not on an Elastic Database pool. If a user decided after his trial period to subscribe to one of the paid plans, some data migration needed to happen. We implemented this scenario in Azure Functions:
- Check every 10 minutes whether a customer record is flagged to be moved from trial to licensed.
- If so, back up the customer database and move its BACPAC file to Azure Storage.
- Call an internal method to roll out this backup to its corresponding Elastic Database pool.
We wrapped many of the functionalities in one DLL for easier code reuse and manageability.
Scenario 2: Upgrade or downgrade a license
ArabSea is using the Elastic Database feature of SQL Database to host the licensed customers, but they also assign customers to different pool sizes depending on the customer size, and the price is based the number of users, data size, and so on.
Implementing this entirely new function as a Windows service would place a huge load on the VMs if the customer database is big. So we implemented this function using Azure Functions:
- The function is triggered every 10 minutes to check whether a new customer database is flagged to be upgraded or downgraded.
- The function change the pool of the customer database instantly by using ALTER.
We used some of the code written for the previous function for reading database status and executing queries against the database pool.
The ArabSea team was amazed by the speed and the ease of implementing new business processes using Azure Functions.
Scenario 3: Archive databases of customers with expired licenses
One of the issues ArabSea faced after moving to the cloud is how to manage the expiration of paid subscriptions. For how long should they keep the customer account in their systems?
After analyzing their current techniques and trying to find a way to map them to their current Azure SQL architecture, we decided not to leave the account in the pool and just lock it, which is what they had been doing. Instead, we used Azure Functions to backup the account and its data and configuration, delete everything from the pool, archive the backed-up files on a low-cost storage option, and flag the central system to remove this backup after 90 days if the customer didn’t ask for it.
- The function is triggered every 10 minutes to check whether a subscription is expired.
- It then backs up the database of the customer whose subscription is expired.
- The function places this backup in low-cost storage.
- After ensuring the backup and store operations completed successfully, the function removes the database from the pool.
- It then flags the customer record in the central (portal) database to be removed after 90 days.
Conclusion
ArabSea was astonished by the implementation results, especially that they are able now to focus on what matters the most and not to worry about those background and scheduled tasks. Their managing director said, “ArabSea is now able to focus more on releasing top business features at a much faster pace to its customers.”
In just the two weeks since soft launch, Azure Functions served more than 200 ArabSea customers through at least one of the above-mentioned scenarios. The ArabSea team now is working on identifying new business cases in which to use Azure Functions, especially for operational efficiency and automation.
ArabSea published a press release about this engagement.
Left to right: Ali AlKhudair (AEM, Microsoft), Muhamed AlGhazawi (Apps Dev Specialist, Microsoft), Siddique Haidar (Developer, ArabSea), Nasser AlNasser (TE, Microsoft), Adil Musa (PM, ArabSea), Johny (Development Team Lead, ArabSea)