Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Great delay in asking questions on my site

+3 votes
asked Aug 9 in Q2A Core by islam afify
edited Aug 14 by islam afify

I noticed that my site after the number of questions reached more than 300 thousand has become take more time when I ask a question or answer or hide or show question

Q2A version: 1.7.5
commented Aug 10 by ProThoughts
How many CPU and how much RAM?
commented Aug 10 by islam afify
CPU : 2x Intel E5-2620v3
Ram : 4GB

3 Answers

+1 vote
answered Aug 14 by sama55

Have you looked for a bottleneck by enabling performance measurement mode?


define('QA_DEBUG_PERFORMANCE', true);


In this case, shown information is the performance data of the redirected page after posting.

commented Aug 14 by islam afify
I did so
What is the solution
+1 vote
answered Aug 14 by islam afify


You have copied the database
  Then the questions were deleted and the question was asked quickly
Does this mean that the problem is that the sheer number of questions is the cause of the problem

commented Aug 15 by sama55
Performance after redirect seems to have no problem.

Processing right after posting may be slow. If you try disabling all plugins, is the posting process slow? If posting process becomes faster by disabling all plugins, it is necessary to suspect event processing. However, this possibility may be low.
Search all sources under qa-plugin folder with "x_post"/"x_queue"/"x_hide"/"a_select" words ('x' = 'q'/'a'/'c').

And also, there is possibility of MySQL configuration problem. I think this possibility is high. Scott's research method may be effective.
commented Aug 15 by islam afify
No problems with plugins

I think the problem is in the database
Because I created a new database that was fast on the same server

Is the problem in the database or because it contains a large number of questions, answers and comments
+1 vote
answered Aug 15 by Scott
edited Aug 15 by Scott

I did a test on my site (only 37,000 questions but over 235,000 posts in total) and it appears that many queries are running when asking a question (I get 62). That sounds like too many for just asking a question so I'll check into it and see if there is some problem there.

UPDATE: if you wanted to check what queries are run on the ask action itself, you can. Turn debug mode on. In qa-include/pages/ask.php where you have the call to qa_redirect(...) (should be line 145 in v1.7), above that add the line

return qa_content_prepare();

Now when you submit a question it will stop before redirect and show a blank page but with the debug info at the bottom and all the queries. Feel free to email me the list and I'll look for any bottlenecks.