cancel
Showing results for 
Search instead for 
Did you mean: 

Performance issue csn.json / OData metadata in CAP application

htammen
Active Contributor

We have a huge data model that we want to expose via CAP and Fiori Elements. This data model consists of appr. 1.500 entities.

In a first prototype we created about 300-400 entities. Cause a lot of the entities are connected to each other via associations and aggregations in this first approach we exposed all entities via one CAP service.
This approach is extremly slow. For the first request the user has to wait about 3 minutes. ~2.5 minutes till the first byte (TTFB = Time To First Byte) of the OData metadata request arrives at the client. The rest is needed by SAPUI5 / Fiori Elements to parse the metadata file and render the UI.

We then created another "performance testing prototype". Because one of the main interest entities with all it's connected entites is huge this sums up to appr. 130 entities which is still a huge model. As a result this application still needs 1.5 minutes for TTFB.
The csn.json has a size of 7.0 MB. The OData metadata file that is generated and transmitted to the client is appr. 4.3 MB in size.

Cause 1.5 minutes for TTFB is still to much in a productive environment we separated the one big CAP / OData service into several ones. After all optimizations which are possible at design time we have a resulting csn.json size of ~2.5 to 4 MB and a OData metadata size of ~350 to 800 kB for the several services.
This leads to the following response times:
TTFB: 6 - 15 seconds

This sounds great but is still to much for a productive application.

So my question is: Is there a way to deploy preprocessed OData metadata files to the server (XSA) or can we preprocess the csn.json file(s) after deployment of our MTAR file so that the server just has to deliver these preprocessed files?

Thanks in advance
Helmut

AB
Contributor

I'm intrigued Helmut! I'd love to learn more about the business context - sounds interesting such a large data model. Perhaps a blog post to share the story?

Accepted Solutions (1)

Accepted Solutions (1)

Daniel7
Advisor
Advisor

Hi Helmut, that is a Node.js application I suppose?

Yes your app is huge but we serve similar ones internally (1600 entities) which we had to optimise. The measures include:

  1. using streamlined compiler option
  2. using pre-compiled csn.json
  3. need to double-check whether you have own server.js?

ad 1: See capire release notes feb20 → will become default with release 4 of @sap/cds, planned for upcoming week.

ad 2: we can share the steps and config with you in a follow up

ad 3: if yes, we'd have to jointly look at that

Regards,
Daniel

Answers (0)