1

We're implementing a .NET DXA based solution for a client. We found the loading time of images on pages is very long. Most of their TTFB time is more than 10s which impacts the performance of the site.

DXA version is 1.6.

configuration in Web.config is:

<modules runAllManagedModulesForAllRequests="true">
  <add name="DxaStaticContentModule" type="Sdl.Web.Mvc.Statics.StaticContentModule" />

</modules>

viewModel-caching is also enabled.

Anything wrong?

update on 7/2 the issue happens for all binaries. even the image is very small (2K). for application pool setting, we have already set 'recycling ->regular time interval' to 0 I enable the trace log. I see even those images can be found in file cache. they still need much time to be loaded. below is the log for one image. it spent 35 seconds to load. (I hidden some sensitive url). the time between content url rewriting and OnPreRequestHandlerExecute for the rewritten url is very long.

2019-07-02 10:08:42,262 [456] TRACE - StaticContentModule.BeginRequest(ASP.global_asax, System.EventArgs) : "/**/**/system/v0.120/assets/images/icons/icon-fly-from.png" entry.
2019-07-02 10:08:42,723 [456] DEBUG - Rewriting versioned static content URL '/**/**/system/v0.120/assets/images/icons/icon-fly-from.png' to '/**/**/system/assets/images/icons/icon-fly-from.png'
2019-07-02 10:09:17,303 [454] TRACE - StaticContentModule.OnPreRequestHandlerExecute(ASP.global_asax, System.EventArgs) : "/**/**/system/assets/images/icons/icon-fly-from.png", 0001/1/1 �W�� 12:00:00 entry.
2019-07-02 10:09:17,387 [454] DEBUG - Binary with URL '/**/**/system/assets/images/icons/icon-fly-from.png' is still up to date, no action required

updated on 7/4 application pool setting

  • Recycling->Private Memory Limit:0
  • Recycling->Regular Time Interval:0

about the log, I just pick those related to that picture. there is only entry because I saw url '/system/v0.120/assets/images/icons/icon-fly-from.png' is rewritten to '/system/assets/images/icons/icon-fly-from.png', and between the entry of original url and entry of rewritten url, the time is 35 seconds. Even in every step, the time is very short. But in front end, we will see it will take more than 35 seconds to load the image.

  • Try setting DXA log level (in Log.config) to TRACE to get more insight in where time is spent on the server. – Rick Pannekoek Jul 1 at 17:44
  • please see my update on 7/2 @RickPannekoek – Ivy Chen Jul 2 at 3:28
  • Currently the entire trace is on a single line in the Question, making it very hard to read. It seems it only contains method entry traces, not the exit ones (which trace the time taken)? – Rick Pannekoek Jul 2 at 6:16
  • sorry, I didn't find how to format the log last time. – Ivy Chen Jul 4 at 9:57
1

Tracking the root of the issue is difficult but let us put out the scenarios so that you can narrow down the issue. In general, the DXA is just another web application and best practices to setup a web application on a server should still be followed.

At a high level : Does the issue happen for all binaries (new vs changed vs unchanged)?

The reason is that that DXA retrieves binaries from the database (for new and changed images) and serves the images from the BinaryData folder for unchanged images (metadata and content). If the slowness is only for changed images, there could be issues with your database or network connections to your database. You can monitor IIS and database for incoming requests and trace the bottleneck.

If it happens for all binaries (small, large, new and unchanged), it could be that the application server is unable to handle requests efficiently. Look into your application pool settings as app pool recycles will slow down the application as well. Monitoring the IIS queue will reveal the issues. You can simply refresh the a couple of binaries few times and trace the issue.

Also, enable DEBUG in your logs to see if you are noticing any issues with your application server and IIS logs. If you update your question with a relevant error or warning message / update based on the suggestions above, we can help narrow down the issue.

  • the issue happens for all binaries. even the image is very small (2K). for application pool setting, we have already set 'recycling ->regular time interval' to 0 – Ivy Chen Jul 2 at 2:00
  • I also enable TRACE in log. I can see those images are from file cache. for example I see "Binary with URL '****/Images/social-facebook_tcm303-1523.jpg' is still up to date, no action required". this image is only 2K. but its loading time is more 2 seconds. – Ivy Chen Jul 2 at 2:59
  • please see my update on 7/2. @Shiva – Ivy Chen Jul 2 at 3:29
  • @IvyChen, Can you update your application pool recycle settings to based on private memory and a high value ? Can you also update the question with your application pool settings? – Shiva Jul 2 at 16:28
  • see the setting above @Shiva – Ivy Chen Jul 4 at 9:58
0

Inbetween StaticContentModule.BeginRequest and StaticContentModule.OnPreRequestHandler there is no DXA code executed, but only other HTTP Modules in the IIS HTTP pipeline.

Do you have the AmbientFrameworkModule enabled? If so, can you try disabling it (i.e. remove it fron the pipeline in Web.config).

Do you have other HTTP Modules configured which may cause the delay (check in IIS Manager; it will show HTTP Modules which are inherited from higher up in the configuration hierarchy).

  • AmbientFrameworkModule is not enabled. – Ivy Chen Jul 5 at 3:03
  • there are so many inherited modules. how can I check? – Ivy Chen Jul 5 at 3:10
  • Try setting runAllManagedModulesForAllRequests=“false” to limit the number of HTTP Modules which are triggered (if all is well, the DXA StaticContentModule should still be triggered). – Rick Pannekoek Jul 5 at 6:46
  • it will cause the site doesn't work. – Ivy Chen Jul 8 at 9:02
0

Can you try adding below tag in the web.config of the application you are using?

Note - It will set the binary cache duration to 900 sec which is the default.

<add name="Binary" cacheName="longLivedCache" />

And also check the Content Service cache settings in the cd_storage_config file if it is set properly?

  • 1
    Which tag? I don't see anything.... – Nuno Linhares Jul 5 at 6:58
  • Ahh, it was not showing due to HTML formatting which I have corrected now. – Manish Mehmood Jul 10 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.