Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
3.2k views
in Q2A Core by
My site contains more than 450,000 questions
When asking a new question takes a lot of time is it because the database is large and is there a solution to speed up asking the questions
Q2A version: 1.8
by
I noticed that this plugin very slows down the site in versions q2a 1.8. After the removal of this plugin, the site normally fast openend.
https://github.com/amiyasahu/q2a-social-share
by
The issue with that plugin was already reported. This happened in Q2A version 1.7 for me. The exact reason was an image creation function call causing memory leak.
by
I have the same problem, please how did you solve the problem?

3 Answers

+1 vote
by
I had this problem the solution is more RAM. or talk to your users and start over.
by
i have Ram 4 my site use % 25 Just
by
@islam afify, is this dedicated server only for your site? how  many CPU? are you using SSD? what is version of php and mysql? 4GB RAM may be good, but depends on how much traffic you get and how much utilization. what are the plugins you are using other than default.

all these factors can contribute to slow down your site.

List details here or PM me, I may be able help you.
by
I have installed another site on the same server and the questions are asked quickly so the problem is not in the server
by
Have u cloned your site or installed fresh q2a?
by
Just copy the files and install a new database
If you try to use the database for the primary site the same problem occurs in the new site
by
I assume you installed exact same plugins that are on primary site, including ads and other scripts.

Which hosting provider you are using?

I recommend you to clone same site and enable q2a debug performance, this flag is in qa-config.php file(QA_DEBUG_PERFORMANCE, true)

then share new site, will see what is causing issue.
by
There is no difference between them

But note something important

Asking questions is very quick if you use moderation
It is slow when the question is accepted
what does that mean?
by
edited by
How about measuring the time of post processing?

For example ...

Source: qa-include/app/post-create.php (about L70 ?)

Code for measuring:

$debug_time = array();
$debug_time[] = microtime(true);
qa_post_index($postid, 'Q', $postid, @$followanswer['postid'], $title, $content, $format, $text, $tagstring, $categoryid);
$debug_time[] = microtime(true);
qa_update_counts_for_q($postid);
$debug_time[] = microtime(true);
qa_db_points_update_ifuser($userid, 'qposts');
$debug_time[] = microtime(true);  // !!! Added !!!
for($i=0; $i < (count($debug_time)-1); $i++) {
    echo "{$i} processing time: ";
    echo ($debug_time[$i+1] - $debug_time[$i]) . "seconds<br>";
}
exit;
by
0 processing time: 0.010718822479248seconds
1 processing time: 8.3870871067047seconds
by
I updated "Code for measuring".

$debug_time[] = microtime(true);  // !!! Added !!!

Re-try it.
by
0 processing time: 0.015072107315063seconds
1 processing time: 6.4552569389343seconds
2 processing time: 0.021444082260132seconds
by
If you set true to the QA_DEBUG_PERFORMANCE in the config.php, is there a particularly slow query?

 For example, what is the processing time of the query below?

INSERT INTO qa_userpoints (?????.'points) VALUES ('?????') '.
                'ON DUPLICATE KEY UPDATE '????points=????+bonus
by
It is statistical information. Query logs is in the different location in the debug panel.
by
There is another thing to try. Is the performance improved by returning to 1.7.5? If so, a fatal performance problem may be in V1.8.
by
That's right. Is there a particularly slow query in that?
Of course, it must be a log when asking a question.
by
It is a log of the question page after redirection. Comment out redirect process below. As a result, question page will not be shown after asking question.

qa-include/pages/ask.php (around L171)
Before:
qa_redirect(qa_q_request($questionid, $in['title'])); // our work is done here
After:
//qa_redirect(qa_q_request($questionid, $in['title'])); // our work is done here
+1 vote
by

To islam afify

Since other users will trouble by email, let's discuss in the new (this) answer section.

by
Thank you for your help
I've tired you a lot
by
I wish for good luck.
by
You have deleted the qa_posts table
The question is quickly asked. I think the problem is the number of big questions
by
I have the same problem, please how did you solve the problem?
+2 votes
by

The cache update queries are slow because the indexes are not properly tuned. This has already been discussed and I have explained it here.

Create the following indexes:

CREATE INDEX `test_index_1` ON `qa_posts`(`type`, `acount`, `closedbyid`);
CREATE INDEX `test_index_2` ON `qa_posts`(`type`, `selchildid`, `closedbyid`);
CREATE INDEX `test_index_3` ON `qa_posts`(`type`, `amaxvote`, `closedbyid`);

Try again and report back the results. Currently:

cache_unaqcount: 2347.10 ms
cache_unselqcount: 2699.90 ms
cache_unupaqcount: 2103.15 ms

If you are a purist and don't want those changes you can remove them with:

DROP INDEX `test_index_1` ON `qa_posts`;
DROP INDEX `test_index_2` ON `qa_posts`;
DROP INDEX `test_index_3` ON `qa_posts`;

by
I did all the recommendations but nothing changed
by
Have you restarted MySQL server?
by
Yes, I also used MySQLTuner again and there are no recommendations
by
I have the same problem, please how did you solve the problem?
...