1

I have a VF page that calls a search method from my class using Javascript Remoting. I found that the very first call for the day takes a very long time, and often goes over the timeout (I currently have it set to the max 2 mins).;

After that very first call, all others take a second or less.

It seems maybe something is being cached, and rebuilding that cache in the morning takes a long time? Any of you guys run into this issue before and any thoughts on how to fix?

This is an ongoing project, and so far when I need to demo, I would make sure I run through the page first before showing it to others. But here have been some times when a user loaded the page in the morning before I got to it, and they ran into the slow first call.

Thanks

4
  • Yes, the first user of the day usually gets hit with slow performance due to SF rebuilding indexes and stuff. There was a discussion on here last year about this but I cannot seem to find it. One horribly hackish way to try and deal with it is to have a batch job run early in the morning that run a test search which would cause the org indexes to be refreshed at that point. Then the first user would be the batch and not the human. - Someone please correct me if I am crazy here
    – Eric
    Commented Aug 17, 2017 at 15:12
  • Interesting. Is that for the first remoting call for the whole org (ie. just any remoting call in the batch should do)? Or first for the specific class method (ie. I have to call all my methods in the daily batch)? Also, since this project is still ongoing, I've only tried these in a sandbox. I'm assuming this is a problem in the prod org as well?
    – John
    Commented Aug 17, 2017 at 15:16
  • You'll want to watch this DF presentation that explains a bit about the stuff that happens in the platform. It'll explain quite a bit about what Eric is saying.
    – sfdcfox
    Commented Aug 17, 2017 at 16:19
  • FYI, we have a service deployed on Heroku that is touched by a Jenkins build scheduled to run every 30 minutes. This stops the dyno from sleeping and so avoids the big startup delay when the dyno has gone to sleep. It also acts as a warning if there is ever a problem with the service (as there was earlier this week). You could consider something similar as a last resort for your page or the underlying API.
    – Keith C
    Commented Aug 17, 2017 at 19:48

0

You must log in to answer this question.

Browse other questions tagged .