Galaktikasoft

Scalable XAF Application Server

XAF allows creating Enterprise Systems quickly – this is the thing which is especially admired by developers. With all the wealth of "out of the box" functionality, questions of "three-tier" architecture in the current version of XAF have still been worked out poorly, although the possibility of its implementation is provided by the framework.
Below we’ll show how to implement one of these features: to increase the reliability and efficiency of the execution in the system of time-consuming operations with the possibility of scalable performance.

Statement of the Problem

Reliable execution of long-running operations is one of the most important tasks for the Enterprise Systems. This is especially true for the operations and reports with the formation time of more than twenty minutes. Not only that such operations are blocking the client system, locking users to the standstill. The reliability of this scenario is also questionable: the client computer may crash or lose network connection during the hours-long report generation and generated report will be lost, and the time wasted.

Such resource-intensive operations are usually performed on high-dedicated servers: RAM is often not enough to complete the generation of a report or perform the calculations.
Another approach is the delayed generation of resource-intensive reports on the schedule with the following sending of the results to users. For example, at night you want to run the report generation automatically so that the managers are able to analyze prepared reports in the morning.
How to solve this problem?

The idea of Xafari Server

During the creation of business systems of automation, we were constantly faced with the need for asynchronous execution of calculations and deferred reporting.
We needed to perform calculations and create XAF Report asynchronously and preferably on a dedicated server. It was decided to develop a full service for XAF applications capable of generating in this scenario.

Initially, we tried to implement these services using regular module «XAF Workflow» - but it was not very comfortable due to the instability of the WWF service and its administration.
Using Devexpress Report Server also proved to be impossible: it is a universal product which is aimed at the solving of common reporting tasks. It is not intended for the work in the XAF-application.

The first step that we have planned to implement is to create the report server for Xafari (XAF) applications.
It should be noted that within the Xafari framework there is a Xafari Report Module which significantly extends the functionality of the standard XAF Reports Module. Thus, within Xafari Reports the developer may determine:

Therefore, we needed a report server just for our "Xafari Reports".
On the analysis and discussions to solve problems in an asynchronous/deferred reporting, we decided to implement a universal solution "Xafari Server".

Implementation

Thus, it was necessary to develop a Xafari Server - a separate service that handles the tasks in the message queue and stores the results in a XAF application database.
XAF has a carefully elaborated and flexible architecture and allows you to find unconventional solutions due to the presence of sufficient extension points. However, we had to spend a lot of time and effort to get the implementation of the operations on the Xafari Server from the user's account, as well as to provide a real multi-threaded server operation. The details have been given below.

The ease and convenience of using XAF is explained by a unified approach to the application development. We tried to keep the same principles while using the Apps Server. When writing the algorithm for calculating or report design an application developer should not greatly wonder where the code will run: either on the Apps Server or on the application on the workstation. If a customer has a Xafari Server, some operations can be transferred to it.

It was necessary to teach the client application to interact with the Xafari Server. To do this, we had to implement a message queue to which customers generate new tasks (messages) which are then processed on the server. Xafari Server is a separate service that handles the task in the message queue and stores the results in a XAF application database.

During the implementation of the project the following problems have been solved:

The ease and convenience of using Xafari Server is explained by the use of all the advantages of XAF, storing messages from the queue in the database, as well as storing the results of processing messages. This allows you to make the work of an application programmer absolutely "transparent".
On the whole, we have managed to fully achieve our objectives.

There had been doubts whether we would be able to provide an acceptable performance for its own implementation of the queue. The testing has shown that the performance of the production MQ services, of course, could not be reached. However, the obtained results fully satisfy the needs of current tasks. For example, on the average workstation, the performance message queue was more than 1000 messages a second, which is more than enough for our target scenarios. We also managed to solve the problems of locks set by numerous parallel handlers.

Message queue

We would like to highlight the main advantages of the message queue, here we are giving the link to the post by Roman Kononov "Message Queuing". This article describes the reasons for which the message queue is vital for any enterprise application architecture. Here is the abbreviated description:

With the release of Xafari.MQ and Xafari Server all the developers, administrators and customers of the systems on the platform Xafari will be able to use these advantages of message queues.

The first release in Xafari x06

We are releasing Xafari Report Server in Xafari x06 version
The user creates a new report which is processed on the server and stored in the application database. The user can view the saved report at any time.
In this scenario, we had to further implement the ability to save the results of the reports in the database for long-term storage, as well as services that clean the storage.

Expansion plans and development

Next, we are planning to implement the following projects:

  1. Extended Xafari Server for asynchronous execution of business-operations
  2. Servers configurator to monitor their work
  3. Administrative module for the management of the queue of Xafari Server
  4. Message handling services on schedule
  5. API and services of notices and reminders

Follow our publications.
We will welcome feedback and we will be really happy to discuss various options for the use of the services, as well as development priorities.