Answered: how to properly set up parameters in qa confing to optimize Q2A site?

Post date: 2020-08-02 11:04:59
Views: 119

1. QA_CACHE_DIRECTORY

The path can basically be whatever you like, as long as it's outside your webroot, but the FHS suggests /var/cache for cached application data. So, something like this should do:
define('QA_CACHE_DIRECTORY', '/var/cache/q2a/');

Note that this assumes you have root access to the server. Should that not be the case you need to pick a location where you have write access (but still outside the web root directory), for instance

define('QA_CACHE_DIRECTORY', '/home/u310886959/q2a-cache/');

If you're running several sites you should use separate caches per site, e.g.

define('QA_CACHE_DIRECTORY', '/home/u310886959/q2a-cache/example.com/');

3. QA_OPTIMIZE_DISTANT_DB

From the documentation:

Question2Answer is engineered to minimize the number of MySQL queries used per page. This allows you to separate your database and web servers without suffering too much from latency. The downside is that the resulting queries can be quite complex. If your database and web servers are running on the same box, latency is not an issue, so set QA_OPTIMIZE_LOCAL_DB to true and QA_OPTIMIZE_DISTANT_DB to false in qa-config.php. This will uses many simple MySQL queries instead of fewer complex ones.

However, the part about the the QA_OPTIMIZE_LOCAL_DB setting is apparently outdated according to the comments in the config:

The option QA_OPTIMIZE_LOCAL_DB is no longer used, since QA_OPTIMIZE_DISTANT_DB covers our uses.

If the database and application are running on the same server use the default setting

define('QA_OPTIMIZE_DISTANT_DB', false);

That will increase the number of queries against the database, but since no remote connection is involved the cost for that is cheap. For a remote database you want to reduce the number of connections to improve performance, because network traffic is expensive (compared to local connections).

Please click Here to read the full story.
 
Other Top and Latest Questions:
Movie: Spy x Family Code: White
Franklin: (all episodes)
Help me assess the morals of applying for a C-Suite role
Self-made millionaire who retired at 35: The first time I felt financially secure, I was 'living small' and spending 'a lot less'
New Baby, Good Neighbors
Tesla job cuts heighten Wall Street concerns that EV maker faces a demand problem
Sen. Tom Cotton encourages drivers to drag Gaza cease-fire protestors from blocked roads
Potential Trump trial jurors dismissed because of bias against former president
Why a $100,000 income no longer buys the American Dream in most places
Flights are still being disrupted and rerouted after Iran's attack on Israel. Here's what you need to know