Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We sometimes experience a very slow response of a Sites page. Usually the page renders in less than a second but sometimes it takes 8 or more seconds.

When digging into the debug logs I recognized that between two lines the execution seems to stop for a couple of seconds. This usually happens not in our APEX code but in the backend directly.

I assume this is a kind of context switch between our org and other orgs.

Is there a way to ensure this context switch will not happen during the execution of specific parts of the code?

here is an example. The backend simply sleeps for 5 seconds.

    16:03:15.267 (267157000)|ENTERING_MANAGED_PKG|com__salesforce
16:03:15.267 (267195000)|SYSTEM_METHOD_EXIT|[52]|, Object)
16:03:15.267 (267211000)|SYSTEM_METHOD_ENTRY|[49]|system.ListIterator.hasNext()
16:03:15.267 (267226000)|SYSTEM_METHOD_EXIT|[49]|system.ListIterator.hasNext()
16:03:15.267 (267253000)|SYSTEM_METHOD_ENTRY|[51]|MAP<String,Schema.DescribeFieldResult>.get(Object)
16:03:15.267 (267274000)|SYSTEM_METHOD_EXIT|[51]|MAP<String,Schema.DescribeFieldResult>.get(Object)
16:03:15.267 (267334000)|SYSTEM_METHOD_ENTRY|[52]|, Object)
16:03:15.267 (267341000)|ENTERING_MANAGED_PKG|com__salesforce
16:03:15.267 (267381000)|SYSTEM_METHOD_EXIT|[52]|, Object)
16:03:20.252 (5252795000)|SYSTEM_METHOD_ENTRY|[49]|system.ListIterator.hasNext()
16:03:20.252 (5252829000)|SYSTEM_METHOD_EXIT|[49]|system.ListIterator.hasNext()
16:03:20.252 (5252873000)|SYSTEM_METHOD_ENTRY|[51]|MAP<String,Schema.DescribeFieldResult>.get(Object)
16:03:20.252 (5252902000)|SYSTEM_METHOD_EXIT|[51]|MAP<String,Schema.DescribeFieldResult>.get(Object)
16:03:20.253 (5253018000)|SYSTEM_METHOD_ENTRY|[52]|, Object)
16:03:20.253 (5253027000)|ENTERING_MANAGED_PKG|com__salesforce
share|improve this question
Could you post these two lines of debug? – Sergey Utko Dec 17 '12 at 17:58
i added the debug log output. – iwerstler Dec 18 '12 at 16:06
@iwerstler what is that managed package? It looks like something native to salesforce but I don't remember ever seeing this in site debug logs. It seems that the comparator method for some of your sobjects is taking a long time to complete. If you compare those sobjects through anonymous apex does it also take a long time? – Greg Grinberg Dec 18 '12 at 20:08
that shows up when I raise the system or apex edebug log level to fine/finest (don't remember any more) – iwerstler Dec 19 '12 at 17:07
that shows up when I raise the system or apex debug log level to fine/finest (don't remember any more). exactly(!) the same code usually executes without any pausing just 1 out of 50 times it pauses like this. – iwerstler Dec 19 '12 at 17:16

I'd raise this with support if you have a Developer support agreement as it most likely involves issues far outside your control.

My most likely 'guess' is that its a Java Virtual Machine garbage collection pause which is 'stopping the world'.

I will however cheerfully put that in the category of speculation

"HotSpot’s G1 also has potential but it is prone to same problem as JRockit – sporadically pause time becomes unreasonably long (few seconds). "

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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