Up to Futurama version 20.02 improving the performance of an webservice application was a difficult task. It was not possible to get an insight in the performance of your webservice application in order to see what formulas should be changed. To improve the performance of an application, you had to guess which formulas could be causing the problem and use a trial and error method to see what changes improved the performance. From Futurama 20.02 it is possible to get an overview of the performance of your webservice application. With this overview you can get an insight in the performance of the different formulas to examine what formulas should or possible could be changed.
It is possible to run your application with a specific config setting, where an Excel sheet is created with the number of calls and the performance per formula. The performance of your application can be improved by redesigning your formulas or by using caching. The performance analysis can help you to determine what formulas should be changed to improve the performance. This functionality is currently only available in Futurama Webservice when using the Compile setting. See this page how to configure the performance analysis. While running your application with the performance analysis, an Excel sheet is created with the performance of your formulas. The information that is available in this Excel sheet and how to interpret this information is explained on this page.
Performance analytics information
When the performance analytics is configured within your application, you can execute one or multiple webservice calls to your application. During these calls, the webservice will automatically create an Excel sheet within the configured FileName location (see Calculation). The different calls to your application and the formulas that are executed, will be saved within this Excel sheet. After an application reset, a new Excel sheet will be created and it will start again with call 1. Make sure to create a backup of the Excel sheet before resetting the application, if you wish to review this Excel sheet later.
Within the created Excel sheet, different information about your application and formulas is available. This Excel sheet contains the following information:
- Item ID; This column contains the ID of the Futurama formula.
- callnr; This is the number of the request that is send to the webservice. After the webservice is started, the PerformanceAnalytics will start with callnr 1 for the first request, then use callnr 2 for the second request, etc. With this value the performance for 1 specific call can be viewed. After an application reset, the performance analysis will again start with callnr 1.
- # of Calls; Within this column the total calls to this formula is shown.
- # of Calls from cache; When a formula is called multiple times, some of these calls will be used from the cache instead of executing this formula. Within this column the number of calls that are used from the cache is shown. The number of calls above minus the number of calls from the cache is the number of times the formula is calculated.
- # ticks excluding children; This column contains the time per formula. To improve the performance, the formulas with the highest number of ticks are the most interesting. A tick is the smallest unit of time recognized by a device. In absolute sense a tick doesn't tell you much, but in relative sense it can be used to compare the time needed to execute the different formulas.
- location; This column contains the location of this formula within your Futurama document. The location and the item ID can both be used to find the correct formula within your document.
Interpretation of the performance analytics
Performance of the different formulas
With the performance analytics it is possible to determine which formulas are taking the highest calculation time. These formulas are the interested ones to examine as they possibly can be improved in order to reduce the overall response time of your webservice call. You can sort the column '# ticks excluding children' to get the formulas that are the slowest. As pointed, it is best to first look at the formulas that take the longest in order to get the biggest improvement. When the performance analysis is turned on, your application will be much slower. Keep this in mind when looking at the performance of your application. It is important to compare the performance with the performance of the other formulas within the same session. The comparison of the total request time with a non-performance analytics session doesn't give a good view on your performance, because the performance analytics will make it slower.
Caching of the formulas
Within an application you can use caching to make sure fixed formulas aren't executed multiple times. See this page to see how to turn on caching. When using caching, the first request after an application reset isn't interesting. This request will normally be executed during the warm-up of your application and will be used to cache the different fixed formulas. With the performance analytics you should look from the second request and forward, because these requests will use the formulas that are cached from the first request. From the second request forward it is possible to look at the different formulas that should be cached, to check if the caching is done correct. Within the column "# of Calls from cache" it is possible to see how much of the total calls to this formula is used from the cache.
Tips to improve the performance
There are different changes that can be made to improve the performance of your application. Some of these changes will be explained below with tips how to speed up the performance of your application.
Use of allowed ranges
When using an argument within a formula, it is possible to set an allowed range for this argument. See the Formula page how to use allowed ranges in an argument. When using allowed ranges, the calculation will be executed faster when using CalculationMode Compile. Make sure that all arguments within your application have an allowed range if this is possible.
Use arguments of type long
It is possible to use different types of arguments. If you wish to speed up your application, it is best to use arguments of the type long. With arguments of type long it is for instance possible to use allowed ranges (see the tip above).
Avoid the use of dynamic xpaths
Within a XmlField it is possible to use a dynamic xpaths. However, the use of dynamic xpaths can be bad for the performance of your application, so it is best to avoid dynamic xpaths if possible. When validating your document, you may get a message when using dynamic xpaths. You could change these dynamic xpaths to fixed xpaths to improve the performance. See the XmlField page for more information.
Use of caching
When executing the same formula multiple times, it is a good idea to use caching. With caching turned on, the formula will be executed the first time and the result will be stored in the cache. The next time the same answer of this formula is needed, the formula won't be executed again, but the result will be used from the cache. This way the formula won't be calculated every time and the performance of your application will be better. See the Cache page how to enable caching within your application. With the performance analysis you can make sure that the caching is done correctly by checking the total number of calls and the number of calls from cache.
If you have any questions about this subject or if you want to provide us feedback please send us an e-mail.