Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
in Q2A Core by
edited by

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
what is your server config? is it dedicated server?
Yes server vps
How many CPU and how much RAM?
CPU : 2x Intel E5-2620v3
Ram : 4GB

3 Answers

+1 vote

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.

I did so
What is the solution
+1 vote


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

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.
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
edited by

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.