A
A
Alexander2016-03-03 23:04:00
PHP
Alexander, 2016-03-03 23:04:00

WordPress get_num_queries() averages 100 queries for the main page, is that a lot?

Good afternoon!
I built several sites on WP in conjunction with ACF
using the code

<?php
echo 'WordPress: '
    . round(memory_get_usage()/1024/1024, 2) . 'MB '
    .' |  MySQL:' . get_num_queries() . ' | ';
timer_stop(1);
echo 'sec';
?>

displayed the number of requests and memory consumption.
On 3 different sites, the result is this
WordPress: 8.51MB | MySQL:102 | 0.212sec
WordPress: 8.41MB | MySQL:101 | 0.211sec
WordPress: 24.45MB | MySQL:107 | 0.281sec The
question is, what do these indicators give and are they bad?
And the main thing is whether it is possible to understand from this information how many visitors the hosting will withstand?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Vorotnev, 2016-03-04
@mais64

1. ~100 is not a little, and not a lot. Quite a working value, especially for WP + ACF (in this case, it’s even rather small).
2. The amount of memory used is very normal.
3. Execution time 200ms is normal. Not great, but quite normal. After all, we are talking about the execution of everything, and not just queries to the database. Now, if only these 100 queries in the database were executed so much, then this is already sadness.
Optional:
4. Use the Query Monitor plugin for detailed statistics, including the time of executing queries to the database.
5. Use object cache (memcached / redis on the server + plugin for WordPress), both WP itself and ACF add database queries there, which noticeably speeds up the work.
No :) You need to know the hosting parameters + settings for nginx/apache, php, mysql, the same memcached/redis (if any). And the OS itself on the server, to be honest. I/O, open file limits, descriptor caches, even TCP Congestion Control can make a huge difference.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question