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 force.com 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]|com.salesforce.api.fast.System.compareObjects(Object, 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]|com.salesforce.api.fast.System.compareObjects(Object, Object)
16:03:15.267 (267341000)|ENTERING_MANAGED_PKG|com__salesforce
16:03:15.267 (267381000)|SYSTEM_METHOD_EXIT|[52]|com.salesforce.api.fast.System.compareObjects(Object, 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]|com.salesforce.api.fast.System.compareObjects(Object, Object)
16:03:20.253 (5253027000)|ENTERING_MANAGED_PKG|com__salesforce
Attribution to: iwerstler
Possible Suggestion/Solution #1
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
http://java.dzone.com/articles/how-tame-java-gc-pauses
"HotSpot’s G1 also has potential but it is prone to same problem as JRockit – sporadically pause time becomes unreasonably long (few seconds). "
Attribution to: Steven Herod
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/5498