[MXS-1887] Using cache causes slow read from mysql server Created: 2018-05-29 Updated: 2018-06-20 Resolved: 2018-06-20 |
|
| Status: | Closed |
| Project: | MariaDB MaxScale |
| Component/s: | cache |
| Affects Version/s: | 2.2.6 |
| Fix Version/s: | 2.2.10 |
| Type: | Bug | Priority: | Major |
| Reporter: | Konstantin Pavelko | Assignee: | Johan Wikman |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
mysql server: 5.7.17-11-log |
||
| Sprint: | MXS-SPRINT-60 |
| Description |
|
I'm testing MaxScale for caching selects from mysql server. I've created simple application that periodically reads data from a huge test table with 2M rows and 512MB size using query
The application directly connected to mysql server reads the entire table in 4 seconds.
TestCache.json:
The application reads data from the cache pretty quickly: 1-2 seconds. But invalidating cache leads to very slow read from mysql backend server: about 2 minutes! It is actually performing read operation as I see this query in mysql process list.
|
| Comments |
| Comment by Johan Wikman [ 2018-05-30 ] | |||||
|
Ok, let me rephrase what you have written to ensure that I have understood the problem.
Is the above correct? Then, do you with But invalidating cache leads to very slow read from mysql backend server: about 2 minutes! mean that if time-to-live has passed, then reading the table takes 2 minutes? | |||||
| Comment by Konstantin Pavelko [ 2018-05-30 ] | |||||
|
exactly! | |||||
| Comment by Johan Wikman [ 2018-05-30 ] | |||||
|
Now, that's interesting. Let's first do some simple experiments.
How much memory do you have in the computer and what else do run there in addition to MaxScale? | |||||
| Comment by Konstantin Pavelko [ 2018-05-31 ] | |||||
|
Remove the debug=31 line. Does that have any impact. Cache logging is disappeared, nothing other is changed: fresh load data from db still takes 2 minutes Remove the rules line. Does that have any impact. The behavior is the same. It seems w/o rules MaxScale cache all selects. Nothing is changed. Fresh load from db always takes about 2 minutes. How much memory do you have in the computer and what else do run there in addition to MaxScale There are many processes, but they consume a few resources. The server has CPU idle time 90-95% and 25GB free memory. | |||||
| Comment by Johan Wikman [ 2018-05-31 ] | |||||
|
Thanks for trying those out. I'll see if I can repeat the behaviour. | |||||
| Comment by Johan Wikman [ 2018-06-15 ] | |||||
|
konst In your setup, how long does it take the first time you read the data through MaxScale with the cache configured? That is, when the cache does not contain the data but will be populated with the data. Johan | |||||
| Comment by Johan Wikman [ 2018-06-15 ] | |||||
|
konst In my test setup, which is much smaller with 200000 rows I get the following kind of figures for SELECT * FROM tbl.
So it would be quite interesting to know how long it takes the first time you query through the cache. | |||||
| Comment by Konstantin Pavelko [ 2018-06-15 ] | |||||
|
I believe the problem appears on huge data.
| |||||
| Comment by Johan Wikman [ 2018-06-18 ] | |||||
|
Ok, so you get the large load-time also the first time the data is fetched and not just when the TTL kicks in. That's good to know as it suggests the issue is not related to the TTL but to the population of the cache. I'll see if there's something that could be done about that. | |||||
| Comment by Johan Wikman [ 2018-06-18 ] | |||||
|
konst Ok, I found a problem that could explain the behaviour. If I build you a custom package, would you be interested in trying it out whether the fix helps your situation? | |||||
| Comment by Konstantin Pavelko [ 2018-06-18 ] | |||||
|
Ok, I'll try | |||||
| Comment by Johan Wikman [ 2018-06-19 ] | |||||
|
konst Thanks for helping out. What OS do you use? | |||||
| Comment by Konstantin Pavelko [ 2018-06-19 ] | |||||
|
> MaxScale is running inside OpenVZ container with no resource limits. | |||||
| Comment by Johan Wikman [ 2018-06-19 ] | |||||
|
konst Sorry, I meant what kind of package do you need? E.g. Ubuntu or CentOS? | |||||
| Comment by Konstantin Pavelko [ 2018-06-19 ] | |||||
|
Johan, Please prepare package for CentOS 7 | |||||
| Comment by Johan Wikman [ 2018-06-20 ] | |||||
|
konst Ok, here you are: http://max-tst-01.mariadb.com/ci-repository/2.2.6-MXS-1887/ Please try it out and tell me how it behaves. Johan | |||||
| Comment by Konstantin Pavelko [ 2018-06-20 ] | |||||
|
Johan, thank you for your update. | |||||
| Comment by Johan Wikman [ 2018-06-20 ] | |||||
|
konst Thanks for verifying that the fix works as intended. The fix will be included in 2.2.10 that probably will be released next week or the week after that. Johan |