A
A
Alexander2018-11-19 10:39:02
MySQL
Alexander, 2018-11-19 10:39:02

I turn on query_cache on InnoDB - the difference in Waiting Timings (TTFB) is noticeable, I remove query_cache and press F5 - the response does not decrease ... Why?

Hello!
I have a database, it was MyISAM, it became InnoDB (560MB somewhere).
Recently upgraded from 5.5 to 5.7. On the site, the Select operations are mainly used, in connection with which I used for a long time:

query_cache_size = 128M
query_cache_type = ON
query_cache_limit = 1M

And he rejoiced at the lack of brakes even at a very large (1.5 million per day)
attendance. There, of course, another configured Nginx and Xcache were by the
way.
When I changed the engine to InnoDB , I read in many sources,
including yours, that query_cache is an obsolete hero, and he’s not a hero
at all, because. slows down the system at large values, and indeed
InnoDB has innodb_buffer_pool_size for cache , make it larger than the total
size of your database and norms. I did this (my.cnf):
query_cache_size = 0
query_cache_type = 0
query_cache_limit = 1M

innodb_file_per_table = 1
table_open_cache = 4096
innodb_open_files = 4096
innodb_buffer_pool_size = 4G # На сервере 32G оперативной памяти
innodb_buffer_pool_instances = 8
innodb_log_file_size = 512M
innodb_log_buffer_size = 2M
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 2
innodb_read_io_threads = 8
innodb_write_io_threads = 8

But I noticed that the timings of Waiting (TTFB) have increased and they do not change
with a simple page refresh.
For example, I have rather heavy requests in the admin panel (all
Select) - a list of 500 sections is displayed there, there are also
subsections for them, the number of sales, statistical data, etc. With
query_cache enabled: 1st
page load: 2.2 sec
2nd load: 0.3 sec query_cache: 1st page load: 3.4 sec 2nd page load: 3.2 sec (and here is my question - WHY???)

I've already read everything I can about the innodb_buffer_pool_size device, but
I don't understand why it doesn't cache the Select request...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
neol, 2018-11-19
@neol

query cache caches the result of a query.
The buffer pool caches data and indexes to reduce HDD/SSD access.
These are completely different caches and they are not interchangeable.
If you need to cache the result - cache in the application.

A
Alexander, 2018-11-19
@Bladefx

Thanks for the answer! Do I understand correctly that if you refuse query cache, then look towards Memcached for MySQL InnoDB?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question