Upgrade HANA Express and optimize memory usage
As every few months an updated release of SAP HANA Express Edition is available (see Release Notes) a regular task is upgrading the own HANA Express to gain bug fixes and new features and simply stay up to date.
With the upgrade there is an easy way to improve memory usage of various XSA components to make development more stable and get ride of WebIDE crashes like the ones described in my question “WebIDE for SAP HANA 2.0 (SPS02) crashes frequently on Git Push” posted at the SAP Community. As you can see the solution goes back on a recommendation of Lucia Subatin, which is working in SAP Developer Relations Team and is very active on HANA Express and HANA XSA topics.
Memory Usage before Optimization
Memory is a rare asset in the context of SAP HANA as you need plenty of it. Especially when you want to have HANA on your laptop and all the goodness from HANA XSA. So SAP tried to optimize memory consumption where ever possible to lower the entry barrier to run HANA Express Edition. They did a good job, at some point too good! As result at least with default settings in SPS 02 you had regular crashes in WebIDE and productive development was almost impossible.
Let’s have a look on memory consumption before the optimization with the Application Monitor of the XS Advanced Administration (following screenshot was taken, after using WebIDE and deploying and starting some Node and HTML5 XSA applications):
You can see that especially di-core was sized too poor with 256MB as it actually already uses almost the double (504MB).
Memory Usage after Upgrade & Optimization
After the upgrade with optimizations (let’s call it Upgrade “Plus”) the situation looks better and WebIDE crashes were gone (probably also because the updated version of WebIDE got many bugfixes). I was still somehow thrifty but from my experience 768MB for di-core, 144MB for devx-ui5 and 512MB for di-runner are doing well.
Upgrade “Plus” of HANA Express (here from SPS02 to SPS03 rev30)
The upgrade is a time consuming tasks. On my environment (IntelNUC with i7 core, 32 GB RAM, fast SSD) it’s not a matter of minutes but of two hours. The normal upgrade process is shortly described in the tutorial “Updating SAP HANA, express edition (Virtual Machine)” (Link). I follow these procedure with few addons the change the memory setting for the components. So let’s go step by step.
First you need to download the installation files for the binary installation (despite you have the HANA Express running as VM!) with the HANA Express Download Manager. Transfer both archive files hxe.tgz and hxexsa.tgz on the VM’s file system (I use as target /usr/sap/HXE/home/Downloads):
Login as hxeadm user (e.g. with Putty) and extract both files. We got a new folder HANA_EXPRESS_20, which contains the software components, and a setup script for initially setting up HANA Express, which we will not use here as we assume you have HANA Express already installed:
The Plus – modify memory settings for some services of the WebIDE component
Now we come to the “Plus” by changing some memory settings for the WebIDE component services. Therefore we open the MTA deployment extension descriptor (mtaext file extension) of the WebIDE component. For SPS03 (revision 30) this file is located in folder XSAC_SAP_WEB_IDE_20 and is called sap-xsac-devx-4.3.23-hxe.mtaext. The version number will be different for newer revision:
With the extension descriptor you can define runtime properties/values for the services at deployment time. Such values are for example proxy information, user provided service credentials, URL’s and also memory settings. So lets open this file with the vi editor by typing:
press I to go into edit modus and change the memory settings for services di-core to 768M, for service di-runner to 512MB and for service devx-ui5 to 144MB. I also change setting DI_BUILDER_MEMORY for resource di-builder-configuration to 312MB:
To save the changes press ESC to leave the edit modus and then :wq to write the changes and quit vi editor. Now we good to run the upgrade with the changed memory settings.
Run HANA Express Edition upgrade
Let’s move in the HANA_EXPRESS_20 folder. Before we start the upgrade we first run a garbage collection to free up memory. Run as sudo the script hxe_gc.sh:
To start the upgrade run the script hxe_upgrade.sh:
Enter all the necessary information and the passwords for hxeadm, SYSTEM and XSA_ADMIN. Be very carefully when entering the passwords, if you making this wrong, you could mess up you complete HANA installation.
Now cross fingers and after around 2 hours later you should finally see the success message “HDB is successfully upgraded.”
Congratulations!! You have now a SAP HANA Express system with improved memory settings for productive XSA development.
Besides many bugfixes you presented also with new features. For example with SPS03 there is now the new SAP HANA XS Advanced Cockpit available which is basically the same as the Cockpit which is used in SAP Cloud for SAP Cloud Foundry:
With this new optimised environment you are now ready to develop full-stack HANA XSA applications. Have fun.