We have News site with lots of hits per day. So we are decided to optimize the code for anonymous user. We logged the query list of all pages, then we confirmed that all pages are retrieved from performance cache except the node page. The same bunch of queries repeated twice in the node page. In our node page we have some custom blocks, node comments and captcha.
Then I take the following steps to find the cause.
Removed the block from the node page --- No improvement
Enabled the block to the node page and disabled the comment module ---- No improvement
Enabled the block and comment module , Disabled the captcha ------ There is the great improvement.
So i realized that there is some performance issue in captcha. I analyzed the captcha.module file and find the cause. In line 505 [$captcha = module_invoke($captcha_point->module, 'captcha', 'generate', $captcha_point->type);] causes the query repeating. This line is to generate the captcha. Please look at the issue and help me to get alternate solution. I also try to fix the issue.