As coders, we try to deliver an excellent user experience through the solutions we develop and deliver. After all, good user experience is what makes our products phenomenal.
In my opinion, fast application performance or a fast website contributes significantly to making a best-in-class user experience. Performance is something, which is usually talked about most, yet often neglected. In enterprise applications, we deal with complex technical designs for databases and user interfaces too.
While we don’t compromise on UX design and features, it becomes challenging for teams to keep the performance up to the mark. However, performance is an equally important part of the user experience, so significant attention should be paid to it. Anything which takes a longer time to run than expected makes the users lose their attention. This leads to a bad user experience.
In my experience as a developer, I have had opportunities to work on performance bottlenecks and optimize applications. So, in my blog today, I will summarize how we can avoid and tackle performance issues in SAP S/4HANA, keeping simple yet effective practices in mind.
You can use them in your application wherever applicable.
Let’s look at them in order of technical architecture from bottom to top.
When it comes to databases in S/4HANA, common objects that we develop are in CDS views and services.
The following practices can be very useful in avoiding performance issues while developing CDS views:
- Use the same key fields to join the CDS view throughout the execution flow whenever possible.
- Using ‘where’ clauses efficiently can push the filters down to the database tables.
- In CDS, there are various annotations available for different purposes. Make use of them wherever applicable. Right annotations, especially in analytical views, can really help improve performance.
- Avoid writing long nested case statements. Nested case statements usually take longer to run.
- If your use case requires a union. So, if possible, try using union after you have done other calculations and operations.
- Avoid writing long authorization checks in Data Control Language objects. Make sure they don’t form any time-consuming SQL sub-statements when executed.
Now, here are some steps we can follow to make sure the code runs smoothly and efficiently in the application layer.
- Use DDL names instead of tables or SQL views for select queries in ABAP code.
- Select only the relevant attributes. Avoid ‘select *’ if all the attributes are not required.
- Use OData query and URL options effectively.
- Try to accommodate the database calculations in the data layer only. Push this logic to the data layer as much as possible, as CDS calculations take place on the HANA engine.
There can be instances when even after following all the above points, we see that the application takes more time than expected to load, respond etc.
User interface too plays a big role in optimizing this time.
The tips below help in improving application performance. These are very simple to follow and can be very impactful.
- Identify the necessary library files and load their dependencies too. Load only required files and avoid loading any unnecessary libraries.
- Preload data at a previous action mostly when the intent is for the user to display it.
- Use asynchronous batch processing when using APIs to avoid showing blank screens in the application.
- Try not to keep the user idle if the execution is taking too long. Use animations and engaging busy indicators.
- Use manifest:true in the Component to preload the dependencies before the Component.
- Always load the UI5 core from the content delivery network (CDN). CDNs speed up delivery as they retrieve the relevant files from the closest remote server to the user.
- Use ‘data-sap-ui-preload=”async”’ at the bootstrap-level to preload libs in ‘data-sap-ui-lib’. Preloading helps in saving time when the controls render on the screen.
All these best practices combined together definitely help in achieving fast application performance. Even if these are used, keep looking out for other ways to improve the application execution time click by click. Performance is not a one-time task, it should be a continuous improvement.
If you are interested in viewing similar articles, visit our blog, here.
View our LinkedIn, here.